Skip to content
Thomas Fairhurst
Chapters

Cambridge Battlecode 2026 · 22 Oct to 13 Nov

Claudus Maximus

My first coding competition. Solo. I never opened an IDE: AI agents wrote every line.

#7of 831 teams worldwide
#2in the UK, of 195
#6among students, of 714
#1solo student team

The competition

What is Battlecode?

Battlecode is a programming competition that began at MIT. Each team writes a bot: a program that plays a strategy game by itself against other teams’ bots. In this season’s game, two teams of champions gather gems from monster camps and carry them home. Once a game starts, nobody touches it.

Cambridge Battlecode is the edition run by students in Cambridge. This autumn, 831 teams from around the world played each other on a ranked ladder, and 16 student teams qualified for the final at the Cambridge Union.

£18,000in prizes, about $23,800
16finalist teams: 8 from the UK and 8 flying in from abroad
3 nightsin Cambridge as the organisers’ guests, after an evening at Hudson River Trading in London

Sponsors of Cambridge Battlecode 2026

  • Hudson River Trading
  • Citadel and Citadel Securities
  • G-Research
  • Jane Street
  • QRT
  • Pragma
  • QuantCo
  • Anthropic
  • Hacktron AI
  • Pareto

I entered alone and qualified as one of the eight UK teams. I didn’t write my bot, Claudus Maximus: AI agents wrote all 26,880 lines of it. My job was the system around them: what they worked on, how they tested an idea, and what counted as proof that a change was better. The ladder scored that system against hundreds of teams, and it doesn’t care who wrote the code. This post shows how it worked.

The climb

From #347 to #7 in 22 days

#2 in four days with a first bot. Then I rebuilt it from first principles, and climbed again.

  1. 1Hill-climb, v1 to v50
  2. 2Learned-bot experiment
  3. 3Proofs and plans
  4. 4New bot, coordinator loop
  5. 5Director and bets
  6. 6One lost game at a time
Go deeper

Scale

By the numbers

23days
19,553commits
7,720agent threads
4,503messages I typed, mostly by voice
138versions live on the ladder
0 sspent in an IDE

The machine

A machine that runs without me

My agents lived on a remote server, so work never stopped when my laptop closed. A gateway spread them over 7 Claude subscriptions, and games ran on Imperial's clusters.

1meby voice, from my phone or laptop
73agents at onceT3 Code on a 16-thread server
1,906games a secondeach run on freshly generated maps
7release checksstatistical tests and proofs
138uploadsto the live ladder

50,000 scrim games and the field's public replays flowed back to the agents.

Go deeper

Speed

Faster loops came first

Before improving the bot, I had agents speed up their own tools, each result checked against the slower original.

Map generator7.93 s → 0.147 s a map
54×
Fuel proof64 s → 2.6 s, on v50, Python to C++
25×
Cluster throughput80 → 1,906 games a second
24×
Game engine2.49 → 0.16 CPU-seconds a game
15×
Waiting on a proof137 s → 45 s
3×
Bot rebuild13.6 s → 8.8 s
1.5×

Games a second on the cluster

  • Amap making became the bottleneck, so it was ported to C++
  • Ba silent fallback to the slow engine, found and removed
Go deeper

Orchestration

Nine ways to organise agents

I iterated on the organisation as much as on the bot: each design was measured, then replaced. The larger dot is the orchestrator.

22–25 OctWaves of 14 agents

one orchestrator, a gate decides

39uploads
25–31 OctA learned bot

reinforcement learning on GPUs; rules won

0uploads
31 Oct–4 NovProofs and reviews

a formal plan; too slow, deleted

0uploads
5–6 Nov30 loss readers

coordinator writes every fix

0uploads
7–9 NovFix agents behind a gate

one lost game each, auto-upload

73uploads
9–10 NovDirector, leads, workers

three levels, 14 leads

3uploads
10 NovOne agent

with a few helpers, then alone

14uploads
11–12 NovBets

85 opened, 9 kept

9uploads
12–13 NovOne lost game at a time

replay it until it is won

0uploads

Agent threads started a day

Go deeper

The human

What I actually did

I set the goal, asked why, watched games and deleted things. I never opened an IDE.

Up to 18 ha day, mostly talking to agents by voice
61%of my messages were questions
498messages on my busiest day

Messages I typed a day

“I want you to be extremely ambitious.”
22 Oct, my first prompt
“Every single loss is a bug.”
6 Nov
“Nothing is impossible. Every limit is an assumption: find it from first principles and break it.”
27 Oct, my charter for the agents
“The gate and having a fast feedback loop is the number one priority in an agentic workflow.”
11 Nov
Go deeper

Maps

Fake maps, judged by AI

128 official maps were too few to test on. So I had a generator learn their design rules, then set AI judges against it: every tell they found became a new statistic to pass.

  • Generate maps
  • Compare map statistics
  • LLM judges spot the fakes
  • Their tells become statistics

AI judges telling real from generated (50% is chance)

A detector trained to spot my maps (2 is chance)

Go deeper

Judging

I measured my own test, and replaced it

Every change had to pass a statistical test against my previous version. I checked that test against the real ladder, found it overstating gains, and replaced it with a league of sparring bots.

Elo my test claimed, over 27 hours
+272
Elo measured on the ladder± 48
+55

The league that replaced it: calls the ladder agreed with

Farming, fuel, tempo45 of 52
87%
Draft6 of 6
100%
Fights and teamwork9 of 16: still no reliable judge
56%

Six test designs in three weeks

  • Sequential test
  • Confidence sequence
  • Betting test
  • Paired runs on the same maps
  • Only games that flip count
  • League of sparring bots
Go deeper

The bot

Code written to be reasoned about

26,880 lines of C++ and 62 decisions a turn. I had agents write each one from first principles: what it decides, the belief behind it, the derivation and the games that showed it.

  • Heal
  • Keep channel
  • Contest altar
  • Fight817-weight net
  • Tactic
  • Bank
  • Farm

One decision’s header, from the bot

// 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) …
// 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
//   (b9bc36279 against v50, 32 lost games).
// tried: every bag banked while they had more alive: -2.60 points; no bag setting
//   out while down too: -3.75 (2,000 maps paired with b9bc36279). …
// v50: macro.cpp:849 (should_bank): a bag of bank_gems (55, tuned) goes; … Its
//   reason: fixed thresholds tuned on games, with exceptions for the cases they lost.
…
// test: bots/model/test/run bank
55 gemswhen my first bot banked: a tuned constant
√(D · v · g ÷ p)when the final bot banks: trip length × earnings × fill rate ÷ death risk
  • Game rule or measurement
  • Belief
  • Derivation
  • Decision
  • Test
  • Commit that cites the games

Units are types

GemRate income(GemCount gained, RoundCount lived, GemRate prior) {
    return (gained + prior * params::income_prior)
        / (lived + params::income_prior);
}

Every number names its source

… kDash = rule(Tiles{2 * tile},
    "GameRules, Ways to move: dashes move up to 2 steps");
PARAM(hazard_mean, Hazard, Hazard{0.00169f / rd}, measured,
    "900 games against v5, v10, v20, 5 Nov")
PARAM(mean_income, GemRate, GemRate{0.1925f * gem / rd}, tuned,
    "tools/tune r9, round 65: …")
  • Rules of the game
  • Measured on games
  • Tuned by search

What each change was worth, in league Elo

Price of a teleport crystal
+8.5
Capture timing package
+8.4
Learned fight value
+7.5
Shields and spells used right
+5.7
Draft Prism by map
+4.9
Tribute emblem
+2.1
Another round of tuning
−1.3
Answering enemy locks
−2.2
Buying altar locks
−6.3

Where the top 3 were still ahead, per game

Gems banked
432
1,007
Deaths
8.8
2.2
Fights started
3.2
9.4
Damage a fight
611
1,485
Wards that showed nothing
21
1
  • Claudus Maximus
  • Top 3 teams
Go deeper

Fuel

A proof that no turn runs out

Each unit gets 100,000 units of compute a turn. I asked for a proof, not a test. The proof reads the compiled program the platform meters, counts every instruction, and bounds the worst turn in any game state.

How the worst case is computed

a + bone fuel an instruction, added along a path
max(a, b)a branch counts its dearer side
n × bodya loop with a bound the proof can see
budget − k + tailan open-ended loop, behind a guard that needs k fuel left

Turns out of fuel, per 100,000 played online

Intercontinental Fishladder #1
0
Claudus Maximus
0
stellar best girltop 3
126
Mitetop 3
242
Go deeper

Reading games

Agents can only fix what they can see

So every game became SQL tables an agent can query, and each time I saw agents were blind to something, a tool followed.

  • Every game as SQL tables
  • Image sheets, a frame every 10 rounds
  • Replay with a probe’s prints
  • Fork a game from any round
  • Scenarios on the official engine
50,000practice games against other teams, fed back to agents
21 → 1wards a game that showed nothing: mine against the top teams’, found by watching one game
52scenarios on the real engine settling how the game works
Go deeper

Models

The right model for each job

The strongest model decided. A cheaper one did work a test could check. A second vendor read lost games and reviewed.

  • Opus 5.5builders, fixers, tracers · 4,617
  • GPT 6.1loss readers, reviewers · 1,879
  • Fable 5directors · 149
$7,900of tokens at list price, in one 72-hour stretch
1,364lost games read by GPT agents
73agents working at once, at the peak
Go deeper

Subtraction

Delete what the loop doesn’t use

Anything the working loop did not use was deleted, including four days of proofs. Lines removed, by what they were:

Lean proofs
125,617
Second bot (v51)
92,330
27 benches
45,534
The formal plan
34,843
Hand-written engine port
12,384
Loop machinery and dashboard
11,618
Register of axioms
10,962
Work ledger
9,297
Reinforcement-learning specs
6,587
Mutation tests
6,036

Agent instructions on disk, in KB: grown, then cut

Go deeper

The finish

Frozen ladder, 13 Nov

#1 Intercontinental Fish
2,950
#2 prism best fih
2,876
#3 Mite
2,840
#4 BattleCatsUK #1
2,787
#5 Vvvvv @ 2FAnot a student
2,722
#6 NEETCoders
2,674
#7 Claudus Maximussolo, me
2,660

UK qualifier: 2nd of 190

  • W 21–0
  • W 21–0
  • W 21–0
  • W 20–1
  • W 20–1
  • W 14–7
  • W 12–9beat the #1 seed
  • L 5–16grand final
  • L 7–14rematch
Last 8Sprint 2, of 692 teams
Last 32Sprint 3, of 713 teams
FinalistCambridge Union, 18 Nov
Go deeper

Verdict

What worked. What I’d do differently.

What worked

  1. Hill-climbing behind a statistical test#347 to #2 in four days
  2. Fast feedback before anything elsegames 15× cheaper, up to 1,906 a second
  3. Rebuild from first principles, delete the rest+333 rating in 70 hours
  4. Measure the test itselfa league fitted to the top three teams replaced self-play
  5. Never test on the live laddera version goes up only once local tests read it better

What I’d do differently

  1. Skip the learned botsix days; its best won 12 of 140 against my rules bot
  2. Build before provingfour days of formal plans, all deleted
  3. Check the test against the ladder from day one+272 claimed, +55 measured
  4. Freeze the rules during a runagents work better on instructions that don’t move
  5. Check every fix on unseen mapsten lost games are easy to overfit
Go deeper

Every figure comes from the project’s own record: two repositories, 19,553 commits, 7,720 agent threads and the platform’s frozen ladder.