A classic Checkers (Draughts) game written in modern C++20, featuring both local two-player mode and various AI opponents, rendered with SFML.
The following checkers variants are supported:
- International
- Russian
- Canadian
- Brazilian
-
Board Logic
- Board with automatic move generation and capture rules.
- Piece promotion (regular to queen) at the opposite side.
- Chained captures supported (multiple jumps in one turn).
-
AI Engines
- Random Engine: Picks a random valid move.
- Minimax Engine: Employs the Minimax algorithm (with Alpha-Beta pruning) with variable difficulty levels (
EASY,MEDIUM,HARD,GRANDMASTER).
-
GUI
- SFML-based user interface with clickable squares.
- Menu system to select either two-player or computer-vs-human mode, as well as difficulty/AI level.
- Visual highlights for valid moves, chain captures, and game result screens.
-
State Machine
- Easily extendable system to manage game states (Menu, Play, etc.).
This project is split into three main parts:
-
Checkers-logic
Checkersclass: Handles all move logic, captures, piece promotion, and maintains the turn order. Stores BoardBoardclass: Maintains 8×8 (Russian and Brazilian), 10×10 (International) and 12×12 (Canadian) grid using space-efficient std::array.- Exposes functions for retrieving valid moves, making moves, and resetting the board.
- Tracks game result and winner determination.
-
Engine
Engineis an abstract base class providing agetBestMove()method.RandomEngine: Returns a random valid move.MinimaxEngine: Implements a Minimax search. Different difficulty levels limit the search depth. Implemented Alpha-Beta pruning. Added a random component when choosing the optimal move to minimize the probability of getting exactly the same games.- Uses an evaluation function in
EvaluationFunction.cppto score board states.
-
GUI
- SFML-driven interface in the
guidirectory. StateManager: Maintains a stack of states.MenuState: Lets user select mode (two-player or vs. AI), color for player, and AI difficulty.PlayState: Renders the board, pieces, handles user input, and orchestrates moves from the chosenEngine.ResourceManager: Loads and provides textures and fonts.Button: Simple clickable UI element.
- SFML-driven interface in the
-
Strategy Pattern
Engineas the strategy interface;RandomEngineandMinimaxEngineas concrete implementations.
-
State Pattern
StateManagerswitches between different GUI states (MenuState,PlayState).
-
Factory/Builder-Like
- Creation of specific engines (
ENGINE_MODE→RandomEngineorMinimaxEngine) depending on user choice.
- Creation of specific engines (
-
Observer-Like
- While not a strict observer pattern, the GUI “observes” changes in the
Boardstate by callingBoard::getResult()and re-rendering accordingly.
- While not a strict observer pattern, the GUI “observes” changes in the
-
Move Generation
- Generates valid moves using
Board::generateValidMoves(). - Forces capture moves if any are available (as in checkers rules).
- Supports piece promotion and chain captures.
- Generates valid moves using
-
Minimax with Depth (with Alpha-Beta pruning)
- Evaluates board states up to a maximum depth (
EASY = 2,MEDIUM = 4, etc.) - Scores positions using
evaluatePosition()for piece advantage and positional bonuses.
- Evaluates board states up to a maximum depth (
- Clone the Repository
- Build (Developed on Debian 12)
Make sure you have a C++20 compiler and CMake ≥ 3.25.1 installed, plus SFML (version ≥ 2.5).
mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make- Run
./LPC- Launch the game — a window will open with the main menu.
- Select Checkers type (
International,Russian,Canadian,Brazilian). - Select Game Mode — either play against the computer (
With Computer) or another human locally (Two Players). - (Computer mode only) Choose Your Colour — play as White or Black.
- (Computer mode only) Select Difficulty — choose from
Novice,Easy,Medium,Hard, orGrandmaster. - Enjoy playing — click the squares to select a piece and move it. Possible moves are highlighted automatically.
- Press
ESCanytime to return to the main menu.
-
Implement Undo / Redo
- Track and revert moves for convenience.
-
Improve AI
- Implement a transposition table or caching.
- Add multhithreading (
Grandmastermode can be faster).
-
Online Multiplayer
- Introduce network play for remote two-player matches.
-
UI Enhancements
Turn the board around if playing for black against the computer.Done! 🎊- Animate piece captures more smoothly.
- Add sounds and a game timer.
-
Automated Testing
- Add unit tests for critical Board methods and engine functionality.
-
Add Documentation





