Five in a Row

Play full screen
Rate this game

No ratings yet. Be the first.

How to play

Five in a Row is the game many people know as Gomoku. Two players, black and white, take turns putting one stone on an empty point of a 15 × 15 grid, 225 points in all. Black goes first. Once a stone is down it stays there: nothing moves, nothing is captured, and the board only ever gets fuller.

The goal is a straight, unbroken line of five of your own stones. It can run across, up and down, or along either diagonal. As soon as someone completes one, the game ends and the winning line is highlighted. If every point is filled and nobody has five, it’s a draw, though in practice that almost never happens.

To play a move, tap an empty point. A small red dot marks the most recent stone, which helps when you look back at the board after the computer has answered.

The bar above the board holds the settings:

  • Opponent switches between Computer and Friend. With Friend, two people share one screen and tap in turn; the status line says whose move it is.
  • Difficulty (computer games only) sets Easy, Medium or Hard.
  • Hint marks a suggested point for whoever is to move.
  • Undo steps back. Against the computer it takes back your last stone and the computer’s reply together, so it’s your turn again. Against a friend it removes one stone.
  • New game clears the board.

Against the computer you always play black, which means you always have the first move.

Which rule set this is

Gomoku comes in several flavours, and it is worth knowing which one you are playing. This board uses the free-style rule: five or more in a row wins. If you drop a stone that joins two short lines into a row of six, that counts as a win too. Two well-known variants are not used here:

  • Standard Gomoku, where only exactly five wins and an overline of six does not.
  • Renju, which forbids black from making certain shapes (double threes, double fours, overlines) to balance out black’s first-move edge.

There’s also no swap opening. Black simply starts wherever it likes. Under these rules the first player has a real advantage, so if you play a friend, alternate who takes black.

Strategy

Play near the centre. A stone in the middle of the grid sits on many possible lines of five; one on the edge sits on very few. Your first few stones should stay close together near the middle.

Learn to read open ends. Three stones in a row with empty points at both ends is an open three. Left alone, it becomes an open four, which has two winning points and cannot be stopped. That makes an open three a must-answer threat, unless you have a four of your own to play first.

Watch for split shapes. A pattern like ● ● · ● is as dangerous as three in a row, because one stone in the gap makes four. Beginners often miss these broken lines, both their own and their opponent’s.

Build double threats. Most games are won with a single stone that creates two threats at once: a four plus an open three, or two open threes. Your opponent can block only one. Try to place stones so they belong to several of your lines at the same time.

Defend with a purpose. When you must block, check both ends of the enemy line. Often one blocking point also extends a line of yours, turning defence into a threat.

Keep the initiative. A four forces an immediate reply. A chain of fours and open threes, each forcing an answer, can lead straight to a winning double threat. Think of it as a forced sequence, like a series of checks in chess.

How the computer plays

The computer only considers empty points within two spaces of stones already on the board. It scores each candidate for attack and defence and searches the ten most promising. If it has a winning move, or must block your five, it looks at nothing else. Hard searches deeper than Medium, and Medium deeper than Easy. In the developers’ test games, Hard beat Easy 12 times out of 12 and Medium beat Easy in all 6 games played.

The Hint button uses the same search at Medium strength, so it is a decent suggestion but not a perfect one.

For a lighter game of lining things up, try Four in a Row, where discs fall down columns. Reversi uses the same black and white stones, but there every move flips your opponent’s pieces.

If you enjoy Five in a Row, try Four in a Row or Fox and Geese next.

Frequently asked questions

Who moves first?

Black. Against the computer you are black, so you always start.

Does a line of six win?

Yes. This is free-style Gomoku, where five or more in a row wins. Exact-five and Renju restrictions are not used.

What does Undo take back against the computer?

Your last stone and the computer's answer, so you can try a different move.

Can two people play on one device?

Yes. Pick Friend under Opponent. Both players tap the same board in turn, and the choice is remembered.

Can the game end in a draw?

Only if all 225 points are filled without a line of five, which is very rare.

Is my game saved?

Yes. The position is saved after every move, along with your opponent and difficulty settings.

Add Five in a Row to your website

Free, no sign-up. Paste the code into any page. The credit line under the game is optional, but we appreciate it. On WordPress, use our plugin and the shortcode.

Embedding rules and options