A C++ chess game playable on Linux either:
- Solo vs the computer (AI mode)
- Against another human over network (server/client)
- With a graphical interface (SDL2) or terminal-based
- Playable against AI or another player
- Supports terminal and GUI with SDL2
- Network play: Run as server and client to play across devices
- Regulation chess moves, including:
- Castling
- En passant
- Pawn promotion
- Move validation
- Board state history and move undo/recall
- Save and load games
- Unicode and bitmap chess pieces
- Simple user input interface in CLI or window
- Linux 64-bit (developed & tested)
- CMake (>=3.10 recommended)
- SDL2 development libraries (
libsdl2-dev,libsdl2-ttf-dev) - Standard C++ (tested with g++)
Clone the repository and build:
git clone https://github.com/matthewJamesAbbott/Chess.git
cd Chess
mkdir build
cd build
cmake ..
makeBinaries should appear in build/.
Run the main program for GUI, or use command-line options for other modes.
Default GUI mode:
./ChessPlay vs AI (terminal):
./Chess -aiStart as server:
./Chess -sConnect as client:
./Chess -c [IP_ADDRESS]For CLI-only (no SDL dependency), you may use mainCli.cpp to build a reduced terminal binary.
- Follow prompts to enter moves (e.g., number/letter for from/to squares)
- In GUI: click squares to move pieces
- Save/load/undo via menu or terminal options
Engine.cpp/.h- Core AI and decision tree logic for computer move selectionMoveCalculator.cpp/.h- Generates & evaluates possible moves, checks chess rulesGame.cpp/.h- Game state management, player setup, networking modes, move executionPrint.cpp/.h- Display board in terminal or SDL windowmain.cpp,mainCli.cpp- Entry points for graphical and pure CLI variantsBoard.*andMoveRecorder.*- Board representation and move history (see inline documentation)images/- Piece bitmaps, etc.
The AI builds a decision tree of possible moves, rates possible captures, and selects the best-ranked move, with fallback if this puts it in check. It implements legal move logic, check/checkmate detection, and basic positional awareness.
- Only tested on Linux x86_64, CMake builds.
- External assets (images/fonts) must be in expected relative paths.
This code is © Matthew James Abbott.
Published for educational, learning and non-commercial personal use.Redistribution, re-use, or commercial exploitation is prohibited without explicit permission.
If you wish to modify or re-use components, contact me FIRST.
Please do not claim as your own or use for competitive coding submissions.
If you have questions, contact me via GitHub.
Enjoy Abbott Chess!

