Basic Rules

The following are the fundamental rules of our Gomoku implementation:

  • Black plays first, and players alternate turns.
  • In the interface, Black stones are shown as X (dark stones), and White stones are shown as O (light stones).
  • A capture occurs only when the newly placed stone completes a straight-line pattern of player-opponent-opponent-player along any of the four axes (horizontal, vertical, or diagonal). The two opponent stones are then removed.
before capture - before capture - after capture - after capture -
  • Double-Three Prohibition: A move is forbidden if it simultaneously creates two open sequences of three stones (known as "free-threes"), which would offer a guaranteed path to victory by alignment.
double three case 1 - double three case 1 - double three case 2 - double three case 2 -

Win Conditions

A player can win in one of the following ways:

  • By alignment: A player who aligns five or more consecutive stones wins — but only if the opponent cannot immediately break the alignment by capturing part of it on the next move.
Black win - Black win - Continue game - Continue game -
  • By capture: In the default setting, a player who captures 5 pairs wins.
    capture win - capture win -

Draw Condition

  • The game is a draw when the current player has no legal move left (for example, when the board is full, or when every empty point is forbidden by the double-three rule).

Note: AlphaZero's terminal check currently treats any contiguous five-in-a-row as terminal and does not enforce breakability. See Training Pipeline for details.

Context note: in the basic rules of both Gomoku-family games and Go, Black plays first (for example, RIF Renju rules and American Go Association rules). In this project, that convention is preserved: the side assigned to move first is treated as Black.