Four in a Row
Drop discs, line up four — two players or against the computer. Free, no ads, works offline.
Blue to play
Four in a Row is a Connect Four–style drop game on a seven-column, six-row grid. Players take turns dropping a disc into a column; it falls to the lowest free slot, so you choose the column and gravity chooses the row. The first player to line up four of their own discs — across, up, or along either diagonal — wins. Fill all forty-two slots with no line and the game is a draw. Play two-up on one device, or against the computer at three strengths.
The game is solved, and the first player wins
Four in a row on a 7×6 board was solved independently by James Allen and Victor Allis in 1988. With perfect play from both sides, the player who moves first wins — but only by opening in the middle column. Open in either column next to it and the game is a draw; open in any of the four outer columns and the second player wins. That is the sharpest piece of strategy in the game and it applies from move one, which is why the computer here opens in the middle and why you should too.
The opponent on this page is not that perfect solver. It looks a fixed number of moves ahead and judges what it finds, so it plays a strong practical game and can be beaten — unlike the tic-tac-toe opponent elsewhere on this site, which searches its much smaller game to the end and cannot be.
How to play well
Take the middle. The centre column takes part in more possible fours than any other, and the outer columns in the fewest, which is exactly why the opening result depends on it.
Then think in threats rather than discs. A threat is a square that would complete four for you; the game is won by making two of them at once, because your opponent can only block one. The commonest way to lose is the mirror image: dropping a disc into a column and handing your opponent the square directly above it. Before you play a column, look at what the slot above your disc would give them — a move that is fine on its own can lose immediately because of what it builds under.
The second commonest is ignoring the diagonals. Rows and columns are easy to see; a diagonal four assembled across four different columns at four different heights is not, and it is where most surprise losses come from.
The three computer levels
Easy takes a win that is already available and otherwise drops at random. It will not block you, so a beginner can beat it. Medium searches four plies — two moves for each player. It wins when it can, blocks when it must, and sees a threat it can build next turn, but it does not look far enough ahead for the double threats a trap is made of. Hard searches seven plies with alpha-beta pruning, examining the middle columns first because they are the ones that matter most, and will punish a loose move several turns before the consequence becomes visible.
All three score a win as better the sooner it arrives, so a computer that has the game won finishes it rather than shuffling, and one that is losing takes the longest road there.
A note on the name
This game is played all over the world under many names — Four in a Row, Four Up, Captain's Mistress. Connect Four is Hasbro's registered trademark for its version, first sold in 1974; this is an independent implementation, named descriptively, and is not affiliated with or endorsed by Hasbro.
Is there a winning strategy for four in a row?
Yes. The game was solved in 1988: the first player wins with perfect play, but only by opening in the middle column. Opening next to the middle draws, and opening in any of the four outer columns loses. Playing that out perfectly is another matter — no human does it from memory.
Why does the first move have to be the middle column?
The centre column takes part in more possible lines of four than any other column, and the outer columns in the fewest. Starting there gives the first player enough of an advantage to force a win; starting anywhere else gives it away.
How do I beat the computer?
On Easy, just build a line — it will not block you. On Medium, you need a double threat: two squares that would each complete four, so blocking one lets the other through. On Hard, watch the square directly above wherever you are about to play — the search will take it if it helps.
Can the Hard computer be beaten?
Yes. It searches seven moves ahead and judges the position it reaches, which is strong but not perfect play — a solved-game engine would need to search to the end of the game. Take the middle early and it is a real contest.
Can two people play on one device?
Yes — that is the "Two players" mode, which is the default. The board alternates between the two colours, so you can pass a phone or laptop back and forth. No account, no connection, and it works offline.
Related Tools
Updated August 26, 2026