3tej home
← All Games

What is Connect Four?

A Connect Four computes connect four from the inputs you provide. It applies the standard formula to the values you enter and returns the result instantly, without sending any data to a server. Drop tokens, connect 4 in a row vertically, horizontally, or diagonally.

Connect Four

Drop tokens. First to 4-in-a-row wins.

🎮 How to Play

  1. Click any column to drop your token. Tokens fall to the bottom.
  2. Get 4 in a row - horizontally, vertically, or diagonally - to win.
  3. AI mode or local 2-player.

About this tool

Connect Four is the gravity-fed strategy game patented by Milton Bradley in 1974 (designers: Howard Wexler and Ned Strongin). The board is 7 columns wide by 6 rows tall, giving 42 squares and exactly 4,531,985,219,092 reachable positions. In October 1988 James D. Allen, and a few weeks later Victor Allis (Master's thesis, Vrije Universiteit), independently proved that the game is a first-player win with perfect play when the first move is in the centre column. Any first move outside the centre is at best a draw against perfect play, and the four outer columns lose. This implementation drops a token to the lowest empty cell in the clicked column and checks the four win directions (horizontal, vertical, two diagonals) for a run of four. The vs-AI mode plays a one-ply lookahead: it scans for an immediate winning move, then blocks any immediate opponent win, then falls back to a centre-preference heuristic, which is enough to challenge a beginner but far from Allis's perfect Knowledge-Based solver.

Common Connect Four pitfalls

  • Skipping the centre column on move one. Move 1 in column 4 is the only first move that wins with perfect play; columns 1 and 7 are proven losing first moves. Beginners often "save" the centre for later, which throws the win away.
  • Counting only horizontal and vertical threats. About 71 of the 69 winning lines on a 7x6 board are diagonal or combined; missing a stacked diagonal threat is the most common loss pattern for new players.
  • Falling for a 7-trap (double threat). Two unblocked 3-in-a-rows that share an open cell at the same row force an unstoppable win on the next move. Always check both ends of any 3-in-a-row your opponent builds.
  • Helping the opponent stack. Dropping a piece below an empty square that completes a 4-in-a-row for the opponent on the next move (a "set-up") is the second-most-common beginner error after centre-skipping.
  • Odd / even parity blindness. Red (first player) wins on odd rows (1, 3, 5 from the bottom), Yellow on even rows. Strong players steer threats toward their own parity rows; ignoring parity costs you "Zugzwang"-style endgames.
  • Resigning a "losing" draw. Many human positions look lost but are objectively drawn with computer evaluation; never resign until a 4-in-a-row is one move away.

How to use this Connect Four board

Choose "vs AI" for single-player practice or "2 Player" to share the device with a friend. Click any column to drop a token; gravity does the rest. Red (player 1) always moves first. The board resets via the "New Game" button. The 7x6 layout, win directions, and turn order match the original Milton Bradley rules.

Worked example: the classic 7-trap

  1. Red plays column 4 (centre).
  2. Yellow plays column 4 on top.
  3. Red plays column 3.
  4. Yellow plays column 5.
  5. Red plays column 5 (now red has tokens at c3-r1 and c5-r1, threatening a diagonal through c4-r2).
  6. If Yellow ignores the threat and plays column 1, Red drops in column 4 to make c3-r1 / c4-r2 / c5-r1 / c6-r3 a winning diagonal pattern with a follow-up.

The trap works because Red created two simultaneous threats (one diagonal and one horizontal on row 1) sharing column 4 as a forcing move. Practising this pattern alone catches roughly 40 percent of beginners.

Strategy reference table

OpeningResult vs perfect playSource
Column 4 (centre)First player WINAllis 1988
Columns 3 or 5DRAWAllis 1988
Columns 2 or 6DRAWAllis 1988
Columns 1 or 7First player LOSSAllis 1988

Related games

If you like Connect Four, try Tic-Tac-Toe (3x3 grid, solved draw), Gomoku (15x15, five-in-a-row, also solved win for first player), or Chess Clock for timed two-player games.

Frequently asked questions

Is Connect Four a solved game?

Yes. James D. Allen (October 1988) and Victor Allis (October 1988, Master's thesis at Vrije Universiteit) independently proved that Connect Four on the standard 7x6 board is a first-player win with perfect play, provided the first move is in the centre column. Any other first move loses or draws against perfect play. The game is therefore considered "weakly solved": optimal strategy is known for the starting position.

What is the best opening move in Connect Four?

Column 4 (the centre column) for player 1. The centre is part of more potential winning lines (24) than any other column, and Allis's solver proved it is the only first move that forces a win. Outer columns 1 and 7 lose outright; columns 3 and 5 draw at best.

How many possible Connect Four positions are there?

4,531,985,219,092 legal positions are reachable on a 7x6 board, computed by John Tromp in 2008 via exhaustive enumeration. By comparison, Tic-Tac-Toe has only 5,478. The branching factor at the start is 7 (one per column).

How does the AI mode in this Connect Four pick its moves?

It runs a one-ply lookahead: first it scans for any move that immediately makes four-in-a-row for itself and plays it, then it scans for any opponent immediate win and blocks it, then it falls back to centre-column preference with a random tie-break. This beats casual players but is far weaker than Allis's full Knowledge-Based solver.

Why does Red always move first?

The original 1974 Milton Bradley rules name the first player and assign a colour; this implementation follows that convention with Red as player 1 and Yellow as player 2. Because the first player has a winning strategy, sharing first-move privilege via alternation across games is the standard tournament practice.

CT
3Tej Editorial
Free, browser-based tools -.