Gomoku applet (Luffarschack)

The rules of Gomoku are simple. You click a square to make a nought in it, and then the computer makes a cross in another square. This continues until you or the computer get five in a row horisontally, vertically or diagonally.

There are lots of applets out there to play Gomoku but this has a twist in that you can design your own strategy for the computer moves! The algorithm to compute a move is numeric and very simply adjusted with a few parameters that you can set.

Loosely speaking the computer considers all possible sets of five squares in a row on the board. During a game such a set of five squares is a potential win if it only has markings of one kind. For example, if there are only crosses and free squares among the five this is a potential win for the crosses. But if there are both crosses and noughts among the five then this set of squares can never be a win for anyone.

A potential win is said to be of degree n if it has n marked squares (here n ranges from 0 to 4). So for example a set of five squares in a row out of which three are crosses and two are free is a potential win of degree 3 for the crosses.

At the top of the board you can fill in how much the computer should value a potential win of degree n in relation to a potential win of degree 0 (five vacant squares). Increasing the lower degree potentials will mean that the computer takes comparatively more account of short rows of naughts and crosses. Increasing the aggressiveness factor means it takes more account of its own possibilities and less account of stopping your possibilities. (Setting this to zero means it exclusively focuses on stopping you).

You enter the parameters in the fields above as floating point numbers. If you enter something that is not a number the field will reset to its default value. Remember to press return in the field for the change to take effect. You can change parameters also when a game is in progress.

Have fun!

Joachim Parrow 2003