Design of smart chess board that can predict the next position based on FPGA

Design of smart chess board that can predict the next position based on FPGA

Volume 3, Issue 4, Page No 193-200, 2018

Author’s Name: Alaa Hamza Omran1,a), Yaser Muhammad Abid2

View Affiliations

1Department of Information System Management, University of Information Technology and Communication, Baghdad, 00964, Iraq
2Department of Business Information Technology, University of Information Technology and Communication, Baghdad, 00964, Iraq

a)Author to whom correspondence should be addressed. E-mail: engineeralaa90@gmail.com

Adv. Sci. Technol. Eng. Syst. J. 3(4), 193-200 (2018); a  DOI: 10.25046/aj030417

Keywords: Artificial Neural Network, Smart Chessboard, Back propagation algorithms, Chess game, Intelligent chessboard, Intelligent controller and Supervised feed forward algorithm

Share
618 Downloads

Export Citations

The abilities of human brain to discover solutions for many problems is a great gift that motivate the scientists to develop the revolution of the artificial intelligence and using it in many areas. This paper proposed an intelligent chessboard which works in a way that similar to the human brain that predicts the next positions for any piece of the chess. MATLAB is used in the training of the artificial neural networks of the chessboard and implemented on FPGA as a hardware part; the proposed system has many advantages such as the low cost of production with a high efficiency in the prediction of the position of any piece on the chessboard and the similarities to the human brain.

Received: 29 June 2018, Accepted: 26 July 2018, Published Online: 29 July 2018

1. Introduction

This paper is an extension of work originally presented in 4th IEEE International Conference on Engineering Technologies and Applied Sciences (ICETAS) [1].

In the early centuries, wars among major countries were in the zenith of prosperity, and the countries that have consultants who develop strategic plans for the Wars were prevail these wars; therefore, a game known as “kings game” was appeared. This game helps in developing the strategic plans without any human losses; it was spread rapidly in most countries and enticing many people because of its ability to motivate the human mind to think in a smart way. Furthermore, many schools in the world start to teach this game and considering it as the one of the games that test the intelligence [2]. Currently, and due to the tremendous evolution of the modern technology, many researches tries to make this game plays on the computers [3] [4]. They start to develop many programs that simulate chess game, however, playing this game can take many hours as known and sitting on computers for many hours can leads to serious problem such as headache, blurred vision and back pain etc. a large number of papers proved that the neural networks and intelligent systems have great dependency in many areas [5] [6] [7]. Many attempts in papers to build intelligent chess games have been done with disadvantages of very high costs used for designing the systems and complex electrical circuit.

However, there are a great number of researches in this area; [8] presents chess game in real time by using MATLAB environment without using for any chess engine, the system designed to detecting the chess movements depending on RGB webcam, and that means the complexity in the system designed may obtain incorrect positions during the game, the system have high cost with low accuracy. [9] presents chess board that can play against human depending on robotic arm which is five degree of freedom, the control system designed to control the speed and the position of the robotic arm, the designed system depend on the use of computer and that too expensive with very complex in the design that take long period of time to control the speed and the position. [10] Presents an attempt to design chess play against human and calculate its moves, the system implemented on microcontroller and the computer used to control chess movement, the system gave not perfect results and the use of computer also have disadvantages as mentioned. [11] Presents a robotic system play chines chess with human that can recognize pieces on the designed chessboard, the system designed to move the pieces of chess with the help of mechanical arm of robot, the system designed with expensive components. [12] Presents the chess game designed using MATLAB and electronics circuit for educational reasons, the system implemented on Arduino and the detection process for any piece to his place and type done by using Infrared light-emitting diode and photodiode, extra multiplexers, encoders and shift registers to increase the no. of I/P or O/P pins, this system have complex designed electronics circuit and high cost. [13] [14] present the FPGA in different systems and producing great efficiency in different area of researches and high speed in response. This paper merges two methods; the first one, is the ordinary method which used in the playing of the chess game. And the second method is the newest that used the technology methods to facilitate the playing of the game without using any computer device to decrease the damage that can be caused from playing the game as much as possible. The main contribution of this paper is to design an intelligent chessboard that can present the next positions for each piece and the avoidance of using computer due to different disadvantages that can occurred as a results of using it such as headache and blurred vision etc. The chessboard is designed by using a simple and low cost of electronics components that can compensate the using of computers which are used in many other chess game application.

2. Proposed System

Intelligent chessboard that can predict the next positions for all pieces of chess game is designed in this paper. Figure (1) shows the block diagram of the proposed system.

Figure 1: Block diagram of intelligent chessboard system

It consists of 64 push buttons which are equally distributed, one button for each square on the chessboard; a simple press on any push button of the intelligent chessboard would send a notification to the proposed system with the exact position and the needing to predict the next positions. There are also 64 LASER diodes which are equally distributed as the push buttons, one LED for each square of the chessboard. In the chess game, there are 32 pieces which are divided equally into 16 pieces, (king, queen, rooks, Bishop, knights and pawns), for each player. Therefore, 32 LDR sensors were used and equally distributed as one sensor for each piece.  Furthermore, the pressing of any piece would make the LEDs of chessboard glowed in order to notify the user with the next positions were the pressed piece can move on. The LDR sensors were used to distinct among the 32 pieces; they are connected serially with a constant resistance for each piece as that shown in Figure (2)

Figure 2: Constant resistance connected with LDR sensor

The light falling on the LDR sensor will produces a fixed range of voltage for each piece; because for each piece there is a different constant resistance; table (1) shows chess’s piece types with corresponding voltages in the proposed system.

Table 1: Chess’s piece types with corresponding voltages

Piece type Range of voltage
Rook pieces (from 0 to 0.5) volt
Knight pieces (From 0.6 to 1)volt
Bishop pieces (From 1.1 to 1.5) volt
King pieces (From 1.6 to 2) volt
Queen pieces (from 2.1to 2.5) volt
White pawn pieces From (2.6 to 3) volt
black pawn pieces (from 3.1to  3.5) volt

In the chess game, there are 8 pawns for each player which can move in different paths and opposite direction; therefore, the range of voltages differ and divided into two team white pawns and black pawns as shown in table (1).

3. Simulation Results of Training

The human brain handles the processes in an amazing and smart way that distinct it from any other machines. Therefore, the neural networks of the proposed system trained in such a way that is similar to the human brain in order to notify the players with the next positions of the movement for every piece in a smart way. Super vised Feed forward neural networks were used to train all the pieces of chess game depending on back propagation algorithm [15]; and each piece types in chess was trained individually. The determination of the No. of neurons in the input layers, No .of neurons in the hidden layers, the No. of layers and also the activation functions in each network all done using Try and error method.

3.1.  Rook

Finally, the rook piece in the chess game moves in different paths as compared with the other pieces, it has specific paths of movements on chessboard which can moves horizontally or vertically. Four no. of rook pieces in chess game which are divided equally into two teams, all rooks piece have the same paths of movements on the chessboard; therefore, the training of the rook was done individually for the first piece and repeated to the other pieces. In order to train the neural networks with the path of movements of the rook piece to act such as human brain, every square of the chessboard has sequential number begins with 1 and ends with 64. Any square which carry the rook piece will predict a different probability of the movements for the next positions of rook. Therefore, the networks of the chessboard trained with all possibility of movements for the rook piece on the chessboard. They are trained with six neurons in the hidden layer and fifteen neurons in the output layer as shown in Figure (3)

Figure 3: Final neural network used for rook pieces

Figure 4: The simulation results of training the rook pieces

Figure (4) shows the simulation results of training the rook pieces; if the square with the number one carry the rook piece, all the several paths for the next position of the rook piece are shown in figure (5).

Figure 5: The way of movements of rook piece on the chessboard.

In the proposed chessboard a simple press over the rook piece, will lead to press the push button at the square with number one at the chessboard which will activate the laser diode to fall its light on the LDR sensor and depending on the voltage which produced from the LDR sensor and according to the range of voltage specified previously in table (1), the rook piece will be recognized. In more details, the reorganization process will lead to change the state of the LEDs to ON state over the designed chessboard and the exact squares (2, 3, 4, 5, 6, 7, 8, 9, 17, 25, 33, 41, 49, and 57) will be glowed to notify the player with the next available positions that the rook can move on.

The trained networks of rook piece converted into Simulink in order to test it and connect it with other networks in the next steps. The simulation results of rook piece movement for next positions shown in figure (6)

Figure 6: Simulation results of rook pieces for next positions movements

The trained networks of the rook pieces converted into VHDL code by using MATLAB that have HDL coder in order to implement  it on FPGA, figure (7) shows the RTL of rook pieces used in proposed system and figure (8) shows the simulation results of intelligent networks of rook by using Xilinx ISE Design Suite 13.3.

Figure 7: The RTL of rook pieces used in proposed system

Figure 8: The simulation results of intelligent networks of rook

3.2.  Bishop

The Bishop piece in the chess game moves in different paths as compared with the other pieces, it has specific paths of movements on chessboard which can moves diagonally. The chess game has four pieces of bishop which are divided equally into two teams, all bishops piece have the same paths of movements on the chessboard; therefore, the training of the bishop was done individually for the first piece and repeated to the other pieces. In order to train the neural networks with the path of movements of the bishop piece to act such as human brain, every square of the chessboard has sequential number begins with 1 and ends with 64. Any square which carry the bishop piece will predict a different probability of the movements for the next positions of bishop. Therefore, the networks of the chessboard trained with the all possible movements of the bishop piece on the chessboard. They are trained with eight neurons in the hidden layer and twenty neurons in the output layer as shown in Figure (9).

Figure 9: Final neural network used for bishop pieces

Figure 10: The simulation results of training bishop pieces

Figure (10) shows the simulation results of training bishops; if the square with the number twenty two carry the bishop piece, all the several paths for the next position of the bishop piece are shown in figure (11).

Figure 11: The way of movements of bishop pieces on the chessboard.

In the proposed chessboard a simple press over the bishop piece at square twenty two, will lead the same processes mentioned in the rook piece and the bishop piece will be recognized. In more details, the reorganization process will lead to change the state of the LEDs to ON state over the designed chessboard and the exact squares (4, 8, 13, 15, 22, 29, 31, 36, 40, 43, 50, and 57) will be glowed to notify the player with the next available positions that the bishop can move on.

The trained networks of bishop piece converted into Simulink in order to test it and connect it with other networks in the next steps. Figure (12) show the simulation results of bishop piece movement for next positions.

Figure 12: Simulation results of bishop pieces for next positions movements

Figure 13: The RTL of bishop pieces used in proposed system

Figure 14: The simulation results of intelligent networks of bishop

The trained networks of the bishop pieces converted into VHDL code by using MATLAB that have HDL coder in order to implement it on FPGA, figure (13) shows the RTL of bishop pieces used in proposed system and figure (14) shows the simulation results of intelligent networks of bishop by using Xilinx ISE Design Suite 13.3.

3.3.  Knights

The knight piece in the chess game moves in different paths as compared with the other pieces, it has specific paths of movements on chessboard which can moves in the shape of L for two square and can jumps on other pieces on the chessboard. The chess game has four pieces of knights which are divided equally into two teams, all knights piece have the same paths of movements on the chessboard; therefore, the training of the knight was done individually for the first piece and repeated to the other pieces. In order to train the neural networks with the path of movements of the knight piece to act such as human brain, every square of the chessboard has sequential number begins with 1 and ends with 64. Any square which carry the knight piece will predict a different probability of the movements for the next positions of knight. Therefore, the networks of the chessboard trained with the all possible movements of the knight piece on the chessboard. They are trained with twelve neurons in the hidden layer and eleven neurons in the output layer as shown in Fig (15).

Figure 15: Final neural network used for knight pieces

Figure 16: The simulation results of training the knight pieces

Figure (16) shows the simulation results of the knight movements; if the square with the number thirty seven carry the knight piece, all the several paths for the next position of the knight piece are shown in figure (17).

In the proposed chessboard a simple press over the knight piece at square thirty seven, will lead the same processes mentioned in the rook piece and the knight piece will be recognized. In more details, the reorganization process will lead to change the state of the LEDs to ON state over the designed chessboard and the exact squares (20, 22, 27, 31, 37, 43, 47, 52, and 54) will be glowed to notify the player with the next available positions that the knight can move on.

Figure 17: The way of movements knight pieces on the chessboard.

The trained networks of knight piece converted into Simulink in order to test it and connect it with other networks in the next steps. The simulation results of knight piece movement for next positions shown in figure (18)

Figure 18: Simulation results of knight pieces for next positions movements

The trained networks of the knight pieces converted into VHDL code by using MATLAB that have HDL coder in order to implement  it on FPGA, figure (19) shows the RTL of knight pieces used in proposed system and figure (20) shows the simulation results of intelligent networks of knight by using Xilinx ISE Design Suite 13.3.

Figure 19: The RTL of knight pieces used in proposed system

Figure 20: The simulation results of intelligent networks of knight

3.4.  Queens

The queen piece in the chess game moves in different paths as compared with the other pieces, it is the strongest piece and has specific paths of movements on the chessboard, it can moves at paths that collect the both paths of the rook and bishop pieces at the chessboard. The chess game has two pieces of queen which are divided equally into two teams, all queen pieces have the same paths of movements on the chessboard; therefore, the training of the queen was done individually for the first piece and repeated to the other piece. In order to train the neural networks with the path of movements of the queen piece to act such as human brain, every square of the chessboard has sequential number begins with 1 and ends with 64. Any square which carry the queen piece will predict a different probability of the movements for the next positions of queen. Therefore, the networks of the chessboard trained with the all possible movements of the queen piece on the chessboard. They are trained with four neurons in the hidden layer and twenty neurons in the output layer as shown in Figure (21).

Figure 21: Final neural network used for queen pieces

Figure 22: The simulation results of training queen pieces

Figure (22) shows the simulation results of training the queen pieces; if the square with the number thirty three carry the queen piece, all the several paths for the next position of the queen piece are shown in figure (23).

Figure 23: The way of movements queen pieces on the chessboard.

In the proposed chessboard a simple press over the queen piece at square thirty one, will lead the same processes mentioned in the rook piece and the queen piece will be recognized. In more details, the reorganization process will lead to change the state of the LEDs to ON state over the designed chessboard and the exact squares (4, 7, 13, 15, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 38, 39, 40, 45, 47, 52, 55, 59, 63) will be glowed to notify the player with the next available positions that the queen can move on.

The trained networks of knight piece converted into Simulink in order to test it and connect it with other networks in the next steps. The simulation results of queen piece movement for next positions shown in figure (24)

Figure 24: Simulation results of queen pieces for next positions movements

Figure 25: The RTL of queen pieces used in proposed system

The trained networks of the queen pieces converted into VHDL code by using MATLAB that have HDL coder in order to implement it on FPGA, figure (25) shows the RTL of queen pieces used in proposed system and figure (26) shows the simulation results of intelligent networks of queen by using Xilinx ISE Design Suite 13.3.

Figure 26: The simulation results of intelligent networks of queen

3.5.  Kings

The king piece in the chess game moves in different paths as compared with the other pieces, it has specific paths of movements on the chessboard, it moves such as the queen piece with only one square. The chess game has two pieces of king which are divided equally into two teams, all king pieces have the same paths of movements on the chessboard; therefore, the training of the king was done individually for the first piece and repeated to the other piece.

In order to train the neural networks with the path of movements of the king piece to act such as human brain, every square of the chessboard has sequential number begins with 1 and ends with 64. Any square which carry the king piece will predict a different probability of the movements for the next positions of king. Therefore, the networks of the chessboard trained with the all possible movements of the king piece on the chessboard. They are trained with nine neurons in the hidden layer and twenty neurons in the output layer as shown in Figure (27).

Figure 27: Final neural network used for king pieces

Figure (28) shows the simulation results of training the king pieces; if the square with the number forty-three carry the king piece, all the several paths for the next position of the king piece are shown in figure (29).

Figure 28: The simulation results of training the king pieces

Figure 29: The way of movements of the king pieces on the chessboard.

In the proposed chessboard a simple press over the king piece at square forty three, will lead the same processes mentioned in the rook piece and the king piece will be recognized. In more details, the reorganization process will lead to change the state of the LEDs to ON state over the designed chessboard and the exact squares (34, 35, 36, 42, 43, 44, 50, 51 and 52) will be glowed to notify the player with the next available positions that the king can move on.

The trained networks of king piece converted into Simulink in order to test it and connect it with other networks in the next steps. The simulation results of king piece movement for next positions shown in figure (30)

Figure 30: Simulation results of king pieces for next positions movements

The trained networks of the king pieces converted into VHDL code by using MATLAB that have HDL coder in order to implement it on FPGA, figure (31) show the RTL of king pieces used in proposed system and figure (32) shows the simulation results of intelligent networks of king by using Xilinx ISE Design Suite 13.3.

Figure 31: The RTL of king pieces used in proposed system

Figure 32: The simulation results of intelligent networks of king

3.6.  Pawns

     The movement of pawn piece was the simplest and the easiest to know as compared with the other pieces as well as to reduce the cost of the internal design, whereas knowing the movement of the pawn piece was just single step either to the straight ahead or diagonally one step in the case of attack. Therefore, it was not mentioned with the other scenarios.

4. Conclusion

In this paper an intelligent chessboard designed to handle the processes such as human brain through predict the next positions of any piece at the chessboard. Different algorithms used in the training of the chessboard and the best one were used in the proposed system. Each piece of chess game trained individually by using MATLAB and the results tested with different states, all networks of pieces trained was combined together in one system that produce the intelligent chessboard. It converted into VHDL code by using HDL coder in MATLAB, the VHDL code of the proposed system tested with different states by using ISE Design Suite 13.3.

  1.  Alaa Hamza Omran, Yaser M. Abid, Dr. Huda Kadhim, “Design of Artificial Neural Networks System for Intelligent Chessboard”, 4th IEEE international conference on engineering technology and applied scince (ICETAS), Manama, Bahrain, NOV. 2017
  2.  Manish A. Chhangani, “ Arduino based Wireless Powered Chess “, International Journal of Innovative Research in Computer and Communication Engineering,, Vol. 3, Issue 4, April 2015.
  3.  Wang LinLin, Wu YuNu, Wang YaJie, Cao Guoqiang, “Research on the Surakarta chess game program based on Unity 3D”, IEEE, 2017.
  4.  NasrulHumaimi Mahmood1, Che Ku MohdSalahuddinChe Ku Long, IsmawatiAbdGhani, RubitaSudirman, “Low Cost Electronic Chess Set for Chess Tournament”, IEEE 7th International Colloquium on Signal Processing and its Applications, 2011.
  5.  Diwas Sharma, Udit Kr. Chakraborty, “An Improved Chess Machine based on Artificial Neural Networks”, International Journal of Computer Applications® (IJCA) (0975 – 8887) National Conference cum Workshop on Bioinformatics and Computational Biology, NCWBCB- 2014.
  6.  Panos J. Antsaklis, “Neural Networks in Control Systems”, IEEE Control Systems M agazine , Vol.10, No.3, pp.3-5, April 1990; Special Issue on ‘Neural Networks in Control Systems’ of the I EEE Control Systems Magazine , Vol.10, No.3, pp.3-87, April 1990.
  7.  Kuo-Lan Su, Bo-Yi Li, Jr-Hung Guo, Kuo-Hsien Hsia, “Implememtation of The Chess Game Artificial Intelligent Using Mobile Robots”,SCIS&ISIS 2014, Kitakyushu, Japan, December 3-6, 2014.
  8.  Can Koray , Emre Sumer, “A Computer Vision System for Chess Game Tracking”, 21st Computer Vision Winter Workshop Luka Cehovin, RokMandeljc, Vitomir ˇ Struc (eds.) ˇ RimskeToplice, Slovenia, February 3– 5, 2016
  9.  Firas Abdullah Thweny Al-Saedi , Ali H. Mohammed, “Design and Implementation of Chess-Playing Robotic System”, IJCSET(www.ijcset.net) | May 2015 | Vol 5, Issue 5,90-98.
  10.  Gurjit Kaur, Anil K. Yadav, VarunAnand, “Design and Implementation of Artificially Intelligent Microcontroller based Chess Opponent”, Proceedings of the World Congress on Engineering 2010 Vol I WCE 2010, June 30 – July 2, 2010, London, U.K.
  11.  Guofeng Tong, Ying Qu, Tong Cheng, “Human-computer interactive gaming system – a Chinese chess robot” Intelligent Robots and Systems, 2009, IEEE/RSJ International Conference.
  12.  SitiZarinaMohdMuji, MohdHelmy Abdul Wahab, RadziAmbar, “Design and Implementation of Electronic Chess Set”, International Conference on Advances in Electrical, Electronic and System Engineering, 14-16 Nov 2016, Putrajaya, Malaysia, 2016.
  13.  Zhang Baofeng, Wang Ya, Zhu Junchao “Design of High Speed Data Acquisition System Based on FPGA and DSP” IEEE 2010.
  14.  Jing pang “intelligent traffic light controller design using PFGA digest of technical papers”, international Conference on consumer electronics (ICCE), IEEE, 2016.
  15.  J. Zurada, “Introduction to Artificial Neural Network System”, West Publishing Company, ISBN: ISBN 0-3 14-93391 -3, 1992.

Citations by Dimensions

Citations by PlumX

Google Scholar

Scopus