Connect Four
Drop your red discs and get four in a row before the computer does. Choose Easy, Medium or Hard, or pass the device and play a friend.
Your move
Keys: 1–7 drop a disc, ← → + Enter choose a column, U undo, N new game. Scores are kept per difficulty and saved on this device.
How to use the Connect Four
- Pick a mode. Play vs Computer and choose Easy, Medium or Hard, or switch to 2 players.
- Choose who starts. Red (you), Yellow (computer) or alternate between games.
- Drop a disc by clicking or tapping a column. A faint disc above the board shows where you are aiming.
- Connect four of your discs in a row, column or diagonal to win. The winning line lights up.
- Use Undo move to take back a mistake, and press Start new game (or N) for the next round.
Connect Four rules at a glance
Connect Four is played on an upright grid of 7 columns and 6 rows (42 spaces). Players take turns dropping one disc into a column; the disc falls to the lowest empty space. Each player starts with 21 discs. The first player to make a line of four of their own discs, in any of the four directions, wins.
| Direction | Example | How it is often missed |
|---|---|---|
| Horizontal | Four discs side by side in one row | An open three on the bottom row (empty on both ends) cannot be blocked twice |
| Vertical | Four discs stacked in one column | Easiest to spot; rarely decides a game between experienced players |
| Diagonal (rising) | Bottom-left to top-right | Builds slowly as columns fill and is the most common surprise win |
| Diagonal (falling) | Top-left to bottom-right | Same as above, mirrored |
There are 69 possible lines of four on the board: 24 horizontal, 21 vertical and 24 diagonal. A disc in the middle of the center column takes part in 13 of them, while a corner disc takes part in only 3, which is why central control matters so much.
Strategy tips that actually work
- Start in the middle. Connect Four was solved in 1988 by James D. Allen and, independently, Victor Allis: the first player wins with perfect play if they open in the center column. Opening on the edge columns lets a perfect opponent win.
- Make two threats at once. A single three-in-a-row is easy to block. A position where you threaten to complete two different lines forces your opponent to block one while you play the other.
- Watch the square above. Before you drop a disc, check whether it lets your opponent play directly on top of it to complete a line. Many games are lost by "giving away" the space above.
- Think in odd and even rows. Count rows from the bottom (row 1). In the endgame the first player usually benefits from threats on odd rows and the second player from threats on even rows, because of who is forced to play into each space as columns fill up.
- Don't fill a column you need. If you have a threat waiting in a column, avoid playing beneath it yourself; let your opponent run out of safe moves instead.
How the computer opponent thinks
Easy plays mostly random moves with a preference for the middle, takes any immediate win and usually blocks a three-in-a-row. Medium always takes wins and blocks, then looks four moves ahead and picks randomly among moves that score almost as well as the best, so it plays sensibly but makes human-like mistakes. Hard runs an iterative-deepening negamax search with alpha-beta pruning, center-first move ordering and a transposition table. Within a time limit of about 1.5 seconds it typically reaches 10 to 13 moves deep, scoring positions by counting open lines of two and three for each side. It never misses a win in one move or a direct block, and it spots forced wins and losses many moves in advance.
Frequently asked questions
How do you win Connect Four?
Be the first to line up four of your own discs next to each other: horizontally, vertically or diagonally. If all 42 spaces fill up without anyone making four, the game is a draw.
Who goes first in Connect Four, and does it matter?
Red traditionally goes first, and it matters a lot: with perfect play the first player can always force a win by starting in the middle column. That is why this game lets you choose who starts or alternate between games.
How strong is the Hard computer?
Hard looks ahead more than ten moves using a negamax search with alpha-beta pruning, a position cache and a threat-based evaluation. It always takes a winning move and always blocks your immediate threats, so you need to set up two threats at once to beat it.
What is the best opening move?
The center column. It belongs to more possible lines of four than any other column, so discs there give you the most chances to build threats. The columns next to the center are the next best.
Can I play Connect Four with a friend?
Yes. Choose 2 players and take turns on the same screen. Red and Yellow alternate, and the score tally keeps track of both of you.
Can I undo a move?
Yes. Against the computer, Undo move takes back your last move together with the computer's reply. In 2-player mode it takes back one move at a time. Undoing after a finished game also removes that result from the score.