This was a personal project of mine where I tried to create my own chess game. After the game was done I wanted to build a simple chess engine to play with.
The game engine I used was raylib with the c++ wrapper.
The engine goes into depth with a NegaMax algorithm in combination with alpha/beta pruning to make it more efficient.
Both the engine and the evaluation bar are using multi-threading for higher efficiency and asynchronous calculation.
Moving all the pieces to the according rules works, except en passent.
In order for this to work you need to install the raylib on your system. I did this with brew.
Go into the terminal of your choice and copy these lines:
brew install raylib
git clone https://github.com/khirsig/chess42 && cd chess42
make && ./chess42
You can change the Screen width, height and the board color inside of the config.hpp.
All default raylib color defines work.
The AI responds with the move it calculates best. It does so with a combination of piece values and square value for each piece type it currently stands on. It goes into depth * moves. However, after depth 6 it takes quite a while longer until too long for enjoyable gameplay.
If a player gets checked, the field below the king turns red to indicate that something needs to be done. The possible moveable squares for the pieces adjust to the check situation, and verify that the new possible position would clear the check.
The evalbar on the right side re-calculates the board after each move and might notice a blunder before you do!