What this game is
Noughts and crosses grown to adult size. A 15×15 board, five in a row to win — and suddenly the game has depth.
Draws are rare on a board this size as long as somebody attacks: there is room for everybody, and such a game almost always ends with somebody completing a five. Two players who only ever block can fill the whole board instead. Threats decide everything. A three with both ends free already demands an immediate answer, and a move that creates two such threats at once usually ends the game, because only one of them can be blocked.
Hence the characteristic feeling of gomoku: you spend most of the game answering the other side's threats, and the winner is whoever first manages to answer in a way that creates a threat of his own.
Rules
- The board is 15×15. You play the blue noughts and move first, the computer plays the red crosses.
- A move places your mark on any empty cell. Marks never move, are never removed and never change sides.
- The winner is the first to build an unbroken row of five of his own marks — horizontally, vertically or along either diagonal.
- These are free-style rules: a row of six or more wins as well, since it contains a five inside it.
- There are no restrictions on the first player: forks, double fours and overlines are legal for both sides.
- The winning row is struck through with a cyan line, so you can see exactly where it came together.
- If the board fills up and neither side has a five, the game is a draw. A draw is not added to the tally below the board.
How to play better
- Learn one shape — the open three: three in a row with both ends free. It cannot be left unanswered, because next move it becomes an open four, and an open four cannot be blocked at all: it has two winning points at once.
- A closed three, with one end running into an enemy mark or the edge of the board, is not yet a threat. Do not spend a move on it while something else is burning.
- Games are won with forks, not with rows: one mark that creates two threats at the same time — two open threes, or a four plus a three. Your opponent can only answer one of them.
- Which means you should not defend one line at a time either. Watch the intersections: a cell where two of your opponent's lines cross is more dangerous than the end of a single long one.
- Play tight. A mark placed far away from everything builds nothing and prevents nothing — nearly every strong move touches marks that are already on the board.
- When you block, block on the side where you are also building something. A move that only defends hands over the initiative, and in gomoku the initiative is the game.
A bit of history
Row-building games are very old in East Asia. The Japanese name for gomoku — gomoku narabe, 五目並べ, literally "five stones lined up" — was already in common use in the Edo period. In Korea the same game is called omok.
Japanese players long suspected that with accurate play the first move settles everything. In the early 1990s Victor Allis proved it by computer search: free-style gomoku on a 15×15 board is a win for the player who moves first.
That is why the tournament variant, renju, restricts the first player specifically: certain shapes are forbidden to him, such as a double three or a row longer than five, while the second player has no restrictions at all. Here the rules are the plain free-style ones — and you move first, so the theoretical advantage is yours. Converting it is another matter.
This version follows the Gomoku applet that ran on this site from 2005. The marks are drawn deliberately crooked, with a thick pen and a slight tilt, the way the original had them: four different noughts and four different crosses, so that neighbouring marks never look stamped from the same die.
About the levels
Easy looks exactly one move ahead. It scores every empty cell near the existing marks by what it would build for itself and what it would take away from you, weighting your shapes slightly higher — which is why it blocks your open three instead of building its own. It will take a five and block a five, and an open four of its own comes before blocking your open three, since it wins first. But it never calculates your reply: a fork prepared two moves in advance is invisible to it and it walks calmly into it.
Hard checks the obvious first: it takes its own five and blocks yours. After that comes a four-ply search with alpha-beta pruning, cut off after four tenths of a second, though a move normally takes a few hundredths. It evaluates the whole board: every line is scanned with a six-cell window whose value comes from a precomputed table. Its blind spots: at each node it only examines the ten best-looking cells, so a fork that starts on the eleventh does not exist for it; and it has no special rule against an open four, so it can let one happen.
Expert deals with threats first and calculates second. It takes its own five, blocks yours, and plays its own open four immediately since nothing can stop one. If it is you who threatens an open four, it restricts itself to moves that either take that point away or answer with a four of its own — nothing else is worth playing. In a quiet position it deepens gradually: two plies, four, six, as far as it gets within seven tenths of a second, and an unfinished pass is thrown away entirely rather than trusted. The limits are the same as before: a dozen or so candidates per move, and cells more than two steps away from any existing mark are never considered — a genuinely distant move lies outside its world.