Gomoku vs AI
Play gomoku on a real 15x15 board: click an intersection and five in a row in any direction (overlines included) wins immediately. The computer opponent is a heuristic picker that scores five-in-a-row, blocks, open fours and fours and prefers forced wins and forced blocks, always answering identically for the same position and seed; two-player mode is available too.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Gomoku board
Click an intersection to place a stone; click the board once to use the keyboard.
- Black stones
- 0
- White stones
- 0
- Empty
- 225
- Moves
- 0
- Winning line
- -
- Winner
- -
Arrow keys / W A S D move the cursor, Enter or Space places a stone
Move log
0 move(s) in total
No move recorded yet
What this tool does
- Play a game of gomoku: the default is human versus computer (computer plays White), click an intersection and the computer answers with its heuristic.
- Check whether the computer really blocks: when you build three or four in a row it first looks for its own five, then for five-making and four-making blocks.
- Play a friend: switch to two-player mode and alternate on the same board, with the result coming from real five-in-a-row detection.
Example
Input
Opponent = computer plays White (seed demo), Black clicks the centre 8,8
Output
Move 1 · You (Black (X)) played 8,8 Move 2 · The computer (White (O)) played 9,8 (heuristic score 102) Status: Move 2 · Black 1 : White 1 · Black to move
The computer answer depends only on the position and the seed: same position plus same seed always gives the same move; a different seed may pick another equally top-scoring point.
Frequently asked questions
How do I place a stone?
Click any empty intersection; you can also click the board (or a cell) to focus it, move the cursor with the arrow keys / W A S D and press Enter. A taken intersection only tells you to pick another one — it never overwrites a stone.
How does the computer choose? Is it random?
It scores every empty point: the weight of the line it forms for itself (five / four / three / two) plus the weight of the same shape it denies the opponent, with attack worth twice defence, then takes the maximum. So it always blocks a formed four or open three and always completes its own five when available; ties go to the point closer to the centre, then to a seed-determined order. It is deterministic, not random — and it does not search ahead.
How is the winner decided?
Five stones in a row in any direction (rows, columns or both diagonals, overlines included) wins immediately, judged by a real line search; if the board fills up without a five, the game is a draw.
What is the difference between the two-player and computer modes?
Two-player mode has no computer at all: you place Black and a second person places White on the same screen — no “computer” wording and no automatic reply. In the computer modes you can let the computer play White, or Black moving first.
Keywords:gomoku