Some of you have met the bots ZX Spectrum 48K and ZX Spectrum 128K here on OGS. They run an exact copy of a Go program I wrote for the ZX Spectrum, a home computer from 1982. Here are my developer’s notes on how it was made.
As a kid I had a ZX Spectrum, a British home computer from 1982 with a 3.5 MHz processor and 48 KB of memory, and I wrote my first games on it. This autumn I came back to it with a task that looked almost hopeless: teaching it to play Go.
Go is an ancient game from China: two players take turns placing black and white stones on the intersections of a grid, trying to surround more territory. The rules are simple, but for a long time computers struggled with it: a position offers hundreds of possible moves, not the three dozen of chess, and you can’t judge a position by counting pieces; it all comes down to a feel for shape. In chess, the Deep Blue computer beat world champion Garry Kasparov back in 1997; in Go, the AlphaGo program did not beat Lee Sedol, one of the strongest players in the world, until 2016. I chose the small 9x9 board: fewer possibilities, but the same game. As far as I could find out, my Go 9x9 is the first Go game for the Spectrum where you can play against the computer.
And by today’s standards the Spectrum is tiny. For scale:
- the Mac I made the game on has 48 GB of memory, a million times more than the Spectrum;
- the whole memory of the 48K Spectrum is smaller than the maximum size of a single animated Telegram sticker (64 KB), and the 128K model’s memory is just two such stickers;
- the Spectrum can’t even multiply two numbers in one instruction; the same program on one core of the Mac does 30 seconds of its thinking in about two thousandths of a second, 16,000 times faster, and the Mac has 12 cores;
- the KataGo neural network, one of the strongest Go programs, takes as much space as 1,800 Spectrums, even compressed.
A neural network would never fit into a Spectrum, so I decided the program could think the Monte Carlo way, like the best Go programs before neural networks: before each move, play many quick imaginary games to the end and choose the move that leads to victory most often. Measurements showed that the Spectrum manages only about six such games a second, about 150 in half a minute. So they had to be spent wisely, and the program had to keep thinking while the opponent thinks.
The main secret turned out to be not the search but intuition. Without hints about where to play, the program won fewer than one game in a hundred against the classic GNU Go; with hand-made hints, one in nine. Then I took 233,000 positions evaluated by that same neural network and distilled a feel for shape from them: about a thousand patterns in 4.4 KB. The program began winning half its games.
The second secret is the twin: an exact copy of the program in C that counts every clock cycle of the Z80 processor and thinks exactly as much as a real Spectrum, only those same 16,000 times faster. A thousand test games take about a minute, so I tested every idea over thousands of games.
In 1985 a new model came out, the ZX Spectrum 128K. Same processor, but 128 KB of memory, which has to be switched in 16 KB at a time. For it I made a separate version, Go 9x9 128K: the extra memory holds larger shape patterns, a search tree of 1,023 nodes instead of 700 and an opening library of 8,000 positions. And in the latest 48K version the quick games learned to play local shapes taken from the same neural network, which made it stronger without using a single extra byte.
There were dead ends too, and they may be the most interesting part. The program’s weak spot is big groups in open fights: random games can hardly tell whether a group is alive or dead. I built a life-and-death solver in the spirit of 1980s programs: it counted eyes, read out sequences and made fewer mistakes on test problems than the search. But it didn’t help in play: with its corrections the program played no better, sometimes worse. A small neural network squeezed into the Spectrum judged positions worse than a hundred random games. And quick games trained to handle liberty races got smarter but a quarter slower, and the program as a whole got weaker. The main lesson: at 3.5 MHz speed is strength; slowing down by 1% costs almost half a percent of wins, so knowledge has to come almost for free.
Today both versions play people on the OGS server, rated about 11 kyu (48K) and 7 kyu (128K). My Go teacher, Alexandre Dinerchtein, looked at the program and suggested it would have won the first computer Go championship, back in 1984. I checked: I ran Bruce Wilcox’s NEMESIS, the winner of that championship, in an emulator and set up a six-game match. The score: 6-0 to the Spectrum.
Play in your browser: Go 9x9 - ZX Spectrum release by lawlord, Original 2026 - ZX-Art (48K) and Go 9x9 128K - ZX Spectrum release, Original 2026 - ZX-Art (128K)
Download: Go 9x9 by LAWLORD
Play the bots on OGS: ZX Spectrum 48K (48K) and ZX Spectrum 128K (128K)
LAWLORD
P.S. Full disclosure: I made the program with the help of an AI coding assistant, and every idea was checked over thousands of test games.
