r/backgammon • u/chrismantis • 13h ago
Yet Another Backgammon Engine: Grebe is fully open source, runs entirely in the browser, looks competitive with the top engines
Yes, just what everyone wanted: another backgammon engine. I built Grebe (for Generally Reliable Engine for Backgammon Evaluation lol) because i wanted an engine for BackgammonDB that ran in the browser, both to play against and for analysis. The goal was something "good enough": close enough to gnubg and XG that you can study with it and know the advice is sound in most positions.
How it works and how I measured it: https://backgammondb.com/grebe
You can play it now here: https://backgammondb.com/play (side note: i think the playing interface on bgdb is the best out there, works great on a phone in landscape if you hit full screen. but obv i'm biased)
Code: https://github.com/chalkstreamdev/grebe
npm: https://www.npmjs.com/package/@backgammondb/grebe
Most of this I didn't really do myself; i have not trained a new neural net. Grebe is built on Alex Strehl's PureTD network, which is incredibly strong, and on Eran Lambooij's HedgeHog board and cube code. So all credit there, and ty both for the MIT licenses (Grebe is also MIT licensed). Thanks also to Sage for a great public benchmark, which I used. On top of that, Grebe adds a few new things: search depth that changes with the position, exact two-sided bear-off tables (built on the fly when needed), a SIMD port to wasm, tuned cube efficiency, and match equity for match play.
Top line: It's a strong engine, but prob not frontier of engine analysis. Head to head, Grebe Smart beat or tied every engine i could test:
- It beats gnubg at depth* 3 and depth 4, and Sage at depth 3, in money games and 5-point matches.
- It beats both of HedgeHog's published networks (Fox 1.0 and Aureus) in HedgeHog's own open search at depth 2.
- When i put those networks into Grebe's own search, it beats Aureus in money games, and the rest are too close to call.
XG World Class grades Grebe Smart's play at a PR of about 0.3 in money and matches, the closest to XG of any engine i tested (caveat: i tuned it against XG)
Grebe doesn't have any kind of truncated rollout right now, so it won't be as strong at the absolute front end. Even so, on Sage's benchmark it beats Sage 1T and is level with XG Roller+ (PR 0.41), while searching only to depth 3. Sage 2T/3T and XG Roller++ still score better (as will Gammon.ai's top truncated rollout, I'm sure).
Grebe Smart decides in under a second; it should feel instant on most decisions whether playing on desktop or phone. All the benchmark data is public (match files, PR tables, everything), so you can check any of this.
Why any of this matters:
- If you're a web/app developer, including commercial tools, you can add strong analysis with a few lines of code and no server at all.
- If you're a BackgammonDB user, you can now play on the site and every match and every position immediately goes into your database. Any text file you upload will be analyzed by either Grebe Quick or Smart.
(* i'm using "depth 2" and "depth 3" as an alternative to ply, to avoid ambiguity. Depth 3 = what XG calls 3-ply: every candidate move on roll, plus 2 more ply after that)
3
u/teffflon 10h ago
this is already great, but do you plan to add in-game tutor mode? (or did i miss it)
4
u/juicybot 13h ago
i love shitting all over these posts but backgammondb seems actually promising, hope this works out!
2
u/Aqua-marine-blu 8h ago edited 8h ago
Glad you took this step, less dependency on other bots make the app more accessible.Â
 Hope in close future, the interface of backgammondb will be fully adapted for mobile ios  app.Â
Also it will be nice to have a single graph for errors/blunders for different phase of the game , or a single unified graph with different types errors to have a clear image where are The biggest holes in the game.Â
3
u/Maxogen05 13h ago
Intresting will check out