lør. 21. mars 2026 kl. 23:32 skrev Todd Doucet <[email protected]>: > I also have a neural net backgammon engine that I'd like to hook up to > play gnubg, and yes, it is frustrating that it seems to be no needlessly > difficult. I'll tell you the approach I am taking. >
Interesting. Neural net backgammon engines are really hot stuff! > I wrote a utility under Linux that uses the pty interface to run any REPL, > for example the gnubg command line shell, gnubg -t. It lets me play > interactively like normal, but also passes the output from gnubg to my > code for processing. (That code can also type stuff in for me into > gnubg.) The idea is that I parse the stuff gnubg emits, and when it is > asking for a play, my bot can happily provide it. (The pty code to do the > above is not too difficult, about 100 lines of C++.) > I have no experience parsing GNU Backgammons output to tty - but I do think Frank does in BGBlitz. Maybe he is willing to share some of his experience. > I wanted to avoid the undocumented and apparently-buggy "external > interface", for the additional reason that I want to "be fair" to gnubg, > i.e. I don't really trust it not to play differently or worse if I go > through an undocumented/buggy interface. > I spent a lot of time debugging - particularly annoying that GNU Backgammon's external interface and FIBS rawboard are slightly different. I think I managed to come through it and it made some sense in the end. I do understand that you might not want to go down that path. Okay, so I did the "hard" part with the ptys, and I can parse. But I see > now that gnubg seems to be particularly inconvenient in what it emits. I > think I'll have to parse a 2D board if I want to reliably see what it > thinks the board is. I can send it FIBS board specs, but I haven't found > any way to make gnubg emit fibs boards, or anything remotely convenient to > parse. Probably the path of least resistance for me is to just modify > gnubg so it outputs fibs boards that I can parse. (And I realize I might > be missing something here, but I don't feel I should apologize for not > having ingested the code base.) > This is not an easy path to take either... I think you can fetch the GNUBG ID at least? That must be possible to parse. I would not parse the 2D board. That will be a very very time consuming and error prone way of going. > That's my approach. It might be something you'd consider. Contact me if > you'd like the code I wrote for the pty stuff. > Sounds to me like the wrong approach. Are you able to hook up your engine to FIBS? That should be fairly simple. Then you can play your engine through a FIBS client and you can see how it scores against other players and bots. > It is a shame that gnubg is such poor infra for the backgammon community. > Everybody has to start from scratch with this 1990s thing. It plays > backgammon well. Everything else is sad. If only we had LiChess infra. > But we have this. > Yes! There is no standard communication protocol for backgammon (like the UCI in chess) yet. Everybody misses a standard like this, but no one has established a protocol yet. This is something that can be established at the next ICBGDC (International Computational Backgammon Developer Conference). -Øystein
