Gomoku

Saved games stay in this browser only.

About the game

Gomoku is one of the oldest and simplest board games there is, and it is also one of the deepest. Two players, black and white, take turns putting a stone on an intersection of a 15 by 15 grid. The first to line up five stones in a row, horizontally, vertically or diagonally, wins. There is no capturing and nothing moves after it is placed, so everything lies in where you put the next stone. Black moves first and has a real advantage, which is why players treat a first-move win as a challenge for the second player to answer.

The game was written by Yao Yujian in 2012 as a hobby project, with jQuery Mobile for the interface, which is why it works equally well with a mouse and with a finger. The opponent is a negamax search with a cache, running in a Web Worker so that thinking never freezes the page. It has three levels, Novice, Medium and Expert, and you can choose to play as black or white, or to share the screen with another person.

The look is the original, a pale wood board with glossy stones that lift when you hover over a point. Here the wood is drawn with CSS gradients and the two faces that show a win or a loss are our own drawings.

Playing it here

Click Play. The New Game window opens first: choose Human or Computer, then your colour and the level, and press Start. Click an intersection to place a stone, and the status at the top left tells you whose turn it is. The last stone placed glows. When a line of five is completed, the game shows a face and asks if you want a new game. Undo, at the top right, takes back your last move and the computer's reply. About opens a short note about the game. Nothing is saved between visits.

Controls

Input Action
click or tap an intersection place a stone
New Game choose the opponent, your colour and the level, then Start
Undo take back your last move and the computer's reply
About short information about the game

A few things worth knowing

The centre is yours. Stones near the middle belong to more possible lines than stones at the edge, so open there.

Look for open threes. Three in a row with free points at both ends is a threat you must block at once. An open four cannot be stopped.

Make two threats at once. A move that creates two lines of three or four at the same time is how you beat the computer on the higher levels.

Credits and licence

Gomoku was created by Yao Yujian (yyjhao) and is released under the MIT licence; the licence text is linked from this page. It uses jQuery 1.8.2 and jQuery Mobile 1.2.0, both under the MIT licence. This version has been changed by FredyGames: the two libraries are served with the game instead of from a content delivery network, the wood textures and the win and loss pictures were replaced by CSS and our own drawings, and the links to other sites were taken out.