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 ssh://hg@bitbucket.org/jeadorf/c4nnect

Change into the c4nnect directory.

$ mkdir build
$ cd build
$ cmake ..
$ make

Run the game with

$ build/c4nnect

Run the tests with

$ cd build
$ make test


Please let me know in case of problems.


Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.