Story
After some my Arduino project remains unclaimed touchscreen, so I decided to realize my chidhood dream to create a chess program. After a couple of months it wins me, but it is not big deal because i do not have any chess rating, just amateur.
This project uses Arduino Mega 2560 because of lack of operative memory on Uno, 2.8 inch touchscreen, passive buzzer, and about 2000 lines of code.
Program uses Negamax algorithm, iterative deepening, some kind of killer heuristic, time control. No any bitboards or hashes for obvious reasons. Evaluate function is rather complicated, but not too much, anyway in except of material it calculates figures activity, king safity, pawn structure. Solve speed about 100-200 nodes per second.
Play is according to chess rules, including en passant, castling, pawn promotion. Draw is determined too. Algorithm also may give up if did no see any vay to escape checkmate.
Board is rotatable, step by drag and drop, can take step back. It is possible to arrange the initial position, or load from Serial port in FEN format. Chess game can be saved in EEPROM and downloaded later, or replayed in fast mode.
There is a checkmate search regime to solve chess problem.
Level of algorithm is given by choosing mean thinking time 10sec – 30sec -1min – 3min 10min – 30min – no limit. On 10 seconds regime play is adequate for me, but may be some probles in endspiel or with horizon effect. On 1min i don’t even try to win – may be it is just lack of assiduity.
If anybody like to repeat this project, and screen not be the same model, i see only difficulty to calibrate touchscreen, need to tune coordinate transformation coefficients. Later i will remake sketch on more common and big 3.5 inch touchscreen.
Sorry for poor decor – it is my first public project.
Thank you for attention.
Upd: 6 feb 2018:
As i promised, updated sketch to 3.5 inch MCUFRIEND touchscreen 320×480 pixels. Added new variant.
Read more: Arduino Mega Chess on TFT display