Chess program. Comes with three main modes:
- Chess with two players (default)
- Chess with one player and one computer player, accessed through
-c
argument - Legacy mode on CLI, accessed through
--legacy
argument
The first two modes use SDL for a graphical interface, which is a library I'm familiar with from past projects.
The computer player uses a basic minimax algorithm implementation with a default search depth of 3 plies (half-moves) to evaluate future board positions. The depth can be incremented with p
and decremented with m
.
Users can also choose their desired color against the computer player with -w
, -b
, or -r
(white, black, and random, respectively). Note that these options are not supported in two-player mode.
- Requires cmake, SDL2, and SDL2_Image:
sudo apt-get install cmake libsdl2-dev libsdl2-image-dev
- Clone repo
- In the same directory as the cloned repo, create a build folder:
mkdir chess_build
cd chess_build
cmake ../chess
cmake --build .
./chess
The following list describes all options can be passed as additional arguments when running the executable, e.g. ./chess -l
.
-b
- sets the player color to be black, and the computer player white-c
- starts a game with a computer player (computer player's default color is black)-l
- loads a board state from theload.fen
file underinc
-r
- randomizes the player's and computer player's colors-s
- enables saving the game states to .fen files. The filename format isgame_<Y-M-D-T>.fen
-v
- enables verbose/debugging mode-w
- sets the player color to be white, and the computer player black--legacy
- enables legacy CLI mode with no SDL graphics (only supports two-player mode)
p
- increases computer player search depthm
- decreases computer player search depthr
- starts a new game from the default starting position
- Investigate edge cases - AI move generation #1 suspect
- Add pawn promotion unit test
- Add other Board unit tests
- Add AI unit tests in new test file