zxGammon

About zxGammon

zxGammon is backgammon for the 48K ZX Spectrum. You play against Gnubby, a little gnu with a neural-network player for a brain: money games, or matches to 1, 3, 5 or 7 points, with the doubling cube and the Crawford rule. It runs on a real Spectrum, in any Spectrum emulator, and on this site's front page.

How Gnubby plays

All of Gnubby's play is in Z80 code with no multiplication or division: 22 KB of code and data for the engine, the networks' weights among them, and the whole game about 31 KB.

The networks keep the sums of their first layer and add only the inputs a move changes. On a 3.5 MHz Spectrum a move takes Gnubby about seven seconds on average.

GNU Backgammon

zxGammon's play is derived from GNU Backgammon, the free backgammon program of the GNU Project, and owes it everything about how well Gnubby plays:

GNU Backgammon is free software, licensed under the GNU General Public License, and so is zxGammon.

Licence

zxGammon, Copyright © 2026 Paul Hankin.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

That covers the whole of this site: the game and its source, the networks' weights, its pictures, and the pages and Spectrum emulator here (js/z80.js, js/spectrum.js, js/main.js). The source is on the Source pages, ready to build with the open-source assembler sjasmplus.

While you look at the site's other pages, your game is kept where it was, in your browser tab's own storage, and goes when you close the tab or press Restart. Nothing is sent anywhere: the site has no server code, and the one cookie it sets only records that you have seen the notice on your first visit.

ZX Spectrum is a trademark of its owners; zxGammon is not connected with them. The emulator here needs no Spectrum ROM: zxGammon reads the keyboard and draws the screen itself.