Gomoku
From Wikipedia, the free encyclopedia
Gomoku, go-moku, or gobang (Japanese: 五目並べ, Gomoku Narabe, "five points"), or in English Connect Five (also spelled Connect 5 or Connect5) is an abstract strategy board game. It is traditionally played with go pieces (black and white stones) on a go board (19x19 intersections); however, because once placed, pieces are not moved or removed from the board, gomoku may also be played as a Paper and pencil game.
Black plays first, and players alternate in placing a stone of their color on an empty intersection. The winner is the first player to get an unbroken row of five stones horizontally, vertically, or diagonally. Gomoku is known in Korean by its cognate omok (오목) and in Chinese as "五子棋" (Pinyin: wǔzǐqí).
Contents |
[edit] Example game
This game on the 15×15 board is adapted from the paper "Go-Moku and Threat-Space Search".
The opening moves show clearly black's advantage. An open row of three (one that is not blocked by an opponent's stone at either end) has to be blocked immediately, or countered with a threat elsewhere on the board. If not blocked or countered, the open row of three will be extended to an open row of four, which threatens to win in two ways. White has to block open rows of three at moves 10, 14, 16 and 20, but black only has to do so at move 9.
Move 20 is a blunder for white (it should have been played next to black 19). Black can now force a win against any defence by white, starting with move 21.
There are two forcing sequences for black, depending on whether white 22 is played next to black 15 or black 21. The diagram on the right shows the first sequence. All the moves for white are forced (except for 38, but by then it is too late). Such long forcing sequences are typical in gomoku, and expert players can read out forcing sequences of 20 to 40 moves rapidly and accurately.
The diagram on the right shows the second forcing sequence. This diagram shows why white 20 was a blunder; if it had been next to black 19 (at the position of move 32 in this diagram) then black 31 would not be a threat and so the forcing sequence would fail.
[edit] Variations And Opening Rules
Black was long known to have a big advantage, even before L. Victor Allis proved that black could force a win (see below). So a number of variations are played with extra rules that aimed to reduce black's advantage.
- Free-style gomoku is the basic game as described above.
- Standard gomoku requires a row of exactly five stones for a win: rows of six or more, called overlines, do not count.
- The rule of three and three bans a move that simultaneously forms two open rows of three stones (rows not blocked by an opponent's stone at either end).
- Gomoku+(also called Caro, popular among Vietnamese) the winner must have an unbroken row of five stones and this row must not be blocked at either end. This rule makes Gomoku more flexible and provides more power for White to defend.
- The rule of four and four bans a move that simultaneously forms two rows of four stones (open or not).
- The Little Golem game server has a "forbidden zone" where black cannot play his second move.
These restrictions are often applied only to black.
- Renju is played on a 15×15 board, with the rules of three and three, four and four, and overlines applied to black only. There are special rules for the opening.
- Ninuki-renju or Wu is a variant which adds capturing to the game; it was published in the USA in a slightly simplified form under the name Pente.
- m,n,k-games are a generalization of gomoku to a board with m×n intersections, and k in a row needed to win.
- Connect(m,n,k,p,q) games are another generalization of gomoku to a board with m×n intersections, k in a row needed to win, p stones for each player to place, and q stones for the first player to place for the first move only. Among these games, Connect(m,n,6,2,1) is the most interesting one, and is called Connect6.
The only fair opening rule currently is swap2 based on swap from Renju and first seen on kurnik.org. The first player places 3 stones (2 black 1 white, if black goes first) on the board, the second player has the choice to take black/white or place 2 more stones to change the shape and let the first player choose color. Also this rule brings Gomoku back to an unsolved game, because it has gotten more complicated from even openings.
[edit] Analysis
Computer search by L. Victor Allis has shown that on a 15x15 board, black wins with perfect play. This applies regardless of whether overlines are considered as wins, but it assumes that the rule of three and three is not used. It seems very likely that black wins on larger boards too. In any size of a board, freestyle gomoku is an mnk-game, and it is known that the second player does not win. With perfect play, either the first player wins or the result is a draw.
Generalized gomoku is PSPACE-complete.
The following recursive algorithm pseudocode shows how one may develop a winning strategy for the problem gomoku (in PSPACE – proof not given) – for player X. (This pseudocode is a variation of the popular minimax algorithm.)
Stop when step 1 hits a row of five X’s.
1: Assign X to a position, if X has won (there are five X's in a row) then we have a winning strategy and exit. If the board is full and no player has won, exit - there is no winning strategy.
a: Assign O to a position – if the board is full or there are five Os in a row X was obviously a bad position, go back to 1 and choose another position, otherwise run the program on the new positions – via recursion, if that fails choose another position X in step 1.
2: If no assignment in step 1 allows for a 'winning strategy' then there isn’t one – ie X will eventually los
[edit] See also
- Irensei
- Solved board games
- Go
- Connect6, a revised version of Gomoku
- Pente
[edit] External links
- Renju International Federation website
- A simple Java Applet example
- Open Source Gomoku in Java
- Tick5:an open source Gomoku game allows you to build your own AI
- The Gomoku programmers' tournament
[edit] Internet Servers
[edit] References
- L. Victor Allis, Searching for Solutions in Games and Artificial Intelligence, Ph.D. thesis, University of Limburg, The Netherlands, 1994 (ISBN 90-900748-8-0) [1].
- L. Victor Allis, H. J. van den Herik, M. P. H. Huntjens, Go-Moku and Threat-Space Search [2].
- Stefan Reisch, Gobang ist PSPACE-vollständig (Gomoku is PSPACE-complete). Acta Informatica, 13:5966, 1980.