Clone wiki

c4nnect / Home


A tiny implementation of the game Connect Four (a.k.a. Four in a Row), featuring a command-line interface and a computer player. The primary purpose of the project is to explore search algorithms. The computer player uses the negamax variant of an iterative deepening depth-first search with alpha-beta pruning, move ordering, and transposition tables. The computer player relies only on very simple board evaluations in contrast. Hint: if you want to win against the computer player, do so in the early stages of the game when the computer player is not able to completely compute the remainder of the game.

Pictures / Screenshots

Rendered board positions and screenshot of command-line game


Clone the c4nnect repository.

hg clone

To build

cd c4nnect
mkdir build
cd build
cmake ..

Run the game with


Run the tests with

cd build
make test


Please let me know in case of problems.