Nimble Axe
A Four in a Row board with blue and amber discs.
Board · vs. computer

Four in a Row

Home / Games / Four in a Row

You are blue and go first. Press the arrow above a column to drop a disc; it falls to the lowest free slot. Be the first to line up four of your discs in a row — horizontally, vertically, or diagonally — while blocking the computer from doing the same. Fill the board with no four-in-a-row and it's a draw. Your wins are saved on this device.

All games

How to play Four in a Row

Quick start

  1. Press Start. You are blue and you drop the first disc.
  2. Choose a column with the ▼ buttons above the grid.
  3. Your disc falls to the lowest free slot in that column.
  4. The computer answers straight away with a disc of its own.
  5. Line up four in a row — across, up, or along either diagonal — before it does.

How it works

any four in a line wins

Controls

Mouse / trackpad
Click the ▼ button above the column you want. A full column's button is disabled and cannot be clicked.
Touch
Tap the ▼ button above a column. The buttons are sized for a thumb rather than a cursor.
Keyboard
The drop buttons are real buttons, so Tab reaches each one and Enter or Space drops a disc. Each is labelled "Drop in column 1" through "Drop in column 7".

Tips

Frequently asked questions

How far ahead does the computer look?

Five plies, using minimax with alpha-beta pruning. That is deep enough to see every immediate win and every immediate block.

Will it block me if I get three in a row?

Yes, as long as a single square would complete your four. Three in a row with both ends open is a different matter: no one block can cover both, which is precisely how you beat it.

Does it prefer any particular column?

The centre. Its scoring function adds six points for each of its own discs in the middle column and subtracts six for each of yours, so it fights for that column early.

Does it play the same game every time?

No. Among moves that score within a point of the best one, it chooses at random, so repeating your opening will not always produce the same reply.

What counts as four in a row?

Four of your discs adjacent in a straight line — horizontally, vertically, or on either diagonal. All four directions are checked the same way.

What happens if the grid fills up?

The game is declared a draw. The grid holds 42 discs across seven columns of six.

Can I play with only a keyboard?

Yes. Each of the seven drop controls is a real button with its own label, reachable with Tab and activated with Enter or Space.

Are my wins recorded?

Your win count lives in this browser's local storage on this device. Nothing is uploaded, and clearing your browser data sets it back to zero.

More games

Snake Checkers Blocks

More to play