Gomoku Best Move Calculator

Place stones to build any Gomoku position on the full 15×15 board, and this solver will find the best move — and, more usefully, name every open three, four and double threat on the board for both players.

Built by Brian Hamilton

Click a point to place a stone
Whose turn is it?
Search effort

Place some stones, set whose turn it is, then press Find best move.

A four is not a four

Gomoku is decided almost entirely by threats, and the single most important distinction is one that beginners rarely make: whether a run of four has one way to become five or two. One is answerable. Two is the end of the game.

An open four: four black stones with an empty point at each end Both E8 and J8 would complete five in a row. White can only occupy one of them, so the position is already decided.
An open four. Both E8 and J8 complete five, so White can block one and lose to the other. Nothing can be done.
The same four stones with one end blocked by White Only J8 now completes five, so White simply plays there. A four with one end closed forces a reply but does not win.
The same four stones with one end already blocked. Only J8 works now, so White plays there and the threat evaporates.

This is why the calculator never simply counts stones in a row. It asks the question that actually matters — how many empty points would complete a five? — and classifies from the answer. Two or more and it reports an open four; exactly one and it reports a four that forces a reply.

The same logic defines an open three: not “three stones in a row”, but a shape one move away from an open four. That is why a three with both ends smothered is not a threat at all, and the tool will tell you so rather than counting it.

Two threats at once, and the game is over

A single open three can be answered. Your opponent blocks an end, and you have gained little. Games are won by making two threats with one stone, because only one of them can be met.

Playing the centre point creates two open threes at once Black has two stones on the row and two on the column, each one point apart. Filling the gap between them makes an open three in both directions simultaneously, and White cannot answer both.
Black has two stones on the row and two on the column, each pair with a gap between. The faint stone fills both gaps at once, creating an open three horizontally and vertically. White can block one; the other becomes an open four.

Finding these by eye on a 15×15 board is genuinely hard, which is the main reason this tool exists. Every move in the ranked list is labelled with what it achieves, and a move that creates two threats is called out as a double threat — wins by force. The threat table above the list shows how many each side currently has, so you can see one coming before it lands.

The threat vocabulary

How the calculator labels a move, and what you should do about it.
LabelMeaningResponse
Wins immediatelyCompletes five in a row.Play it.
Open fourTwo different points now complete a five.Cannot be blocked. The game is decided.
Double threatTwo open threes, or a four alongside a three.Wins by force — only one can be answered.
FourExactly one point completes a five.Must be blocked at once, but it is not fatal.
Open threeOne move away from an open four.Answer it, or accept an unstoppable four next turn.
Quiet moveBuilds shape without forcing anything.Fine early; usually too slow once threats exist.

How this calculator works

It is the engine from the playable Gomoku game, with the threat detection rebuilt to use the definitions above rather than pattern-matching stone counts.

  • Candidate moves only. A 15×15 board has 225 points, which is far too wide to search. It considers only empty points near existing stones, which is where every meaningful move is.
  • Threat-based move ordering. Wins, blocks, open fours and double threats are examined first. This matters more in Gomoku than in any other game here, because good ordering is the difference between searching four ply and searching eight.
  • Search: minimax with alpha–beta pruning, deepening in pairs of ply so that both sides always get a reply.
  • Iterative deepening against a time budget, keeping the deepest search that finished. Fast, Standard and Deep allow roughly 1.5, 4 and 9 seconds.
  • Threat classification is exact, not estimated, and does not depend on search depth — so the labels are trustworthy even on Fast.

Where it is weak

  • No opening book. Gomoku opening theory is deep and heavily studied; this engine works everything out from scratch.
  • It searches narrowly. Only the most promising handful of moves are explored at each node. That keeps it fast, but a brilliant quiet move can be pruned away before it is ever tried.
  • No threat-space search. Strong Gomoku programs chase long forcing sequences of fours and threes far beyond normal search depth. This one does not, so it will miss wins that are ten forcing moves away.
  • Free-style rules only — see below.

Which rules this uses

This calculator plays free-style Gomoku: 15×15 board, Black moves first, five or more in a row wins, and there are no restrictions on either player.

That matters, because free-style Gomoku is solved and won by Black. Serious play therefore uses handicap rules that rein the first player in — Renju forbids Black from making a double three, a double four or an overline of six or more, while Swap and Swap2 let the second player choose colours after the opening stones are placed. None of those restrictions are applied here.

So if you are analysing a Renju game, treat the double-three suggestions with care: the tool will happily recommend a move that Renju rules would forbid Black from playing.

Play a full game

The analyser works on positions. To play one out, the free Gomoku game uses this engine at three difficulty levels or as pass-and-play. There are matching analysers for Checkers, Reversi, Nine Men’s Morris and 4 in a Row. If you like Gomoku you may also enjoy Go and Super Tic-Tac-Toe, or the rest of the free online puzzle games.