Connect Four
NewPlay Connect Four against a minimax-powered computer opponent with alpha-beta pruning — drop discs, connect four in a row, and try to outsmart the AI.
Your turn (Red)
Frequently Asked Questions
How strong is the computer opponent?
It uses minimax search with alpha-beta pruning looking 4 moves ahead, combined with a heuristic that scores potential winning lines — it plays solidly and reliably blocks your immediate threats, though a full unbeatable Connect Four solver would require searching much deeper (the game is mathematically solved as a first-player win with perfect play, but that requires exploring far more positions than is practical to compute instantly in a browser on every move).
Why does the computer usually favor the center column?
The center column (and squares near it) participate in more possible four-in-a-row lines — horizontal, vertical, and both diagonals — than the edge columns, so center control is a well-known strategic advantage in Connect Four, and the move-ordering in the search checks central columns first.
What counts as a win?
Four of your discs in an unbroken line — horizontal, vertical, or diagonal (either direction) — anywhere on the 7-column, 6-row board. The game checks all four directions from every disc placed after each move.
Can the game end in a draw?
Yes — if all 42 cells fill up with no four-in-a-row for either side, the game ends in a draw. This is less common in Connect Four than in tic-tac-toe since the larger board gives more opportunities to form a line, but it can still happen with cautious play from both sides.