PlayNook

Board Game · Connection Game

Four in a Row

Drop a disc into a column and it falls to the lowest free space. Make four of your own in a line — across, up or diagonally — before your opponent does.

Four in a row is the game where you cannot choose where your disc goes — only which column to drop it into. Gravity does the rest. That single restriction is what turns a simple line-making game into one with a genuine theory behind it, and it is why this game was worth solving with a computer at all.

How to play

Seven columns, six rows, forty-two spaces. Take turns dropping a disc into a column; it falls to the lowest free space. Get four of your own in a line — across, up, or diagonally — and you win. Fill the board without one and it is a draw.

That is the whole rulebook. Everything below is about where to drop.

Start in the middle

Not because it feels right — because of how many lines pass through it. Count every possible line of four on the board and see how many cross each column, and the middle column belongs to far more of them than the edges do.

The consequence is sharper than most players expect. The game has been solved: James D. Allen announced a solution in October 1988 and Victor Allis announced an independent one fifteen days later. On the standard board, with perfect play from both sides:

Opening columnResult with perfect play
1 (edge)Second player wins
2Second player wins
3Draw
4 (centre)First player wins
5Draw
6Second player wins
7 (edge)Second player wins

Most people assume that anything other than the centre is a draw. It is not: four of the seven openings actually lose. The first move is not a preference, it is the game.

Odd and even: the part nobody explains

Here is the idea that separates a good player from a strong one, and it is almost never explained properly.

If a column simply fills up, who gets which square is already decided. Counting the bottom row as row 1, the first player ends up on the odd rows and the second player on the even ones. So a threat — three of your discs with a gap that completes the line — is worth very different amounts depending on which row that gap is in.

  • If you moved first, you want your threats on odd rows. Sooner or later the squares below will fill, and the square will be handed to you.
  • If you moved second, you want them on even rows, for exactly the same reason.

A threat on the wrong row is not a threat at all; it is a square you are about to give your opponent. This is why strong players will sometimes decline an obvious-looking three-in-a-row and play somewhere quiet instead.

The Hard setting on this page understands this. Medium does not — it counts threats and centre control but is blind to which row they sit on. That is the real difference between the two settings, not just how far ahead they look.

Four ways to play

Standard is seven by six and four in a row: the board everyone knows.

Pop Out is the same board plus one rule, and it is the reason this page exists. Instead of dropping a disc, you may pull one of your own out of the bottom of a column; everything above it drops by one. Positions can be reopened, a wall you built can be taken apart, and a careless pop can complete your opponent's line instead of yours — if a pop makes four for both players at once, the opponent wins. It is an official variant and it is remarkably hard to find playable anywhere online, which seemed like a reason to build it.

Five in a Row widens the board to nine columns and asks for five in a line. The extra width is what makes the fifth disc reachable at all; on a seven-wide board, five in a row would be nearly impossible.

Small is five by four — a couple of minutes a game, and a good board to learn threats on because you can see the whole thing at once.

Pop Out has a consequence nobody writes about, and it is the reason it is worth your time: a pop moves every disc above it down a row, which flips the odd/even parity of every threat in that column at once. What that does to the game is measurable — the first player, who is behind over a full set of openings under the standard rules, comes out twice as far ahead under Pop Out.

The board size decides the game

Change the board and you change the answer. That is not a guess: we wrote a solver and checked it against the published table of solved sizes, then ran it ourselves on the sizes that were within reach.

BoardResult with perfect playVerified by
4×4Drawour solver
5×4Drawour solver
6×4Second player winsour solver
7×4Drawour solver
4×5Drawour solver
5×5Drawour solver
6×5Drawour solver
7×6 (standard)First player winsAllen and Allis, 1988

Six columns by four rows is the odd one out: a second-player win, sitting between two draws. Widen it by one column and it becomes a draw again. There is no tidy rule here — each size has to be worked out on its own, which is exactly why people bothered to compute them.

The full table of solved sizes has more of them, along with two patterns worth knowing: a board four or five columns wide is a draw at every height that has been solved, and on an eight-wide board the winner alternates with each row you add.

The last row is not ours. The standard board needs on the order of a hundred billion positions and our solver runs in JavaScript at roughly seventy thousand a second; that is a job for days, not for a web page. So we say plainly whose result it is.

We can measure the centre, too

The solved result above is not ours — but the shape of it shows up in our own opponent, and that we can measure. A search plays the same move in the same position every time, so playing it against itself would just be one game repeated. Instead every combination of first and second move was played out: seven openings times seven replies, forty-nine genuinely different games, both sides on the medium setting.

Red opens in columnRed winsYellow winsDraws
1 (edge)241
2223
3232
4 (centre)502
5223
6052
7 (edge)250

Column four is the only opening that never lost. Every other column is level at best, and across all forty-nine games the player who moved first actually came out behind, 15 wins to 21.

That is the honest version of "the first player wins": the advantage exists, and it lives entirely in one column. Give it away and you are the one defending.

Playing the computer

The opponent searches with alpha-beta pruning and stops when its time is up, so it plays at a steady pace rather than freezing on a hard position. The three settings differ in what they can see, not only in how deep they look:

  • Easy looks one move ahead. It takes a win when there is one and blocks a threat when there is one, and otherwise favours the middle. An opponent that ignores an open three does not feel easy, it feels broken.
  • Medium searches properly and counts threats and centre control.
  • Hard does the same, deeper, and adds the odd/even parity above.

Measured over 40 games per pairing with the sides swapped each time, scoring a draw as half a point:

PairingScore of the stronger sideDrawn
Easy against random moves97.5%0%
Medium against Easy97.5%0%
Hard against Medium73.8%33%
Hard against Easy93.8%8%

The gap between Hard and Medium is the parity rule and nothing else, and a third of those games were still drawn — which is a fair description of a game where the defender has a lot of resources.

Playing a friend online

Choose With a friend online under the board and press Open a table. You get a four-character code — send it to whoever you want to play, they type it in and press Join. There is a chat window in the corner. No accounts, no downloads.

Both of you see the same board, because in this game there is nothing to hide: every disc is on the table from the moment it lands.

Frequently asked questions

+ How do you play four in a row?

Players take turns dropping a disc into one of the seven columns. It falls to the lowest free space in that column, so you choose the column but gravity chooses the row. The first player to get four of their own discs in a line — horizontally, vertically or diagonally — wins. If all forty-two spaces fill up with nobody making four, it is a draw.

+ Is four in a row a solved game?

Yes. It was solved independently in 1988 by James D. Allen and, fifteen days later, by Victor Allis. On the standard seven-by-six board the first player wins with perfect play — but only by opening in the centre column. Opening one or two columns off centre is a draw, and opening in either of the outer two columns is a loss. That last part surprises most people, who assume anything except the centre simply draws.

+ Which column should you start in?

The centre, and it is not close. More lines of four run through the middle column than through any other, so a disc there takes part in more possible wins. With perfect play the centre opening wins, the two columns either side of it draw, and the four outer columns lose. If you learn one thing about this game, learn that.

+ What are odd and even threats?

The strategy that separates good players from strong ones. If a column simply fills up, it is already decided who ends up on which square: counting the bottom row as row one, the first player collects the odd-numbered rows and the second player the even ones. So a threat sitting on an odd row is one the first player will eventually be handed, and the second player needs their threats on even rows. Keeping a threat alive on a row that will be yours is often worth more than making a new one.

+ What is Pop Out?

An official variant, and the most interesting one. Instead of dropping a disc you may pull one of your own out of the bottom of a column; everything above it drops down by one. That means the board can go backwards, a blocked position can be reopened, and a careless pop can hand your opponent a line of four — if a pop makes four for both players at once, the opponent wins. It is very hard to find anywhere online, so it is here.

+ Can I play four in a row with a friend online?

Yes. Choose 'With a friend online' below the board and press Open a table. You get a four-character code; send it to your friend, they type it in and press Join. There is a chat window built in, and neither of you needs an account or a download.

+ What board sizes can be played?

Four: the standard seven by six, Pop Out on the same board, five in a row on a nine-wide board, and a small five by four. The board size changes who wins with perfect play, which is why the small board is worth a look — on five by four the game is a draw no matter what either player does, and we verified that with our own solver rather than looking it up.

+ Is this Connect 4?

It is the same game. Connect 4 is a trademark of its owner and this is not that product — it is the generic four-in-a-row game, which is older than the boxed version and has always been played on paper and on home-made wooden boards as well. What you get here that the box does not have is Pop Out, five in a row, a small board and an opponent you can actually measure.

+ Is it free?

Yes, and there is no sign-up. It runs in the browser on a phone, a tablet or a computer.

More games like this