Connect 4 is a command-line implementation of the classic Connect Four game, featuring a strong solver based on the negamax algorithm and a transposition table for efficient position evaluation.
- Play Connect Four in the terminal
- Strong AI solver using negamax with alpha-beta pruning
- Efficient board representation with bitboards
- Transposition table for fast repeated position lookup
- Test suite for solver validation
This project uses CMake for building. Make sure you have CMake and a C++17 compiler installed.
cd build
cmake ..
makeRun the game from the build directory:
./connect4You will be prompted to enter moves (columns 1-7). The game alternates between two players.
The solver can be tested using provided test suites in the Testing_Suite/ folder. The main program reads test positions and expected results from these files to validate the solver's accuracy.
main.cpp: Entry point, runs tests and/or game loopBoard.*: Board representation and move logicGame.*: Handles user interaction and game flowSolver.*: Negamax solver and search logicTranspositionTable.*: Caching for board positionsTesting_Suite/: Contains test positions for solver validation