The game in one minute
Two teams draft champions, farm monster camps for gems and carry the gems to an altar. A gem counts only once it is handed in there.
What each champion has to work with
| The rule | |
|---|---|
| Sight | 8 tiles, not shared with its allies |
| Brain | its own copy of the team's program, 100,000 instructions a turn |
| Talk | 8 bytes shared with the team, plus 1,024 the draft writes once |
| Death | its gems go to the killer; it comes back 60 rounds later |
| Gold | buys stat shards (five make an emblem) and items such as a teleport crystal |
The final bot spends its 8 shared bytes on six claims (“I am farming this group”) and the team’s carried gems.
Every turn is one chain of decisions
A turn walks the same priority chain and stops at the first decision that acts. The bot logs a letter for where it stopped, so an agent can count a game’s turns by what they did.
- Spawnshop, heal · H
- Channelkeep a tribute or recall · T R
- Altar contestL
- Fight or step backthe race, then the net · X
- TacticF
- BankB
- FarmK C Y S J W
The chain in the code
// What the turn does with what it read: shop, channel, fight, step back,
// walk home, bank or farm, then the turn's end.
void respond(Turn& t, const cambc::champion& me, const model::Rules& r, Worth worth) {
…
if (tributes) {
trace('T'); …
} else if (steps || lost) {
trace('X'); …
} else if (engages) {
trace('F');
fight();
} else if (walks_home) {
trace('R'); …
} else if (… (lock_at = act::contested(me, t, true))) {
act::contest(me, t, *lock_at);
trace('L');
} else {
…
Every decision shows its reasoning
My first bot ran on tuned constants nobody could explain. For the rebuild I wanted every value derived, so an agent changing a decision could argue from the game’s rules instead of guessing.
“It hides our understanding of the game.”
When to carry the gems home, derived
The same decision, as the bot states it
// DECISION bank // decides: the bag at which this body goes to tribute. // belief: the bag that minimises the cost a gem of the altar trip plus the gems // a death would swing is B* = sqrt(D v g / p): D the walk the trip adds, v what // this body earns a round in gems and gold (the trip's cost), g the gems it gains // a round (how fast the bag fills), p its death hazard. // derivation: a trip costs D v over a bag B, D v / B a gem; carrying holds B / 2 // on average for B / g rounds, and a death hands the whole bag to the killer: our // loss and their gain, 2 p (B / 2) (B / g) / B = p B / g a gem. The sum is least // at B*. … // evidence: deaths cascade: ours a thousand body-rounds were 5.7 with two or more // fewer alive than theirs, 4.0 one fewer, 2.0 even, 2.5 ahead … // tried: every bag banked while they had more alive: -2.60 points; no bag setting // out while down too: -3.75 … // v50: macro.cpp:849 (should_bank): a bag of bank_gems (55, tuned) goes; … // test: bots/model/test/run bank
Every quantity has a unit, every number a source
Every quantity is a typed unit, so an agent that adds gems to gold gets a compile error, not a quiet bug. Every number says where it comes from: a rule of the game, a measurement on named games, or a tuned parameter.
Gems plus gold does not compile
// … a value in the wrong unit fails to compile, and the // types compile away (the same wasm as plain numbers) using GemCount = quantity<gem, int>; … using GemRate = quantity<gem / rd, float>; // gems a round … using Hazard = quantity<one / rd, float>; // the chance a round … using Worth = quantity<gem / gold, float>;
Each number names its source
inline constexpr auto kCrystalRange = rule(Tiles{3 * tile},
"GameRules, Ways to move: teleport crystals reach up to 3 tiles");
…
PARAM(hazard_mean, Hazard, Hazard{0.00169f / rd}, measured,
"900 games against v5, v10, v20, 5 Nov")
…
PARAM(seen_ratio, float, 2.4f, tuned,
"tools/tune r9, round 65: SPSA against top and squad …")
So each change can cite the games behind it. 24 of the 32 free parameters were still set by a tuning search; the other 8 are measured. Every open-ended loop sits behind one of 146 fuel guards, so a proof can show no turn runs out of compute.
Small learned parts, inside the rules
Almost everything is a formula derived by hand. Four small computed parts sit inside the chain, and a fifth was built and never switched on.
| Part | What it does | In the turn |
|---|---|---|
| Fight race | simulates side against side, each focusing the body it kills soonest | every fight |
| Fight network | 817 weights giving each body's chance to die within 10 rounds, trained on the field's games; it overturns a race the rules read as lost | every fight; +7.54 league Elo |
| Tactic | scores this body's plans for one turn: damage dealt minus the worst it can take back | every fight |
| Draft search | minimax over every team still open, against every enemy reply, on a model of 42 map features fitted to our own games | every pick |
| Forward model | the whole engine simulated call by call: 0.60% of windows wrong at 3 rounds | never called |
The draft shows the change best: a tuned order of picks became a search.
My first bot: a tuned order of picks
CM_PARAM(draft_pri_vesper_vale, float, 11.603657f, …) CM_PARAM(draft_pri_marcella, float, 6.355882f, …) CM_PARAM(draft_pri_vendetta, float, 10.011029f, …) CM_PARAM(draft_pri_tavi, float, 8.355385f, …) …
The final bot: a search over a fitted model
// DECISION draft // decides: the composition to draft, and the pick // toward it this draft turn: a search over every // composition left to us against every reply the // enemy can still draft (draft_search). // belief: … the composition drafted is the one // whose worst reply leaves it the most.
The first bot against the final one
v50, my first bot, led from 25 Oct to 7 Nov. The final bot was rebuilt from scratch, yet its turn has the same shape. What changed is where the numbers come from.
- v50, 25 Oct
- The final bot, 12 Nov
What paid
Two judges measured each change. The gate plays paired games against our own live version, in points of win rate; the league plays a set of sparring bots, in Elo.
Changes that were kept
| Change | Date | Judge | Gain |
|---|---|---|---|
| Copy the free recall | 7 Nov | gate | +4.71 points |
| Count the gold Marcella's tribute earns | 9 Nov | gate | +5.35 points |
| Cut the fight search's fuel | 9 Nov | gate, converted to field Elo | +13.6 Elo |
| Learned fight value | 10 Nov | league, top 3 | +7.54 Elo |
| Cast ready shields and spells right | 11 Nov | league, top 3 | +5.68 Elo |
| Draft the Prism only on rich maps | 11 Nov | held-out bots | +4.89 Elo |
| Price a teleport crystal by rounds saved | 12 Nov | league | +8.53 Elo |
| Capture timing package (v139) | 12 Nov | league | +8.35 Elo |
Games won against the top three, in public games
From 10 Nov each upload came from a numbered release (R2 is the second). Against the top three the bot went from 2.9% of games won to about a fifth, and stayed behind them in fights.