Four in a Row

Take turns dropping discs into the columns, and win by lining four of your own up across, down or on a diagonal before your opponent does. Three computer levels, and the hardest thinks several moves ahead.

How to play

Discs fall to the lowest free slot, so the only decision is which of the seven columns to use — and every disc you drop hands your opponent the square above it.

  1. Choose a difficulty Easy barely looks ahead. Normal thinks four moves deep. Hard looks six moves ahead and is a serious opponent.
  2. Click a column Click anywhere in the column you want and your red disc drops to the bottom of it.
  3. Watch the diagonals Most losses in this game come from a diagonal line the player never saw building. They are much harder to spot than rows and columns.
Full instructions

In depth

Dropping discs and thinking several moves ahead

The rules behind a seven-column board, how the three computer levels differ, why the centre column matters so much, and the tactics that turn a casual dropper into someone the Hard opponent cannot easily beat.

Screenshot: How to play Four in a Row
How to play Four in a Row as it appears when the page opens.

A board shaped by gravity

The board is seven columns wide and six rows tall. You click a column and your disc falls to the lowest empty slot. That is the one rule that separates this from drawing marks on a grid. You cannot place a disc wherever you like. You have to build from the bottom up, and every disc you place creates a landing pad for whatever comes next.

The first player to get four of their own discs in a straight line wins. That line can run across, straight down, or on either diagonal. The game ends the moment a line of four appears. If every slot fills up and nobody has four in a row, it is a draw.

Your discs, the computer's discs, and who goes first

You play as red. The computer plays as yellow. By default you go first, which is the easier side. A dropdown next to the difficulty selector lets you hand the opening move to the computer instead. Going second is harder because the first player has more control over the centre of the board from the start.

The scoreboard above the board tracks how many games you have won, drawn, and lost. Those totals reset when you reload the page. While the computer is thinking, a note under the board says so. Once it has moved, the note tells you it is your turn.

What the three difficulty levels do

Easy barely looks ahead. It picks a column based on what is immediately in front of it and often misses threats that are two or three moves away. It is a good level for learning the shape of the board without getting punished for every mistake.

Normal searches four moves deep. It sees simple traps coming and blocks most of your three-in-a-row attempts. It still leaves openings that a patient player can find, especially along diagonals.

Hard searches six moves deep and is a serious opponent. It examines many thousands of positions before each move, which is why it takes a moment to respond. It rarely misses a threat and often sets up two winning lines at the same time. Beating it consistently takes real planning.

How the computer actually thinks

The computer looks ahead by trying every possible column for its own move, then every possible reply from you, then every reply to that reply, and so on, down to the depth its level allows. At the end of each chain it scores the board by counting how many groups of four cells favour it and how many favour you.

It searches columns starting from the centre and working outward. This ordering is not about strategy. It is a technical trick that lets the search cut off dead branches faster, so it reaches the same depth in less time.

A group of three discs with a gap is worth more than a group of two. A group that is blocked on both sides is worth nothing. The computer also values the centre column above the edges because a disc there belongs to more possible lines of four than one on the wing.

Why the centre column decides most games

A disc in column four can be part of horizontal lines reaching three squares in either direction, vertical lines running straight up, and diagonals going both ways. A disc in column one can only contribute to lines that extend to its right. The geometry gives centre discs more winning chances before anyone has moved.

Strong play almost always starts with the centre column. If you go first, drop there. If you go second and the computer took the centre, contest it immediately. Giving up the middle without a fight puts you on the back foot for the rest of the game.

Watch what happens when you try side openings against Hard. It takes the centre, builds from it, and often wins before you can recover.

Building two threats at once

A single threat gets blocked. You line up three red discs with a gap, and the computer drops yellow into that gap. The way to win is to create two threats in one move. Only one can be blocked, so the other completes on your next turn.

The classic setup is an unblocked three, where both ends are open. Your opponent blocks one end, but the other is still there. An even stronger position is two separate lines of three that share a single move. No matter which one the computer addresses, the other one goes through.

To build these, look for moves that contribute to more than one line at once. A disc that extends a horizontal while also adding to a diagonal is doing double work. Over several turns that kind of positioning creates the forks that single-line play never will.

Check what you hand over

Every disc you drop opens the slot directly above it. If that slot completes a line for your opponent, you just lost the game by winning a square. Before you commit to a column, look at the cell one row higher. Ask yourself what happens when the computer plays there on its next turn.

This is especially dangerous mid-game when the board is half full and there are gaps scattered around. A drop that looks safe at the current row might unlock a winning square one row up. The computer on Hard is very good at baiting you into exactly this kind of mistake.

If two columns both look decent, pick the one that gives away less. A column whose upper slot sits in no useful line for the opponent is always safer than one whose upper slot feeds a diagonal you did not notice.

Spotting diagonals before they finish

Rows are easy to see. Columns are easy to see. Diagonals are not. Most losses against the computer come from a diagonal that was building across several turns while the player focused on horizontal threats.

After every move, scan both diagonals through the square that just filled. Count how many same-colour discs sit on each one. If the computer has two on a diagonal with room for two more, that line needs attention now, not in three turns.

One useful habit is to look at the corners of the board. A diagonal that starts near a bottom corner and climbs toward the centre is the hardest one to block because you cannot fill the upper squares until everything below them is placed.

Draws and the solved nature of the board

Four in a Row is a solved game. Mathematicians proved decades ago that the first player can force a win with perfect play on a seven-by-six board. Neither you nor the computer plays perfectly at these levels, so draws and losses for the first player do happen. But the theory explains why going first is the easier side and why handing the opening to the computer makes the game noticeably harder.

A draw happens when every cell is filled and no line of four exists. Draws are less common than in smaller grid games because the board is large enough that one side usually finds a line before it fills up. Against Hard, draws tend to appear when both sides play defensively and block every threat without creating their own.

Common mistakes and what to do instead

  • Opening on the edge. A disc in column one or seven starts with fewer possible lines than one in the middle. Open in the centre unless you have a specific reason not to.
  • Blocking every threat one at a time. If the computer keeps making lines and you keep blocking them, you are playing its game. Build your own threats so it has to block you instead.
  • Ignoring diagonals. After every move, look at both diagonals through the new disc. If you only check rows and columns, the computer will beat you diagonally.
  • Chasing a single line. Extending the same row turn after turn is easy to block. Spread your discs across two or three different lines and bring them together.
  • Filling a column to the top without purpose. A full column is a dead column. Every disc in it is locked in place and can never be part of a new plan.

The game runs entirely on your machine

The search the computer uses to pick its move happens right inside your browser. Nothing about your game is sent to a server. There is no account, no upload, and no queue behind other players. On Hard the thinking takes a moment because it is examining thousands of board positions locally. Once the page has loaded, everything works even without an internet connection.

Help

How to play Four in a Row

Discs fall to the lowest free slot, so the only decision is which of the seven columns to use — and every disc you drop hands your opponent the square above it. Three computer strengths are offered, and the hardest looks several moves ahead, which is enough to punish a trap set one move too early.

Choose a difficulty

Easy barely looks ahead. Normal thinks four moves deep. Hard looks six moves ahead and is a serious opponent.

Click a column

Click anywhere in the column you want and your red disc drops to the bottom of it.

Watch the diagonals

Most losses in this game come from a diagonal line the player never saw building. They are much harder to spot than rows and columns.

Block as well as build

If the computer has three in a row with a space at either end, blocking it matters more than your own plan.

Play again

Wins, draws and losses are counted above the board.

The computer thinks in your browser

The search runs on your own device, so nothing is uploaded and the game works offline. On Hard it examines many thousands of positions before each move, which takes a moment.

Good to know

Fight for the middle column

A disc in the centre column can be part of far more winning lines than one at the edge. Strong players take the middle first and keep it.

Think about what you hand over

Every disc you drop lets your opponent play the slot directly above it. Dropping into a column can gift them a winning square — check above before you commit.

Build two threats at once

As in most games of this kind, a single threat gets blocked. The way to win is to create two threats in one move so only one can be stopped.

The first player can force a win

Four in a Row is a solved game: with perfect play the player who goes first wins. That is why you can hand the first move to the computer for a much harder game.

Common questions

How does the computer choose its move?
It looks several moves ahead and scores the positions it finds, preferring lines where it has three or two discs together and blocking yours. On Hard it searches six moves deep.
Why is the middle column so important?
A disc there can be part of more winning lines than one at the edge, so it is worth more from the moment it lands. The computer is deliberately biased towards it for that reason.
Is the game fair?
Four in a Row is solved, and the first player can force a win with perfect play. Neither you nor the computer plays perfectly at these levels, but you can hand over the first move if you want the harder side.
Why does Hard take a second to move?
It is examining many thousands of possible positions before choosing. That thinking happens on your device, not on a server.
Can I play against another person?
Not on the same board yet — this is you against the computer. Set it to Easy if you want a gentle game.
How do I win more often?
Take the centre column early, watch for diagonals, and look for moves that create two threats at once so only one can be blocked.