Skip to content

Four in a Row

Drop discs into the grid and line up four in a row against a thinking computer opponent.

connect4.exe

You are Red. Computer is Yellow.

Your turn — tap a column.

How to use Four in a Row

  1. 01Tap or click a column to drop your disc into the lowest free slot.
  2. 02The computer replies after a short pause, looking several moves ahead.
  3. 03Line up four of your discs horizontally, vertically or diagonally to win.

About Four in a Row

Four in a Row is a solved game: with perfect play the first player wins by starting in the center column. That single fact shapes every good strategy — the center column touches more winning lines than any other, so taking and holding it is worth more than any early threat on the edges.

The computer here searches the game tree several moves deep with alpha-beta pruning, so it will block obvious threats and punish careless drops. Watch for double threats: creating two winning squares at once is the standard way to force a win, because your opponent can only block one of them.

Frequently asked questions

Can I beat the computer?
Yes, but it plans ahead and blocks single threats reliably. You will usually need to set up two threats at once.
Who goes first?
You do, which is the theoretically winning side if you play the center column well.
Is there a two-player mode?
Right now the game is you against the computer; pass-and-play is on the list.

Related games and tools