Skip to content
Toolcroft

Games & Puzzles

Connect Four - Play vs AI or a Friend

Play the classic Connect Four board game in your browser. Drop discs into the 7×6 grid to connect four in a row - horizontally, vertically, or diagonally. Challenge the AI or play with a friend.

Red: 0Draw: 0Yellow: 0

Click New Game to start.

Rules

Connect Four is a two-player strategy game played on a 7-column, 6-row vertical grid. Players alternate dropping colored discs into any column. Discs fall to the lowest available row in the chosen column due to gravity. The first player to align four of their discs in a row - horizontally, vertically, or diagonally - wins. If all 42 cells fill without a winner, the game is a draw.

Controls

Click the column where you want to drop your disc. The disc falls to the lowest empty row in that column.

Strategy tips

  • Control the center: the middle column (column 4) is the most strategically valuable. A disc there can participate in horizontal, vertical, and diagonal threats simultaneously.
  • Build two threats at once: set up positions where you have two separate winning moves. Your opponent can only block one.
  • Beware of even/odd traps: in Connect Four, the row number (odd or even) of the winning cell determines who gets the first chance to play there. Understanding which player controls the odd and even rows in key columns is the basis of advanced play.
  • Block early: if your opponent has three in a row with an open end, block immediately - there is rarely a threat worth prioritizing over defense at that stage.

AI difficulty

The built-in AI uses minimax search with alpha-beta pruning. At easy difficulty, the search is limited to 3–4 plies. At hard difficulty, the search goes 7–8 plies deep and uses position heuristics (center preference, threat counting) to evaluate non-terminal positions.

Connect Four is a solved game

Connect Four was strongly solved by Victor Allis in 1988. With perfect play:

  • The first player always wins if they play the center column first.
  • The second player can force a draw only if the first player deviates from the optimal strategy.
  • The game has 4,531,985,219,092 possible game positions.

Despite being solved, the game remains interesting at non-expert levels because optimal play requires deep look-ahead that humans cannot reliably perform. The first move advantage is strong enough that serious competitive play uses pie-rule bidding (where the second player can "steal" the first player's opening move to balance the advantage).