Rules of the Game

Connect Four (or Four in a Row) is a two-player strategy game. Each player takes turns dropping a chip of his color into a column. The first player to align four chips wins.

History

The Connect 4 game is a solved strategy game: the first player (Red) has a winning strategy allowing him to always win. The game has been independently solved by James Dow Allen and Victor Allis in 1988.

Connect 4 Solver

This Connect 4 solver computes the exact outcome of any position assuming both players play perfectly. A score can be displayed for each playable column: winning moves have a positive score and losing moves have a negative score. The absolute value of the score gives you the number of moves before the end of the game. Hence the best moves have the highest scores. You can play against the Artificial Intelligence by toggling the manual/auto mode of a player.

The Algorithm

The solver uses alpha beta pruning. You can read the following tutorial (with source code) explaining how to solve Connect Four.

The Author: Pascal Pons

Do not hesitate to send me comments, suggestions, or bug reports at connect4@gamesolver.org.

Translation

You can contribute to the translation of this website in other languages by providing a translated version of this localization file. A big thank you to the translators: