Gomoku

Get five stones in a row - horizontally, vertically, or diagonally

You
Black
AI
White
Your turn - place a stone
How to Play Move: 0

How to Play Gomoku

Gomoku, also known as Five in a Row, is played on a 15x15 grid. Players take turns placing stones on the intersections - black moves first. The first player to line up exactly five or more stones in a row horizontally, vertically, or diagonally wins the game. Stones never move or get captured once placed, so every stone is a permanent part of the battlefield.

On PlayVersusAI you play black against a white-stoned AI, or face a friend in real-time multiplayer. The AI recognizes open threes, broken fours, and double threats - on the higher difficulties it will punish a single careless move.

Strategy Tips

Read the full Gomoku guide →

Playing Gomoku on PlayVersusAI

Gomoku, or Five in a Row, played on a 15x15 grid. Players alternate placing stones on empty intersections and the first to line up five in a row — horizontally, vertically or diagonally — wins. Nothing is ever captured and nothing ever moves, which makes the rules learnable in about ten seconds and the strategy considerably harder.

The engine scores positions by recognising threat patterns rather than counting stones: an open three (three in a row with both ends free) forces a response, an open four is already winning, and a move creating two open threes at once is usually decisive. It searches around existing stones rather than the whole board, which is what keeps a 225-intersection grid tractable.

What's on This Page

Easy blocks your immediate fours but misses open threes. Medium answers threats correctly. Hard builds its own double threats while defending. AI Training looks for forcing sequences several moves deep, and once it has a double-three you are generally lost — the game is won or thrown away in the moves before that point.

Mistakes That Lose Games

Gomoku Questions

Is there a swap rule or an opening restriction?
No. This is freestyle Gomoku with no forbidden moves and no swap. Tournament Renju rules restrict the first player with extra prohibitions to offset the first-move advantage, but they add considerable complexity and are not used here.
Does exactly five count, or does six also win?
A line of five wins. A longer line contains a five, so it also wins — this implementation does not use the "overline does not count" restriction from Renju.
Why does the AI sometimes ignore my three in a row?
Because it has calculated that its own threat comes first. If it can force a win before you complete your line, blocking would just be slow. When it ignores you, check whether you are actually the one under attack.

For the complete rules, the deeper strategy and the history of the game, read the full Gomoku guide, or browse guides for all 20 games.