#### Rules

Connect four (or *Four in a row*) is a two players strategy game. Each player drops alternatively a chip of his colors. The first player to align four chips wins.

#### Solver

The game was solved in 1988, and first player (red) can always win. This solver compute the outcome of any position assuming both players play perfectly. When you choose to show the solution, you get a score 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 best moves have highest scores.

#### Play against the AI

Both player can play automatically following a perfect strategy. You just need to toggle the manual/auto mode of the player by clicking on his buttton. Note that it is impossible to win if you let the AI play first.

#### Share a position

You can share interesting positions with the different share buttons or just copy the url of the position (containing the "pos" parameter).

#### About the algorithm.

The solver uses alpha beta pruning with a lot of tricks and optimizations. I've started a step-by-step tutorial explaining how to solve Connect Four.

This project is a pure hobby. Do not hesitate to send me comments, suggestions or bug reports at connect4@gamesolver.org.