Four in a Row is a two-player strategy game played on an upright grid: drop discs into the columns, and the first to line up four of your color wins. Because every disc falls to the lowest free space, each move decides which spaces open up above it, and much of the strategy comes from that. You can play the computer at three levels or a friend on the same screen, with no account to set up.
Four in a Row rules
The grid has 7 columns and 6 rows, 42 spaces in all, and 69 possible lines of four. Red always moves first, then the players take turns dropping one disc into any column that isn't full. The disc falls to the lowest empty space in that column, so you choose a column, never a space. Discs stay where they land, and a game of Four in a Row can't last more than 42 moves, 21 for each player.
The first player with four discs in a line across, down, or diagonally wins, and the winning discs are marked. If all 42 spaces fill with no line, the game is a draw.
Because you choose only a column, there are never more than seven possible moves on a turn, and fewer once columns fill. That small number is why the computer can look many drops ahead in a fraction of a second.
How the computer picks a column
Set Opponent to Computer, then choose how hard it plays under Difficulty. Medium is the starting level, and each of the three keeps its own scoreboard:
- Easy spots a winning drop most of the time but blocks yours only a little more than half the time. Otherwise it picks a column at random, four times as likely to be the middle as an edge. Beginners can beat it.
- Medium looks five moves ahead, counting both players' drops, and rarely falls for a simple trap. It picks among moves that score almost as well as its best, so the same opening won't always get the same reply.
- Hard searches one move deeper at a time until its thinking time of about 0.45 seconds runs out, or until it finds a forced win or loss. It tries the middle columns first and remembers positions it has already scored, so it never works one out twice.
To score a position, Medium and Hard count every line of four that still holds only one color, and they rate your open threes as a little more dangerous than their own are useful. That slight lean toward defense is why both levels block early and rarely leave a three unanswered.
Under You play, choose Red to move first or Yellow to let the computer start. Undo takes back the computer's reply and your last move together, so it's your turn again; if the computer opened the game, its first disc stays.
Red against Yellow on one screen
Pick 2 players and the computer steps aside. You and a friend take turns dropping Red and Yellow discs on the same screen, and the Red and Yellow tally is kept apart from your games against the computer. Undo takes back a single disc in this mode, which helps when a finger slips, though it's worth agreeing on before a close game.
There's no online opponent to find; both of you play on this one device. Since Red can force a win with perfect play, take turns being Red.
Why the middle column and the odd rows matter
Every line of four across or diagonally spans four neighboring columns, and on a seven-column grid any four neighboring columns include the middle one. So 51 of the 69 possible lines run through the middle column, and only the 18 straight-up lines in the other columns miss it. A disc there is never wasted, which is why the computer tries the middle first and counts every middle disc in its favor.
After that, check every column on every turn for a drop that makes four, yours or your opponent's, before thinking about anything else.
Rows matter late in the game. Number them 1 to 6 from the bottom. Say Red has three in a row along row 3, the fourth space is empty, and the space under it on row 2 is empty too. Neither player wants to drop into that column: if Yellow fills row 2, Red drops onto row 3 and wins. As the other columns fill up, someone is eventually forced to play there, and with a threat on an odd row that player is usually Yellow. Even-row threats work the same way in Yellow's favor.
A solved game: why the first player has the edge
In October 1988, James Dow Allen and Victor Allis each showed, working independently, that the first player can always force a win with perfect play by starting in the middle column. Any other first move lets the second player hold at least a draw with best play.
Hard isn't a perfect player, because it stops searching after about 0.45 seconds, long before it could see to the end of a game from the opening. So the proof doesn't mean Red always beats it, but opening in the middle as Red is still the move the proof points to.
Starting a child on Four in a Row
Four in a Row works well as a first strategy game for a child: the rules take a minute to explain, and a line of four forming across, down, or diagonally is easy to see. Start them on Easy, which sets out to block a winning threat only about six times in ten, so they'll win often, then move up to Medium once they block threats without being told. In 2-player mode you can play them yourself and use Undo to show what a different drop would have done.
If they enjoy lining things up, classic Tic Tac Toe, Ultimate Tic Tac Toe, and Gomoku, five in a row on a bigger board, are good next games.
Dropping discs with a mouse, a finger, or the keys 1 to 7
Tap or click a column to drop a disc. With a mouse, the next disc hovers above the column you point at, so you can see where it will fall before you commit. The grid scales to the screen, from a phone to a wide monitor.
With a keyboard, pick a column with the arrow keys and press Enter, or press 1 to 7 to drop straight into a column. U undoes a move and N starts a new game, and each move is announced for screen readers. If your device asks for reduced motion, discs appear in place instead of falling.
Once the page has loaded, the whole game runs in your browser, Hard's half-second search included, so your drops aren't sent to a server for the computer to answer.
Four in a Row, Connect 4, and other names
The drop-disc game has gone by several names. An older one is The Captain's Mistress, and since 1974 it has been sold as Connect Four by Milton Bradley, now part of Hasbro. You'll also see it called 4 in a Row or Drop Four.
This version uses the same classic rules on a 7-by-6 grid, with its own design and code, and it isn't affiliated with Hasbro.
Scores and unfinished games in this browser
Your opponent, level, and disc color, a separate scoreboard for each opponent, and any game you haven't finished are saved in this browser's local storage, so a reload drops you back into the same position. They're kept there rather than on a server, and clearing the site's data removes them. Reset scores wipes the tally for the opponent you're facing now, and the privacy policy lists every item the site keeps.