Connect Four & Computers — A Solved Game
How computers cracked Connect Four, what 'solved' really means, and why it matters for human play.
What Does “Solved” Mean?
In mathematics and computer science, a solved game is one where the outcome with perfect play by both sides is known from the starting position. There are different levels of “solved”:
| Level | Definition | Connect Four Status |
|---|---|---|
| Ultra-weakly solved | Outcome from the initial position is known | Yes — first player wins |
| Weakly solved | Optimal strategy from the initial position is known | Yes — full strategy computed |
| Strongly solved | Optimal move from every legal position is known | Yes — all 4.5 trillion positions evaluated |
Connect Four is strongly solved: for every one of the approximately 4,531,985,219,092 possible positions, the optimal move is known. This makes it one of the most thoroughly analyzed games in existence.
The Race to Solve Connect Four
The 1980s: Computers Get Powerful Enough
By the mid-1980s, personal computers and academic mainframes had become powerful enough to tackle games of Connect Four’s complexity. The game’s 7×6 grid creates a manageable (though large) search space — much smaller than chess but large enough to be a genuine computational challenge.
Several researchers began working on the problem independently.
Victor Allis (1988)
Victor Allis, a master’s student at Vrije Universiteit Amsterdam, solved Connect Four as part of his thesis work. His approach combined two techniques:
- Knowledge-based rules that narrowed the search space by identifying positions that were provably won, lost, or drawn.
- Brute-force search on the remaining positions, using minimax with alpha-beta pruning.
Allis titled his thesis “A Knowledge-Based Approach of Connect-Four” and demonstrated that the first player wins by starting in the center column.
James D. Allen (1988)
Nearly simultaneously, James D. Allen solved Connect Four independently using a different approach that relied more heavily on computational search. Allen published his results in October 1988, confirming Allis’s finding.
The fact that two independent researchers reached the same conclusion using different methods provided strong confidence in the result.
How Computers Solve Games
The Game Tree
Every turn-based game can be represented as a game tree — a branching diagram of all possible sequences of moves from start to finish.
For Connect Four:
- The root of the tree is the empty board.
- Each branch represents a possible move (dropping in columns 1–7).
- Each node is a unique board position.
- The leaves are terminal positions: wins, losses, or draws.
Connect Four’s game tree contains approximately 4.5 trillion nodes. While enormous, this is small compared to chess (approximately 10^47 nodes) or Go (approximately 10^170 nodes).
Minimax Algorithm
The core algorithm for game-solving is minimax. It works on a simple principle:
- The maximizing player (first player) tries to choose moves that lead to the best possible outcome.
- The minimizing player (second player) tries to choose moves that lead to the worst outcome for the opponent.
- By alternating between maximizing and minimizing at each level of the tree, the algorithm determines the optimal move.
In pseudocode:
function minimax(position, depth, maximizingPlayer):
if position is terminal:
return value of position
if maximizingPlayer:
maxEval = -infinity
for each child of position:
eval = minimax(child, depth - 1, false)
maxEval = max(maxEval, eval)
return maxEval
else:
minEval = +infinity
for each child of position:
eval = minimax(child, depth - 1, true)
minEval = min(minEval, eval)
return minEval
Alpha-Beta Pruning
Searching the full game tree is unnecessary because many branches can be eliminated without affecting the result. Alpha-beta pruning skips branches that cannot possibly influence the final decision.
| Technique | Without Pruning | With Alpha-Beta Pruning |
|---|---|---|
| Nodes evaluated | ~4.5 trillion | ~1–10 billion (varies) |
| Time to solve | Impractical | Hours to days (1988 hardware) |
| Result | Same | Same |
Alpha-beta pruning doesn’t change the answer — it just finds the same answer much faster by ignoring irrelevant possibilities.
Transposition Tables
Many different sequences of moves lead to the same board position. A transposition table stores previously evaluated positions so the algorithm doesn’t recompute them. This further reduces the work needed.
The Result: First Player Wins
The complete analysis confirmed:
Opening Move Analysis
| First Move | Outcome with Perfect Play |
|---|---|
| Column 1 | Draw |
| Column 2 | Draw |
| Column 3 | First player wins |
| Column 4 | First player wins |
| Column 5 | First player wins |
| Column 6 | Draw |
| Column 7 | Draw |
The three center columns (3, 4, and 5) all lead to first-player victories. The center column (4) is the simplest winning path — it gives the first player the most margin for error.
Why Center Wins
The computer analysis confirmed what strategic intuition suggests: center control gives the first player access to the most winning lines and the most flexible position. From the center, the first player can build threats in all directions, while the second player is always one step behind.
The Winning Path
The complete winning strategy from the center opening involves:
- Opening in column 4
- Responding optimally to every possible second-player move
- Navigating through a decision tree of thousands of possible positions
- Eventually forcing the second player into a position where a double threat is unavoidable
No human can execute this strategy perfectly from memory — the tree is far too large. But computers can, and they confirmed that it works for every possible defense.
What Does This Mean for Human Players?
It Doesn’t Mean Human Games Are Predetermined
The solved status of Connect Four has virtually no impact on casual or even competitive human play. Here’s why:
- The solution requires evaluating millions of positions. No human can do this in real time.
- Both players make mistakes. Even expert players miss optimal moves regularly, so both sides have genuine chances.
- Perfect play requires perfection on every single move. One suboptimal choice can turn a winning position into a losing one.
It Does Inform Strategy
While you can’t memorize the entire solution, you can learn the principles that emerge from it:
- Center control is paramount — confirmed by computation.
- First-player advantage is real — the mathematical proof gives it concrete backing.
- Double threats are decisive — the computer’s winning paths almost always involve creating forks.
- The odd-even strategy matters — row parity plays a role in the computer’s evaluation.
It Makes Connect Four a Great Teaching Tool
Because Connect Four is solved, it serves as an excellent test case for:
- Computer science students learning game-tree search algorithms
- AI researchers developing and testing new techniques
- Mathematics students exploring combinatorial game theory
- Anyone interested in understanding what it means for a game to be “solvable”
Modern Connect Four AI
Free Online Solvers
Today, numerous free websites offer real-time Connect Four solving. You can input any board position and receive the optimal move instantly. These tools are useful for:
- Post-game analysis: See where you deviated from optimal play.
- Learning: Understand why certain moves are better than others.
- Training: Play against a perfect opponent to sharpen your skills.
Implementation Complexity
A strong Connect Four AI can be implemented in a few hundred lines of code. The key components are:
| Component | Purpose |
|---|---|
| Board representation | Efficiently store and manipulate the grid |
| Move generation | List all legal moves from any position |
| Evaluation function | Assess non-terminal positions |
| Search algorithm | Minimax with alpha-beta pruning |
| Opening book | Precomputed optimal moves for early positions |
Modern implementations can solve Connect Four positions in milliseconds on ordinary hardware — a task that took hours or days in 1988.
Machine Learning Approaches
Although traditional search algorithms solve Connect Four perfectly, machine learning researchers have used it as a testbed for neural network-based game-playing. Techniques like:
- Deep reinforcement learning (similar to AlphaGo)
- Monte Carlo tree search (MCTS)
- Temporal difference learning
have all been applied to Connect Four. These approaches don’t necessarily play perfectly (the search approach does), but they demonstrate how machines can learn to play games without being explicitly programmed with rules.
Connect Four in the Landscape of Solved Games
| Game | Solved? | Outcome | Year Solved |
|---|---|---|---|
| Tic-Tac-Toe | Yes | Draw | Trivially (known for centuries) |
| Connect Four | Yes | First player wins | 1988 |
| Checkers | Yes | Draw | 2007 |
| Chess | No | Unknown | — |
| Go | No | Unknown | — |
| Gomoku (15×15, free style) | Yes | First player wins | 1994 |
Connect Four occupies an interesting middle ground: complex enough to be a non-trivial computational challenge, but simple enough to be fully solvable. This makes it uniquely valuable for both recreation and education.
The Unsolved Frontier
While standard 7×6 Connect Four is solved, some variants remain open:
- Larger board sizes (8×7, 9×7, etc.) increase the game tree beyond current computational limits.
- Pop Out Connect Four introduces removal mechanics that massively expand the position space.
- Three-dimensional Connect Four (4×4×4 grids) is partially analyzed but not fully solved for all configurations.
- Power Up variants with special discs add asymmetric complexity.
These unsolved variants represent active areas of interest for game-theory researchers and recreational mathematicians.
The Beauty of a Solved Game
There’s something philosophically satisfying about a game that is completely understood yet still endlessly engaging to play. Connect Four proves that knowing the answer and finding the answer in real time are very different things. The gap between theoretical perfection and practical human play is where the game lives — and it’s a gap wide enough to keep Connect Four compelling for generations to come.
Play Against Understanding, Not Memorization
Knowing the game is solved doesn't mean playing it is easy. Challenge yourself against a live opponent.
Play Connect Four Free