A Python Connect Four solver using a compact bitboard representation, negamax search, alpha-beta pruning, move ordering, and a transposition table.
- 7x6 Connect Four bitboard board representation
- Exact and weak solving modes
- Alpha-beta negamax search
- Transposition-table bounds and best-move storage
- Center-first move ordering with tactical scoring
- CLI tools for solving entered positions and running benchmark positions
board.py- board state, bitboard masks, move generation, and win detectionsolver.py- negamax solvertranspositionTable.py- simple in-memory transposition tablemain.py- interactive position solvertest.py- benchmark/test runner for files undertests/
Run the interactive solver:
python main.pyEnter a move sequence using 1-based columns, for example:
4455
Run a benchmark file:
python test.pyThen enter one of the test filenames from tests/, such as Test_L1_R1.
MIT License. See LICENSE.