Four in a Row
Drop a disc. Make a line. Ask for a rematch.
How to play
Red goes first. Choose a column and your disc falls into its lowest empty space. A full column cannot take another disc.
Connect four of your discs horizontally, vertically or diagonally to win. A full board without a line of four is a draw.
The rules: you choose a column, gravity chooses the square
Seven columns, six rows, 42 slots, 21 pieces to each colour, and every piece the same. Red drops first and yellow second. If you know tic tac toe you already know the goal, which is a row of your own colour and nothing else. Two things here are not tic tac toe. The line is four rather than three, and you never pick a square: you pick a column, and the disc falls to the lowest empty space in it, because gravity belongs to the board rather than to the person dropping.
Every column is a button, which is also the whole keyboard route to a drop. Hover one or tab to it and a ghost disc shows the square it would land on before you commit. One already holding six pieces will not take another.
Four pieces of one colour in a line wins, horizontally, vertically or diagonally. Forty-two discs down with no line of four is a draw. The win is tested before the board is tested for fullness, so the last disc can fill the final square and complete a line on the same drop, and that is scored a win. Either side can resign, and when a game ends the run that ended it is marked on the board.
Connect 4 is a trade name. The game under it is older.
Milton Bradley put the boxed version on shelves in February 1974, designed by Howard Wexler and Ned Strongin, and Connect 4 has been a trade mark ever since; Milton Bradley belongs to Hasbro now. The game is not the box. It was being played long before that date, and it has gone out under other names: Four Up, Plot Four, Gravitrips in the Soviet Union, and Captain’s Mistress. That last one carries a story about James Cook playing it below deck, repeated everywhere and sourced nowhere we have been able to find. Treat it as a nickname with a legend attached rather than as a date.
So the game here is called four in a row, which is what it is called when it is nobody’s product. If you arrived typing connect four, you are in the right place: same seven by six grid, same rule about four in a row, same red and yellow discs. What we rebuilt is the game, not the brand.
Three ways to start, none of them an account
Play connect 4 online against one other person by link. Create a table with one click and it hands you a link. Give that to one person, wherever in the world they happen to be, and they take the seat opposite as soon as they open it. Nobody signs up, nobody installs anything, and the whole multiplayer side of this runs in the browser: free, two seats, one link.
If the other player is standing right there, put both of you on one screen and pass the device between turns. If nobody is free tonight, try the computer: it is sitting down already. Those are the three ways in: online with friends by link, two players sharing a screen, or one player against the machine.
Solved in 1988, and solved twice over
This is a solved board game, which is a smaller club than it sounds. James D. Allen announced a solution in a rec.games.programmer post on 1 October 1988. Fifteen days later Victor Allis announced one he had reached independently and wrote it up in his thesis, a knowledge-based approach built on nine strategies. Neither of them was reading the other.
What they proved is that the player who goes first wins with perfect play, and that the winning opening is the middle column. Open there and the win lands on or before the 41st disc. Open in either column next to the middle and the game is a theoretical draw. Open in one of the two outer columns and the player who went first loses. The advantage is real, and it is one column wide.
John Tromp later took the brute force road, compiling a database of every position eight discs deep at a cost of 40,000 hours of computing, and published a count of the legal positions on the seven by six board: 4,531,985,219,092 of them. Stefan Edelkamp and Peter Kissmann reached the same figure independently in 2008. So the advice to go in the middle is not a tip somebody had a feeling about. It is the answer, and it was settled a year before the proposal that became the web this game is now played on.
Why the middle, counted on this board
A seven by six grid holds exactly 69 lines of four. We counted them off the geometry our own win check runs: 24 horizontal, 21 vertical and 24 diagonal, half of those leaning left and half leaning right. The middle column is part of 51 of the 69. Either outer column is part of 15. Those two numbers are the whole of the centre advice.
Square by square it is starker. The two middle squares of the middle column sit on 13 possible lines each; a corner square sits on 3. Our own search knows the same fact in its own dialect. It adds four points to its score for every disc it owns in the middle column, and when it searches it tries the middle columns before the outer ones. Handed an empty board, it opens in the middle.
Is going first an advantage?
In theory yes, and provably: the proof above hands the first player the win from the middle column. In practice it turns on how well that player plays. Perfect play is what the proof asks for, and the proof is a promise to nobody else.
On this board red drops first. Against the computer you are red, so the first disc of every game is yours, and the seat theory favours is the one you are sitting in.
Then we set that search against a copy of itself, which a deterministic search allows: the same position draws the same answer every time, so one game is the game. Opening in the middle, red did not win. That game ran the full 42 discs and yellow took it with the last one, dropping into column 6 to fill the top row and close a diagonal that ran down to column 3. A full board and a win on the same disc, which is the rule two sections up doing its work on a real game rather than a case we invented for it.
Forcing the opening into each column in turn, red won two of the seven games and lost five. Both sides in those games were the same three-ply search, which is a long way from perfect play, and that is the honest answer to the question. The theorem describes somebody who never errs. Neither of you is that person, and nor is the machine we ship.
What the computer sees, and what it cannot
One setting, one strength, the same every time. Under the surface it is a minimax search three plies deep with alpha-beta pruning: its own move, your reply, its move after that. There are no difficulty levels on this table and no randomness at this depth, so the same position gets the same answer out of it every time you reach it.
It takes a win when a win is there. It blocks the four you could finish on your next turn. And it will drop a disc whose only purpose is the fork it opens later, which we checked rather than assumed: put two yellow pieces on the floor of columns 3 and 4, red on the floor of 1 and 7, and hand it the move. It drops into column 5, and the floor of 2 and the floor of 6 then both finish a yellow four. You can block one of them.
Outside that horizon it is blind, and a trap laid deeper than three plies is a trap it walks into. It is not a solver, and nothing here is. A perfect opponent for this game has been available since 1988, and if we shipped one the game would be over before you sat down. What is here is a fixed challenge that plays the position in front of it.
We play test every game before it ships, and that is why every board on this site has a computer to play against. It is the sparring partner that gets a game checked before anybody else is asked to sit down at it.
The easy part and the other part
Easy is true of the rules. A child can be told them in a minute and be dropping discs before the telling is finished, which is why a 1974 box keeps a seat here beside the Royal Game of Ur, cut around 2600 BCE. The other part is the 40,000 hours of computing, the two independent solutions in a fortnight of 1988, and the 51 lines running through the middle column.
That gap is the reason people keep playing a game they already know how to play. The rules stop being interesting after a minute. The position in front of you does not.
Boards on the same shelf
Gomoku wants five in a row, on a fifteen by fifteen grid with no gravity in it, so a stone goes exactly where you put it. Nine Men’s Morris makes lines of three and removes one of your opponent’s stones for each line you complete. Checkers is on the shelf here as well, and checkers is the one to reach for when you want captures rather than a race to a line. All of them open the same three ways this board does.
Questions people ask
connect 4 game how to play
Take turns dropping one disc into any column that is not full. Your disc falls to the lowest empty space, so you pick the column and gravity picks the square. The first player to get four of their own colour in a row, horizontal, vertical or diagonal, wins. If all 42 slots fill with no line of four, the game is a draw.
Connect 4 online 2 player
Two ways, both here. Make a table and send the link, and the person who opens it plays you from wherever they are. Or put both players on one screen and pass the device between turns. Neither needs an account.
Connect 4 online single player
Play the computer. You take red, which means you move first every game, and it searches three plies ahead with no randomness in it. There is one strength rather than a ladder of levels.
Connect 4 Online same screen
Choose the shared screen option and the board stays on one device, red and yellow taking turns on it. It is the closest thing to the plastic frame on a kitchen table, minus the part where the discs all fall out of the bottom.
connect 4 strategy
Start in the middle column, because 51 of the 69 possible lines of four run through it and only 15 run through an outer column. After that, watch what you are building for the other player: every disc you drop hands them the square directly above it. A threat sitting above a square they have to block is worth more than one they can ignore, and two threats they cannot both block is the game.
Connect 4 solver
A solver is a program that plays perfectly, which is possible here because the game was solved in 1988 and every position eight moves deep has been catalogued since. Ours is not one, deliberately. It searches three plies ahead and it can be beaten.
connect 4 vs computer impossible
Nothing on this table is set to impossible, because there are no difficulty settings on it at all. It searches to a fixed depth of three plies. Beat it by looking further than it does: set up two threats it cannot both answer, and set them up more than three plies out.
Connect 4 online CBC
That is the version on the Canadian broadcaster’s children’s site, a different game on a different site. This one is ours: it runs in the browser, it needs no account, and it will play you or a friend of yours by link.