Gomoku is won with a fork: one stone that makes two threats at once — two open threes, or a four and a three — because only one of them can be blocked. To get there you need the initiative: in simulation, a player who blocks only real threats and otherwise builds his own line beats Easy here in 74% of games, while a player who blocks first, the way Easy itself plays, wins 5% and draws 91%. Easy and Hard always answer the same position the same way, so a fixed list of moves beats them every time: seven moves against Easy, which is the minimum, and nine against Hard.
Everything in Gomoku is measured by one question: how many more stones does this row need to become five, and how many points can stop it? Four shapes cover nearly every decision.
All three computer levels here know these shapes. In test positions each of them blocked an open three at one end, took the gap of a split three and blocked a four. None of them can be beaten by a single row; what beats them is two rows at once.
The rules here are free-style: a row of six or more also wins, and neither side has forbidden moves. That is how the code works, not just what the rules page says — a win is any unbroken row of five or longer.
A fork is a stone that makes two of those threats together. There are three kinds, and they differ in speed:
Here is a 3-3 against Hard, from the winning line given below. One of the two threes has a gap in it, which makes the fork point harder to see — for a person and for a program.
The gap matters most against Easy. Easy scores a point by the unbroken row a stone would make there, so a three with a hole in it is invisible to it until the hole is the only thing left. When two unbroken lines of yours cross on an empty point, Easy takes that point; when one of them has a gap, it does not see the fork coming.
In renju, the tournament form of the game, the first player is not allowed to play 3-3 or 4-4 at all. Here both are legal, and you are the first player: the fork is your main weapon, not a trick.
The most expensive habit in Gomoku is answering everything. We tested it directly, playing against Easy with the rule Easy itself uses — score every point by what it builds for you and what it takes from the opponent, with blocking weighted slightly higher. That player won 4.6% of 3,000 games, lost 4.3% and drew 91%: the board simply filled up.
Turn the priorities around — block only a real threat, otherwise extend your own best line — and the same Easy loses most of the time:
A real threat is short to list: a four, an open three (split or not), and an empty point where two of the opponent's lines would become threats together. A closed three is not one. Two stones in a row are not one. Every move spent on those is a move in which your own position did not grow.
Easy has one more weakness worth knowing. It values blocking your open three slightly above making its own open four. In a test position where both sides had an open three and it was the computer's move, Easy blocked instead of winning; Hard and Expert played the open four. So against Easy every three or four you make buys a move, even when the computer is about to win.
Draws are rare between attacking players, but not in general. Easy against a copy of itself drew 84% of 2,000 games, with the board filled to the last point, and Hard against Hard drew 30% of 1,000.
With free-style rules on a 15×15 board the first player wins with perfect play: this was proved by computer search in the early 1990s (Victor Allis and colleagues). That is a known result, not ours, and nobody plays perfectly — but the advantage is visible in ordinary games too.
We let each level play itself, with the first two stones placed at random near the centre. Hard against Hard: the first player won 47% of 1,000 games and the second 23%, the rest were draws. Expert against Expert, held to four moves of lookahead: 69% against 20% in 500 games. Of the games that somebody won, the first player took two out of three at Hard's strength and nearly four out of five at Expert's. Here the first move is always yours.
Start in the middle. There are 572 different places for a five on this board. Any point of the central 7×7 square lies on 20 of them; a point in the middle of an edge lies on 8, and a corner on 3. A stone near the edge has fewer rows to grow into, and the edge itself acts as a block on every line that reaches it.
From the second move on, play close. The computer never considers a point more than two steps away from every stone on the board, and it has no reason to: a stone that touches nothing builds nothing.
Here is how simple ways of choosing a move do against each level. You play blue and move first; the first stone goes in the centre, the second at random within two points of it, and ties between equally good moves are broken at random.
| Your rule | vs Easy | vs Hard | vs Expert* |
|---|---|---|---|
| A random point next to a stone | 0% | 0% | 0% |
| Block first, as Easy does (its own scoring rule) | 5% | 15% | 4% |
| Extend your best line; block only a four | 56% | 1.5% | 0% |
| …and block open threes, play your own open four | 65% | 18% | 19% |
| …and play forks, counting gaps; take the computer's fork point | 74% | 36% | 35% |
* Expert is limited by time and searches two, four or six moves deep depending on the device. The Expert column was simulated at a fixed depth of four. At the full depth of six the last rule won 26% of 200 games. The block-first rule mostly draws: 91% of games against Easy, 34% against Hard, 32% against Expert.
Easy and Hard involve no chance: the same position always gets the same reply. So a game that beats them once beats them every time. Points are named like squares on a chessboard, letters a–o from left to right and rows 1–15 from the top (the game itself shows no labels); the centre is h8.
Easy, in seven moves. Play h8, e9, f10, e10, e11, g9, d12. The computer answers g7, h7, d8, d10, e8, i7. Your fifth move, e11, makes two threes at once — the column e9–e10–e11 and the diagonal h8, gap, f10, e11. Easy blocks the column, g9 fills the gap into an open four, and d12 completes the five. No shorter win exists: we checked every game of six moves or fewer from every first move, 16.4 million positions.
Hard, in nine moves. Play h8, h6, i8, g9, h9, h7, j9, i9, k9. Hard answers g7, h5, g8, i7, j7, h10, g6, f9. The seventh move, j9, is the fork shown above; i9 makes the open four, and k9 wins. This is the shortest line we found, not a proven minimum.
Expert depends on the speed of your device, so no line is guaranteed. On a fast computer, where it finishes its full six-move search, it is just as predictable, and this line won every time we replayed it: h8, g5, g6, i5, f7, h4, i6, d7, i7, i2, j6, k5, g9, with Expert answering h6, f6, g7, f5, h5, g4, e6, i3, h3, i8, g3, l4. If its first reply to h8 is g7 rather than h6, your device is cutting the search short and the line will not hold. Then play by the rules below: the last rule in the table won about a third of its games against Expert, and the games it won took 23 moves on average.
Against Easy, rules 1 and 6 alone win 56% of games, rule 3 raises that to 65% and rules 4 and 5 to 74%. Against Hard the same steps give 1.5%, 18% and 36%.
With a fork: one stone that makes two threats at once, such as two open threes or a four and a three. Only one can be blocked. Until you have one, block only real threats — a four, an open three, a point where the opponent could fork — and spend every other move on your own line.
The centre. On a 15×15 board there are 572 places for a five; a point in the central 7×7 square lies on 20 of them, a point in the middle of an edge on 8 and a corner on 3.
With perfect play, yes: free-style Gomoku on a 15×15 board was proved a first-player win by computer search in the early 1990s. In our simulations of the computer playing itself, the first player won 47% of games to the second player's 23% at the Hard level. In this game you always move first.
In free-style Gomoku, which is what this game plays, yes: 3-3, 4-4 and rows longer than five are legal for both sides. In renju, the tournament variant, they are forbidden to the first player.
Here it does. The rules are free-style, so any unbroken row of five or more wins. Some rule sets (standard Gomoku, renju for the first player) do not count a row of six.
Yes. Easy and Hard here are fully predictable, and fixed lines beat them every time: seven moves against Easy (h8, e9, f10, e10, e11, g9, d12), which is the shortest possible, and nine against Hard (h8, h6, i8, g9, h9, h7, j9, i9, k9). Expert is stronger and depends on the speed of your device; simple attacking rules win about a third of games against it.
Attack, and defend only against real threats. Against the Easy computer here, a player who blocks first won 5% of simulated games and drew 91%; a player who builds his own line and blocks only fours, open threes and fork points won 74%.