Chess for ESPboy

Hello,

I’ve created pretty simple chess for ESPboy, using SAF and my chess library/engine smallchesslib found here. Graphically it’s nothing impressive, just very simple interface. Of course everything is CC0, public domain.

source code (for building see the SAF instructions)

Some features and limitation of this program:

  • Graphics is extremely simple.
  • All rules of chess are implemented, even the lesser known such as en passant etc. 50 move rule also applies. Draw via repetition is also implemented, but for simplicity only consecutive positions are considered.
  • Board is automatically rotated if the game thinks it should be rotated.
  • Each player can be either human or AI of strength 1 to 3. This can be changed any time during play.
  • Sometimes the stronger AI needs more time to compute the move and there is no indication of it working so it seems frozen, just wait :slight_smile:
  • On ESPBoy if two AIs play against each other, you have to press A after each move. This is basically for technical reasons and due to simplicity of SAF (basically if I let AIs just move as they wish there’s no “multithreading” and when AI is computing for a long time it delays a frame for very long and it messes up rendering so that you wouldn’t see the game unwind until it would end).
  • After the game ends the whole game is being repeatedly replayed in the background so that you can write it down.
  • There are also simple chess variant: chess 960 (Fisher random, but without castling), horde and knights vs knights.
3 Likes

You rock Drummyfish many thanks for this new amazing creation.

this looks really good! the pieces look easy to recognize, which is useful for these kind of indie chess games.

Amazing game!
Thank you @drummyfish!
I compiled and ran it, but during the long calculation of the move a WatchDog reset of the console occurs.
The ESP8266 has a need to occasionally give up some of the MCU resources to ESP SDK to serve the WiFi stack. If this does not happen (about 1 per sec), a reset occurs.
I haven’t figured out the finding the correct move cycle yet, but usually adding delay(0); to the loop solves this problem.

Hey, yeah I know about this, ran into this problem, I thought I fiexed it :open_mouth: At least it worked for me when I did: here I call the watchdog reset and here I enable it on ESPboy.

1 Like

yes! it works )
have to add #define SAF_PLATFORM_ESPBOY 1 to chess.h

but does LoadSave(); works for ESPboy?
it can handle EEPROM.read and EEPROM.write but should be used EEPROM.commit(); after the all “writes”

This program doesn’t use save/loads, but indeed SAF supports it, it uses EEPROM.commit (here) :slight_smile:

2 Likes

Amazing! Everything is thought out to the last detail. Wonderful game, as is the engine! Bravo @drummyfish!

1 Like