Skip to content

My own chess game with a simple engine to play against.

Notifications You must be signed in to change notification settings

khirsig/chess42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chess42

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.

How to Run on MacOS

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.

Preview

chessGif1

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.

chessGif2

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.

chessGif3

The evalbar on the right side re-calculates the board after each move and might notice a blunder before you do!

About

My own chess game with a simple engine to play against.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published