VOGONS


UGomoku

Topic actions

First post, by orac81

User metadata
Rank Newbie
Rank
Newbie

UGomoku is a version of the classic 5-in-a-line game. Each player takes turns to place pieces on a 19x19 "go" board, with the first player to get a line of 5 wins.

The attachment ugomoku-latest.zip is no longer available

https://github.com/orac81/miniapples/raw/refs … moku-latest.zip

The attachment ugomoku10-c64.png is no longer available

It was originally written for the PET in 1981, and a version appeared on Commodore Disk User, Nov 1990.

Commands:
g : computer move
a : auto play
e : edit square
x : exit
to move, use cursor (or keys jkol) then enter.

Despite being written in Basic, it performs fairly well when compiled, and seems a bit stronger/faster than other simple GOMOKU basic programs of this type.

This program is an example for the UBL Universal Basic Library.

GOMOK10Q.EXE Compiled QuickBasic 4.5 MSDOS version.
ugomoku10-c64.prg Compiled C64 verison.
ugomoku10-p4.prg Compiled Plus4 verison.
ugomoku10-v20.prg Compiled Vic20 verison.
ugomoku10-bas.prg CBM Source code, will run on all CBM (load ,8)

Note the basic version should be loaded with ",8" not ",8,1". The UBL folder has the Universal Basic Library with full source for versions for different computers, and further documentation on UBL.

By using the right UBL library this program should run on:

Commodore 8bits (C64, C16, VIC20, PET), DOS QBasic/BasicA, Apple2, Dragon32, BBC, ZX-Spectrum, Amstrad CPC, MSX, TRS80, Exidy Sorcerer and Ohio Superboard. (but tweaks may be needed!)

Some extra notes on the program code:
The search scans the squares and evaluates how many lines of 2,3,4,5 stones each move makes, and also how many open ends each line has, so if both ends are open, a line of 4 is a win, whereas if both ends are blocked, it has no value. It also evaluates how many oppenent lines are blocked by a move, ie preventing your opponent making lines of 3,4,5. To speed up the search only squares adjacent to existing pieces are looked at. Some programs just scan the whole board, which is slow. Despite the simplicity of this 1 ply search, it plays fairly well, and will catch you out if careless. But its definitely beatable!
When the Basic code is compiled, it plays at a reasonable speed.

Released as free software under the GNU GPL3 License.

https://github.com/orac81