Backgammon position ID converter

Paste a position from eXtreme Gammon (an XGID), from GNU Backgammon (its Position ID and Match ID) or from HedgeHog (an OGID) and get it in the other two formats, with the board drawn so you can check it came across the right way round. The conversion runs in your browser: nothing you paste is sent anywhere.

Read as a GNU Backgammon ID.

XGID (eXtreme Gammon)
GNU Backgammon ID (Position ID:Match ID)
OGID (HedgeHog)

The three formats

XGID is eXtreme Gammon's. After XGID= come 26 characters for the board, one per point and one for each bar, with a capital letter for the bottom player's checkers and a small one for the top player's (A is one checker, B two). Then, separated by colons: the cube as a power of two, who owns it, who is on roll, the dice, both scores, the Crawford flag, the match length and the largest cube allowed.

GNU Backgammon uses two keys. The 14-character Position ID is the board: each player's checkers counted from their own 1-point to their bar, player on roll last, packed into 80 bits. The 12-character Match ID is everything else: the cube and its owner, whose turn it is, the dice, the score, the match length, the Crawford game. GNU Backgammon prints both above its board and takes them back joined by a colon, as set gnubgid <Position ID>:<Match ID>. A Position ID on its own is read here as a money game with the cube in the middle and White to roll.

OGID is the open format HedgeHog stores every position in. Each checker is one character naming its point, so a position can be read and edited by hand, and the cube, dice, side to move, score and match length follow in their own fields. It is specified in full and free to implement.

What does not carry across

The Jacoby rule. An XGID of a money game carries it in the Crawford field, and a GNU Backgammon Match ID has a bit for it, but an OGID has no field for it, so it is dropped. The IDs this page writes declare it off. Check the rule in your own program after converting a money position.

A double on the table. The formats disagree on whose turn it is while a double waits for an answer. An XGID names the doubler as on roll and puts D in the dice field. GNU Backgammon keeps the doubler's Position ID and moves only the turn in the Match ID. An OGID names the player who has to take or pass. The converter translates each into the others, so a take or pass problem arrives with the same player facing it. GNU Backgammon prints an ID while a double is on offer but will not load one, so to set up a take or pass there, load the position before the double and double from it.

The rest. An XGID's largest-cube field is written as XG's default, and GNU Backgammon's record of a resignation on offer is not kept, since neither changes the position.

Using a position in HedgeHog

Press Ctrl+C on any HedgeHog board and the position's OGID is copied. Paste an XGID, an OGID or a GNU Backgammon ID with its Match ID anywhere in the app and it opens in Study, where you can edit it and ask the engine. Analyse this position above opens a page with the engine's verdict and an image of the board to put in a forum post or a lesson, linked back to that page. To look at every decision of a whole match instead, import it for analysis.