gomoku
Play the Gomoku game
SYNOPSIS
gomoku [-r] [-w]
PARAMETERS
-r
Computer chooses first move randomly (default: fixed opening)
-w
Computer plays white (X); human plays black (O). Default: human white
DESCRIPTION
Gomoku (also known as five in a row) is a classic strategy board game played on a 15x15 grid, similar to tic-tac-toe but larger and more complex. Players alternate placing stones—white (X) or black (O)—aiming to form an unbroken line of five stones horizontally, vertically, or diagonally. The Unix gomoku command provides a single-player version against a computer opponent using a simple AI.
Invoked from the shell, it displays the board in a terminal using ASCII art. The human player starts at the board's center and navigates with h/j/k/l keys (left/down/up/right), placing a stone with spacebar. The game tracks wins/losses/draws, printing a score summary at the end. It enforces standard rules, detecting wins immediately and preventing overlines.
Ideal for quick sessions, gomoku tests pattern recognition and foresight. The AI is competent but beatable with strategy like prioritizing center control and blocking threats. Part of traditional Unix games, it's lightweight, requiring no graphics—just a curses-compatible terminal.
CAVEATS
Single-player only (vs AI); requires terminal with cursor support. No save/resume; AI may draw often on perfect play.
CONTROLS
h/j/k/l: move cursor | space: place stone | q or Ctrl-C: quit | ?: redraw board
Cursor starts at center (H8).
SCORING
Tracks Wins/Losses/Draws for human. Prints summary after each game; resets on new invocation.
BOARD
15x15 grid labeled A-O rows, 1-15 columns. Empty: . | Human (X): white | Computer (O): black.
HISTORY
Gomoku dates to ancient Japan (renju variant). Unix gomoku debuted in 4.3BSD (1986) games suite, ported to Linux via bsdgames package. AI uses minimax search; largely unchanged since 1990s.
SEE ALSO
pente(6), reversi(6), backgammon(6), gnuchess(6)


