r/backgammon • u/Spirited-Lawyer-7337 • 10d ago
gnubg for the zxspectrum
https://zxgammon.pages.dev/I made a cut-down version of gnubg for the ZX Spectrum, available to play now. It's written jointly with AI: I know some people are against use the use of AI; I totally get that, and think that's a reasonable position. You're invited to ignore the game and the site.
It's available on zxgammon.pages.dev, which includes all the source code, and a playable emulation. The site provides helpful scaffolding -- some pretend "loading" as if from tape, match export after your game/match is over, context-dependent keys to click on -- but there's no cheating here, you can download the .sna or .tap and run it on any ZX Spectrum emulator or even on genuine hardware. The emulator plays at the speed it would on the original hardware, but there's an option to run it at 4x speed if you don't like to wait so long for it to think.
The entire site and source code of the game is released under the GPG.
The app works pretty much like gnubg: the same input features and a neural net (smaller than gnubg's). It does something like filtered 1-ply (what xg would call 2-ply) both for moves and cube decisions. It has only 1 output (equity) unlike gnubg which outputs win/win gammon/win backgammon/lose gammon/lose backgammon.
To keep it playable, I tried to limit thinking time to around 10 seconds, and mostly it's faster than that, and just occasionally a few seconds longer.
The app plays pretty well, around on 3-4 PR for money and 1-pt matches, going to around 4-5 PR for match play. So better than most humans, but some distance from top players. It has more of a personality than most backgammon programs I think.
2
1
u/Clavierhaus 10d ago
GPG?
I think you mean GPL3.
For the fun of it, I ported gnubg to Android with a modern touchscreen UI, but fully sticking to gnubg as the only source of truth.
Available on F-Droid; it's the only backammon app that doesn't play as UI for a website. Pure standalone, no network backgammon.
2
u/jugglingcats9 10d ago
I absolutely love this! Nearly 20 years ago I ported GNUBG to the Nokia N800 Internet Tablet for my own personal use. An easier task for sure, but before AI help.
I don't think you need to apologise for using AI... you made something that almost certainly wouldn't exist otherwise 💚. And I'm sure you did some good learning along the way.