Sign in

For bot developers

If you develop a backgammon bot and would like it featured on bgbotarena, playing other engines in public rooms, email us at bots@bgbotarena.net. Tell us what it plays (money games, match lengths), its search settings, under what licence we may run it, and which of the ways below suits you.

Nothing about your bot goes public until you say so. While it is new it is visible only to you: you can check how it plays here (see below), and if you rent a room (coming soon), play it against any of the site's bots in a room only you can see.

How we wire a bot in

The arena's referee rolls the dice, generates the legal moves and checks every reply. It talks to each bot through a small line-based text protocol, BGAP: it sends a position, the bot answers with a move, a cube decision or a take decision. Every request carries the whole position, so a bot keeps no state between decisions. Each bot runs in its own Docker container, with networking disabled, pinned to the CPU cores its room gives each bot: one, or several, the same for both bots.

There are three ways to get there.

1. You send us a ready-made image

A Docker image that speaks BGAP itself. You stay in full control of how your bot reads positions. It must:

Test it with our test suite, then send it as a registry we can pull from, or as a docker save file. We pin the exact image, so a new version of your bot is a new image.

2. You send us a command-line program

A program that runs on Linux and answers backgammon decisions in its own format, for example a position ID in and a move out. We write the BGAP adapter and the image around it, with the help of an AI coding assistant (Claude). We need the program, a description of its input and output, and above all its conventions: how it reads the score, the cube and who owns it, the Crawford and Jacoby rules, and the bar. That is where wiring bugs hide.

We never run your program, or build it, on a machine that holds anything of ours: we wire it in on a disposable machine, set up afresh for each bot, and only the finished image comes from there to our server, where it goes through the same checks as a ready-made one.

3. You give us access to the source code

A repository, private if you prefer. We build your bot from a pinned commit and write the adapter, either linked against its API or driving its own interface, again with the help of Claude. Most bots on the site today were wired in this way, from their public sources.

With either of the last two, we send you the adapter's source on request, so you can see exactly how your bot is asked. Source code is wired in on a disposable machine too, the same way.

The sandbox

Every bot from a developer runs in this sandbox, and so do the open-source bots we wired in ourselves. It runs under gVisor, a kernel of its own rather than the server's, and can reach nothing but the referee:

docker run --runtime runsc --rm -i --init --network none --read-only --tmpfs /tmp:size=256m \
    --user 65534:65534 --env HOME=/tmp --cap-drop ALL --security-opt no-new-privileges \
    --memory 2g --memory-swap 2g --pids-limit 256 --cpuset-cpus N image

If your bot needs more memory, or to write somewhere other than /tmp, tell us; the test suite runs it exactly like this, so you will know before you send it. gVisor supports nearly everything Linux programs do; the test suite uses it if your Docker has it (installing it takes a minute on Linux) and warns you if not.

Testing your image

Our test suite checks an image the way we check it before any room can use it, so you can fix what fails before you send it. It runs on any machine with Docker:

curl -fsSL https://bgbotarena.net/downloads/bgap-test.tar.gz | docker load
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
    bgbotarena/bgap-test your/bot:1.0

It starts your image through your machine's Docker (hence the socket), exactly as our server does: networking off, pinned to one core. In order, it checks:

Add --quick for the protocol alone, in a minute or two. The full run takes a few minutes for a fast bot, and longer the slower its slowest settings are, since each one is timed. --opt NAME=VALUE chooses a setting for the matches and the checks. On a machine that isn't x86-64, such as an Apple Silicon Mac, your bot runs emulated and its times are slower than ours. When it passes, send us the image together with the output. The download's checksum is at bgap-test.tar.gz.sha256.

When our wiring is wrong

Like any software, the wiring we write between the arena and your bot can have bugs. Such a bug doesn't crash anything: your bot just plays worse than it really does, under your name, and the numbers look plausible. So we guard against it in two ways: checks that run automatically, and procedures we commit to follow.

Automatic checks

Every image, and every new version of it, goes through these before any room can use it:

The checks have limits. gnubg is the yardstick, not the truth, so they say nothing about how strong a bot is. And a bug that only matters in rare positions, or costs very little, can get through.

Our commitments

  1. New bots start private. A new bot, and every new version, is visible only to you until you decide otherwise.
  2. You check our wiring. Once it passes the automatic checks, we play a sample of matches on our setup and email you the match records, every move and cube decision, so you can compare them with what your bot plays at home.
  3. You decide when it goes public. We feature your bot, or a new version of it, only when you have told us its play is right.
  4. We look into every report. If you, or anyone, suspects that a bot here plays worse than it should, write to bots@bgbotarena.net. We investigate and tell you what we find.
  5. We correct the record. If our wiring turns out to be wrong, we stop new rooms with that version at once, stop its running rooms, and archive them with a notice of what was wrong, rather than delete them. We fix the wiring, add a case to the checks so that the same kind of bug is caught from then on, and send you the fixed version to verify before it plays in public again.