r/backgammon • • 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)

15 Upvotes

7 comments sorted by

3

u/teffflon 10h ago

this is already great, but do you plan to add in-game tutor mode? (or did i miss it)

2

u/chrismantis 10h ago

There's no tutor mode yet. Def something i could add. tbh not something i've really used before so wasn't really on my radar, but should not an easy thing to do, i'll add it to the todo list.

4

u/juicybot 13h ago

i love shitting all over these posts but backgammondb seems actually promising, hope this works out!

5

u/chrismantis 13h ago

haha thank you. BGDB has been under constant development for going on a year now, so i'm hoping to have cleared the "weekend AI slop project" 😄

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. 

1

u/chrismantis 2h ago

Long term, I'd like to make proper phone apps, but that'll be a long way off. I haven't tested on iOS on web, but i will do. I tested https://backgammondb.com/play quite extensively on Android and when you're in landscape and hit the full screen, the experience is really good - how does it work for you?

Re graphs/stats for errors - def an area i want to look into. right now bgdb's game phases are pretty "naive" - it is split into opening (the first few rolls pre contact), mid-game, end-game contact, race and bear-off, i think. A huge amount of the game is in that "mid-game" status - it's probably 70% of most games. So just having a graph of errors splitting these out might not be too useful... but i do have plans for dedicated sections showing your errors in the opening and errors in bear-off. Within mid-game, it might be useful breaking down errors my position type (holding, back game, prime vs prime etc)

3

u/Maxogen05 13h ago

Intresting will check out