Quick navigation

Jump to any page

Docs

Documentation

How to write a bot, what the sandbox allows, and how matches and ratings work.

Getting started

Arbiter lets you submit a bot — a small program that reads the current board state and prints a move — and pits it automatically against other developers' bots. There's no manual play: once submitted, your bot plays its placement matches in the background and earns a rating.

  1. Pick a language: Python, C++, Rust, Go, or Java.
  2. Write a program that reads one line of JSON from stdin and prints one line of JSON ({"row": r, "col": c}) to stdout.
  3. Test it locally by piping a sample state into it (see Bot API below).
  4. Submit it on the Submit page — as a ZIP, pasted code, or a GitHub repo pinned to a commit.
  5. Watch your 5 placement matches run and your initial Elo rating get calculated.

Bot API

The protocol is deliberately minimal so it works in any language — there's no SDK to import. Each turn, your program is started fresh, receives one line of JSON on stdin, and must print one line of JSON on stdout and exit.

Input

stdin — one line per turn
{
  "game": "chain-reaction",
  "board": { "rows": 6, "cols": 8 },
  "cells": [[{ "owner": 0, "count": 0 }, ...], ...],   // cells[row][col]
  "you": 1,            // your player number (1 or 2)
  "opponent": 2,
  "turn": 5,           // 0-indexed turn counter
  "timeLimitMs": 3000  // time budget for this turn
}

Output

stdout — exactly one line
{ "row": 2, "col": 3 }

The target cell must be empty (owner: 0) or already yours. Debug prints are tolerated — only the last valid JSON line on stdout is read. No valid move in time, malformed output, an illegal cell, or a crash all forfeit the match.

Testing locally

shell
echo '{"game":"chain-reaction","board":{"rows":6,"cols":8},"cells":[[{"owner":0,"count":0}]],"you":1,"opponent":2,"turn":0,"timeLimitMs":3000}' | python3 bot.py

Because a fresh process runs every turn, bots can't keep in-memory state between turns — derive everything you need from the board each time.

Starter templates

A minimal greedy bot exists for every supported language in the repository, under services/execution-engine/examples/:

services/execution-engine
examples/
├── greedy_bot.py
├── greedy_bot.cpp
├── greedy_bot.rs
├── greedy_bot.go
└── Main.java

Examples

The Python starter bot — it plays the first legal cell it finds. A good baseline to beat:

greedy_bot.py
import sys, json

state = json.loads(sys.stdin.readline())
you = state["you"]
cells = state["cells"]

for r, row in enumerate(cells):
    for c, cell in enumerate(row):
        if cell["owner"] == 0 or cell["owner"] == you:
            print(json.dumps({"row": r, "col": c}))
            sys.exit(0)

Submission rules

  • Supported languages: Python, C++, Rust, Go, and Java.
  • ZIP uploads are capped at 25MB; pasted code at 200,000 characters.
  • You can upload a new version of a bot at any time; each version is validated and evaluated separately.
  • Attempting to escape the sandbox, probe the network, or exhaust shared resources gets an account suspended.

Sandbox limits

Every turn runs in an isolated container with no network access and a read-only filesystem (except a small /tmp scratch space). Compiled bots are compiled each turn, so compile time counts against the time limit.

RuntimeMemoryTime / turn
Python256MB3s
C++, Rust, Go, Java512MB15s

Output is capped at 1MB per turn for every language.

Rate limits

ScopeSubmissionsWindow
Per account101 hour
Per IP address201 hour
Per account201 day

Game rules — Chain Reaction

Played on a 6×8 grid. Players alternate placing an atom in an empty cell or a cell they already own. When a cell reaches critical mass it explodes, sending one atom to each orthogonal neighbor and capturing it — which can trigger cascading chain reactions.

Critical mass

Cell positionNeighborsExplodes at
Corner22
Edge33
Interior44

Winning & ratings

Once both players have moved, a player with no atoms left on the board is eliminated. If neither is eliminated within 120 turns, the player with more atoms wins (equal counts is a draw).

Ratings use Elo (K = 32), updated after every match.

FAQ

How are ratings calculated?
Elo with K = 32. A new bot plays 5 placement matches against the nearest-rated opponents, and its rating updates after each match.
Can I submit multiple bots?
Yes — there's no per-account bot limit, only the submission rate limits listed under Submission rules.
What happens if my bot crashes mid-match?
A crash, timeout, malformed output, or illegal move forfeits that match as a loss. Fix it and upload a new version.
How do I test before submitting?
Pipe a sample state JSON into your program and check it prints a valid move — see Testing locally under Bot API.