cd chesscpp2
mkdir build
cd build
cmake ..
make -j4./chesscpp2Controls:
- Click squares to select and move pieces
- Press
Ato make the AI move - Press
Rto reset the game - Close window to quit
./chesscpp2 -c # AI at default depth 4
./chesscpp2 -c -d 6 --threads 4 # AI at depth 6./chesscpp2 --nogui -c --threads 4Commands:
- Enter moves in UCI format:
e2e4,e7e8q(promotion) aiora- Make AI moveboard- Display current positionfen- Show FEN stringquitorq- Exit
./chesscpp2 -f "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1"./chesscpp2 --perft 5 # Test move generation to depth 5- Depth 3: Easy (0.1s per move)
- Depth 4: Medium (default) ← Recommended
- Depth 5: Hard (10s per move)
- Depth 8: Expert
# Start game with the default AI depth (4)
$ ./chesscpp2 -c
# Or override it explicitly in console mode
$ ./chesscpp2 --nogui -c -d 6SDL2 not found:
sudo apt-get install libsdl2-dev libsdl2-image-dev # Ubuntu/Debian
brew install sdl2 sdl2_image # macOSCompilation errors:
- Make sure you have C++20 compiler (GCC 10+ or Clang 10+)
- Run
cmake --version(need 3.16+)
Slow AI:
- Reduce search depth with
-d 3 - The first move is slower due to initialization
- Use
-d 4for balanced play (recommended) - The engine uses magic bitboards for speed (~37 million nodes/second)
- Perft 5 completes in ~0.13 seconds
- AI searches ~3000-7000 nodes per move at depth 4
Enjoy your chess games!