Bot programming tutorialsMighty Professional
Build a Legend Bot · Case studies

Case Study: Five Legends by Search

A trained network isn't the only way to the top league. By October 30, 2026, five CodinGame games had reached Legend in the author's lab with bots that search a simulator or follow fixed rules: Ultimate Tic-Tac-Toe, Tron Battle, The Great Escape, Mad Pod Racing and Troll Farm. Each section names the post-mortems its bot was built from, says what the bot does, and shows the records of how it did. Then come the two games where search stalled, and the checks to carry into your next game.

Time~45 minLevelAllPrereqsMinimax and Alpha-Beta, Monte Carlo Tree Search, Evolution and Beam Search, and Capstone: Build the Lab for the measurement steps every section relies on.StackC++20 & Rust · browser demos
◂ Build a Legend BotAdjacent · Case studiesBack to the series ▸
What you'll be able to do by the end

Pick a first kind of bot for a new game from the shape of its turn, before writing any code. Find the post-mortems for a game and turn each claim into a change you can test. Read a standings table correctly: score minus the boss, contest or permanent puzzle, and the date. Spot a stalled search, where every new version measures inside the noise, and know what to change instead.

01Nine games, three kinds of bot

You've reached Gold in a CodinGame game and the boss above you won't move. The next version could be a deeper search, better rules, or a network trained by self-play, and each one costs days. The author's lab made that choice nine times in September and October 2026 and recorded every submission. As of October 30, 2026, eight of the nine games had reached Legend, the top league. Three got there with self-play networks. The other five got there with search bots or rule-based ones, whose decisions follow rules written directly as code, with no learning and no lookahead, each built from the game's published .[1]

A boss is a bot CodinGame copies into every league except the top one. From Bronze up you become eligible for promotion when your score, a skill rating computed from your ranked games, reaches the boss's once all of them are played.[2] The widget below measures exactly that gap: each bot's final score in Gold minus the boss's.

Only one of the nine games, Back Track King, was a live contest. The other eight are permanent multiplayer puzzles: bot games that stay open all year, most of them left behind by earlier contests, with every league already open and a field that changes slowly. In a live contest the top leagues open on dates set in advance and every player is improving at the same time.[2] A climb on a permanent puzzle says little about a contest placing, so every rank on this page names which one it was.

Nine games, three kinds of bot

Each row is one of the nine games, in this page's order. For the six promoted from Gold, the colored bar is the final bot's Gold score minus the boss's, colored by the kind of bot, and the grey bar above it is the bot that was live on October 29, the day the post-mortems were collected. Press Play to step through the games with the record behind each one, or pick a kind of bot to filter the rows. Ultimate Tic-Tac-Toe went from 15.31 below its boss with a network to 4.48 above it with MCTS. In Spring Challenge 2022 the diamond is the best search bot, 1.96 short of the boss; a retrained network finished 8.03 above it. Game of Drones shows only its October 29 bar: the newer bot is still in Gold, below its boss. All seven are permanent puzzles; the Back Track King case study covers the contest.

The kind of bot followed the shape of the turn. The three turn-based games, where a bot can simulate every move exactly and fast enough to look several moves ahead, went to search. The two games where good play is a plan more than a lookahead, a racing line in Mad Pod Racing and an economy in Troll Farm, went to rule-based strategies. Networks reached Legend in Back Track King, where one turn combines several placements, in Fantastic Bits, and in Spring Challenge 2022 after search had stalled. That's nine games in one lab, so treat the pattern as a first guess for your next game and then measure it.

02Ultimate Tic-Tac-Toe: when nobody can score a position

Drew on: the game's forum thread (Magus, jacek, JFB, RoboStac) and Tom Alard's 2026 write-up.

In Ultimate Tic-Tac-Toe, nine tic-tac-toe boards sit inside a big one, and the cell you play decides which small board your opponent must play in next. A turn can offer up to 81 legal moves, and nobody has a good formula for who's ahead in the middle of a game. Tom Alard, 2nd on the leaderboard when he wrote it up in 2026, puts it plainly: "A classic minimax search that greedily tries to maximize some naive heuristic will play very poorly."[3] When you can't score a position by hand, let random games score it.

That's what does: it estimates a position by playing many random games to the end from it, and spends more of them on the moves that look best so far. The game's forum thread reads like a checklist for it. Magus reported reaching Legend in 2018 "with 25k rollouts at the second turn", keeping his tree between turns.[4]

In a later post, jacek listed what got his Java bot to Legend: "mcts solver; fine-tuning exploration constant (it's generally much less than typical sqrt(2)); tree reuse; 1-ply search win check during expansion and during playouts". He added later that "The best opening is center, almost all in legend use it."[4] JFB's 2018 post is the counter-example: he trained a small network on about 2,000 replays, played it without search, and reported "It finish as last in Gold."[4]

From the author's lab

The lab's bot is one source file that follows the checklist: bitboards for the nine small boards, UCT with rewards of 1, ½ and 0, an MCTS solver, tree reuse, playouts that take an immediate win and avoid handing one over, and the center opening. Tuned against itself, an exploration constant of 0.6 beat 0.5 (0.5 scored .441 [.39, .49] over 400 games) and 0.7 was no better (0.6 scored .513 [.44, .58] over 200); once the final playout rule was in, 0.5 against 0.6 measured .483 [.41, .55], inside the noise. The solver was worth .588 [.52, .65] and tree reuse .620 [.55, .68], each against the same bot without it over 200 games.[5]

Against the author's earlier MCTS bot it went 195–5–0 over 200 games on fixed maps, both seats, and the lab's self-play network scored 0 of 64 against it. It won 20 of 20 live test games against the Gold boss, finished 4.48 points above the Gold boss on the permanent puzzle, and was promoted to Legend on October 29.[1]

Two habits carry over. Tune the exploration constant c, the weight UCT gives to rarely tried moves, on your own reward scale instead of copying a number: with rewards of 0, ½ and 1 the forum's values and the lab's sit well under √2, yet a 0.3 to 0.5 range taken from another bot's tests never beat 0.6 here. And measure each addition against the bot without it. Tree reuse, keeping last turn's tree under the moves actually played, was worth .620 in this bot, while RoboStac, answering a newcomer on the same thread, called it "a very small increase in bot strength" and something to leave until MCTS works.[4]

Random playouts have a ceiling. Tom Alard estimates that "excellent performance engineering" takes random-rollout MCTS to "about top 50", and the top bots he describes put a small neural network inside a search, alpha-beta in one case and an MCTS variant in his own.[3] Monte Carlo Tree Search builds the bot above, and Networks Inside Search covers the step after it.

03Tron Battle: score the territory, then search

Drew on: a1k0n's and Janzert's write-ups of the 2010 Google AI Challenge, dhartmei's notes on chambers, and the game's forum thread (dolmen1234, Xavier_F).

In Tron Battle, light cycles leave a wall behind them on a 30×20 grid and the last one moving wins. A cycle has at most three useful moves a turn, so searching is cheap and knowing who's winning is the hard part. The winner of Google's 2010 AI Challenge, a1k0n, played a version of the game where both players moved at once, and wrote that "a better evaluation heuristic will always beat deeper minimax searches".[6][7] That's his opinion, and the lab's Legend bot was built on it.

His evaluation, which he credits to the contest's forums, is Voronoi territory: for each free cell, find which player reaches it first, then count your cells minus theirs.[6] He added two refinements. Counting the open edges inside each territory as well as its cells "led to automatic wall-hugging behavior when all else was equal". And he corrected for chambers: when part of a territory hangs off a single cell, an articulation point, a player who goes through it can't come back, so only the side it can actually fill should count.[6]

Janzert, 5th that year, built the same pieces: "crAB is an alpha-beta searcher using iterative deepening, a transpostion table and bitboard representation. With Voronoi territory and 2-connected chambers used for evaluation."[8][7] Once the players are walled off from each other, the game becomes a filling puzzle, and dhartmei's notes solve it chamber by chamber.[9]

CodinGame's version adds players: of the lab's 1,770 Gold ranking battles, 60 had two cycles, 366 had three and 1,344 had four.[1] On the game's forum, dolmen1234 reported that a over all players "seemed to improve my results and get me to legend", while Xavier_F reached Legend in Python with a one-ply heuristic and no search at all.[10] Paranoid search is one reported route among several.

From the author's lab

The bot searches with alpha-beta and iterative deepening, paranoid over the players that can reach its region in three- and four-player games, and scores positions with a1k0n's fitted weights (0.055 per cell and 0.194 per open edge, scaled by 1,000) and his chamber correction. Once separated, it switches to an exact fill solver. Against the author's earlier bot it scored .758 [.68, .82] over 128 local games, and every loss was already behind on space when the cycles separated. It won 13 of 20 live 1v1 test games against the Gold boss (the earlier bot won 6 of 10), finished 3.07 points above the Gold boss on the permanent puzzle, and was promoted on October 30.[5][1]

Put your first days into the evaluation and the endgame, then let alpha-beta use whatever time is left in the turn. A deeper search over a territory count that ignores chambers steers into a pocket it can't fill. Evaluation Functions builds Voronoi territory, and Minimax and Alpha-Beta adds paranoid search and the endgame.

04The Great Escape: search only the moves that matter

Drew on: the 2015 contest's strategy thread (Recar, 1st; Romka, 3rd; dimkadimon) and CodinGame's final report.

In The Great Escape, two or three players race across a 9×9 board to the far side, and on any turn a player can place a wall instead of stepping, as long as every player keeps a path to its goal. A wall can go in up to 128 places, so a full-width search grows fast. Romka, 3rd in the 2015 contest, decided early "that minimax is not the way to go because of large amount of possible wall placements on each turn".[11][12]

The winners cut the move list down. Recar, 1st, started with "mini-max with alpha beta pruning", switched to a list of rules checked in order, and kept one narrow search in which the "Enemy can only select one of decreasing his path turns" and walls go only where they block the opponent's next moves.[11] Romka searched walls to depth 5, "assuming that opponent won't put any walls and will just move towards his goal".[11] In three-player games both picked a single rival; Recar's rule was "Usually our rival is next player."[11] And dimkadimon described a fixed opening, credited to Laochao, that made "a nice passage for himself around the edge" and "usually won against the top players at the time", until players started countering it.[11]

From the author's lab

The bot keeps the board in bitboards and runs paranoid alpha-beta with iterative deepening, a transposition table and a node budget. Its moves are the steps that shorten its own path and only the walls that cut the first three layers of an opponent's shortest paths, the best ten by gain. Its three-player opponent model came from data: in recorded Gold games, 85% of walls hit either the player who moves after the waller or the leader, and the boss walled the player after it 87% of the time. In 1v1 it opens with the edge corridor. Locally it scored .945 [.89, .97] against the author's earlier bot over 128 games. On the permanent puzzle it finished 3.17 points above the Gold boss, won 85 of its 100 two-player ranking battles, and was promoted on October 30.[5][1]

When the move list is huge, prune it to the moves the post-mortems say change the outcome, here walls that lengthen a path, and check the opponent model against real games before trusting it: both winners assumed the next player was the rival, and the lab's recorded games put 85% of walls on the next player or the leader. Expect a fixed opening to stop working once others have seen it, and treat it as a head start for the search.

05Mad Pod Racing: one pod races, one pod blocks

Drew on: write-ups from the 2016 Coders Strike Back contest: Hastings (4th), pb4608 (3rd) and Magus's guide.

In Mad Pod Racing, pods race through a circuit of checkpoints, and in the full game each player steers two of them; the first pod to finish the laps wins for its team. The game ran as a contest in 2016 under its previous name, Coders Strike Back, so that's where its post-mortems are.[13] Steering one pod well is the first half. Hastings, 4th in that contest, aimed at "nextCheckPointPosition - 4 * velocity" to cancel the pod's drift, thrusting only when roughly facing that point, and wrote "I used 4 because it performed better than 3 or 5."[14]

The second half is the other pod. Magus's guide gives each player a runner and a hunter, re-chosen at the start of every turn from the pods' progress.[15] The 3rd-place finisher, pb4608, opens every turn the same way: "Define all pods' roles: my runner, my blocker, the opponent's runner and the opponent's blocker."[16] Hastings's heuristic bot made the split by asking whether a pod was "the furthest along on its team".[14]

From the author's lab

The lab's bot is rule-based, with no search. Its runner aims at the next checkpoint minus 3 × its velocity at full thrust (Hastings's tested value was 4), cuts thrust when the target is behind it, turns early toward the following checkpoint, boosts once on a long straight and raises its shield before a hard hit. Its blocker waits about 1,000 units in front of the enemy leader's next checkpoint, turns to face the leader and rams it. Locally it scored .727 [.64, .80] against the author's earlier bot over 128 games, and it won 14 of 20 live test games against the Gold boss (the earlier bot won 2 of 10). On the permanent puzzle it finished 6.48 points above the Gold boss and was promoted on October 30.[5][1]

Promotion didn't end the work. In Legend the same bot finished its ranking in the lower half of the table while still capping its thrust at Gold's 100, where Legend accepts up to 200. A copy with Legend's thrust won 16 of 20 paired live games against Legend players, where the Gold copy won 6 of the same 20.[1][5] CodinGame's league documentation warns that a new league can bring new rules, so "read the statement again after a promotion".[2] The Legend copy was submitted on October 30; the records read that evening hold no final ranking for it.

06Troll Farm: write the economy down

Drew on: delineate (1st), yamo (3rd), gpoussel's notes on a hand-written Legend bot, and the game authors' Legend statistics.

The Spring Challenge 2026 game, Troll Farm, is an economy. Trolls harvest fruit, chop trees and mine iron, and you spend what they carry home on training more trolls, so the team gathers faster. A troll trained now costs resources today and pays them back over the turns that remain, so whether to buy one depends on how much of the game is left. Plain self-play struggled with exactly that decision in this game, the winner's included.

The contest's winner, delineate, used a network, and his write-up explains the trouble. His first version "could never learn to mine iron, so it never ventured into higher tech units", because "The benefits to mining iron are extremely far in the future."[17] He fixed it with a curriculum: first a network rewarded for building one specified troll design, then one that chooses among designs, then a fine-tune on the real final score.[17]

The players without a network wrote the economy down as rules instead. The 3rd-place finisher, yamo, rates each tree by wood per turn, what a troll can carry home divided by the whole round trip: "value = min(treeSize, carryRemaining) / (travelTurns + chopTurns + returnTurns)".[18] Notes by gpoussel on a hand-written bot promoted to Legend in the post-contest arena use the same rule for every job: "Each troll picks the job with the most points per turn".[19] The authors' statistics for the Legend league show two economies at the top: yamo ended every game with two trolls, while delineate and norxondor_gorgonax, 2nd, usually built three or more.[20]

From the author's lab

The lab's network never found this economy. In live games it trained one or two cheap trolls in the first five turns and never another, while the players who beat it kept training faster trolls with more carrying capacity until about turn 150. In validation self-play it could afford a new troll on only 8 of about 3,200 decisions between turns 50 and 100, so it rarely saw what a troll was worth. Its trainer discounted future rewards by .997 per turn, so a short horizon wasn't the cause.[5]

The rule-based economy bot that replaced it rates every job by points per turn and trains the next troll design with the best productivity over the turns left, minus what it costs. It scored .979 against the author's earlier bot and .964 against the network over 192 local games each, and won 16 of 20 live test games against the Gold boss (the network won 7, with one draw). On the permanent puzzle it reached 2.49 points above the Gold boss, with 97% of its ranking games played, and was promoted on October 30; a later version stood in the upper part of the Legend table that day.[5][1]

Behavior cloning the rule-based bot into the network failed. After three epochs on 3,000 of its games, the loss stayed at 2.71 nats per decision and the clone lost all 32 games to the earlier bot. The rules decide from job plans that the network's observation doesn't show.[5]

A discount factor is the other common way a learner misses an investment, and it's the first thing to check in your own trainer. A reinforcement learner usually counts a reward t turns away at γt of its value, where γ (gamma), the discount factor, is a number just below 1, so income far in the future shrinks toward nothing.

Worked example

A worker costs 40 points and earns 1 point a turn. Bought with 200 turns left, it returns 200 − 40 = 160 points.

A learner with γ = .97 values the same income at 1 + .97 + .97² + …, which never exceeds 1 / (1 − .97) ≈ 33 points. That's less than the 40 it costs, so the purchase never looks worth making.

The widget plots this sum for every turn of the game. It's what one more worker is worth to a discounted learner:

discounted worth = income × (1 − γleft) / (1 − γ) − cost

In words: add up the worker's income for every turn left, shrinking each turn's share by another factor of γ, then subtract the price. However many turns are left, the sum stays below income / (1 − γ), so when that is less than the price, no purchase ever looks worth it.

When a worker never looks worth buying

The first panel shows points held over a 200-turn game in a toy economy. You start with one worker earning a point a turn, each extra worker costs 40 points, and your score is what you hold at the end. Teal is the best plan, found exactly by dynamic programming; amber is the plan that's best when each turn's points are discounted by the slider's factor, scored afterwards with the real rule; grey never buys. The second panel shows what one more worker is worth on each turn, in full and with the discount. Drag the discount factor up from .97. At .97 the discounted plan never buys and ends with 200 points against the best plan's 766. It starts buying at .976 and matches the best plan from .979. That's one way a learner misses an investment, though not what happened in the lab: its Troll Farm trainer used .997, and in self-play the network could afford a new troll so rarely (8 of about 3,200 decisions in turns 50 to 100) that it never learned what one was worth.

Write an economy as rules when you can state it: rate each job by points per turn, and buy the next producer when its output over the turns left beats its price. If you want a network to learn it, give the network the situations to learn from, as delineate's curriculum did, and check that its discount factor can see as far as a purchase takes to pay back.

07Where search stalled

Two games broke the pattern. In both, the lab's search bots climbed near the top of Gold and then stopped short of the boss, round after round. A retrained network finished one of them; the other is still in Gold.

Spring Challenge 2022: a network finished it

Drew on: bowwowforeach (1st), blasterpoard (2nd) and Nanaeda (3rd).

In Spring Challenge 2022, listed today as Spider Attack, each player's three heroes guard a base against monsters walking in from the edges of the map, and a base that loses three health points loses. Heroes earn mana by hitting monsters and spend it on three spells: WIND pushes units away, SHIELD protects a unit, and CONTROL sends a unit where you choose. Games where neither base falls go to the player with more "wild mana", the mana gathered away from its own base.[21]

The top three write-ups describe three different bots. The winner, bowwowforeach, ran two rule-based defenders and one attacker chosen by a 15-turn search ("防衛2人 : ルールベース", two defenders by rules, and "15ターンのchokudaiサーチ", a 15-turn chokudai search, which he describes as a depth-first relative of beam search).[22][21] The runner-up, blasterpoard, used "no search" and scored several thousand candidate points with an evaluation function.[21] Nanaeda, 3rd, defended with all three heroes until turn 120 and then attacked with shielded monsters, a plan he chose because most top bots attacked early.[23]

From the author's lab

The lab's search bot defended with a 12-turn rollout against a model of the boss's attacker and attacked with one hero. Its second version climbed high in Gold on the permanent puzzle but stopped 1.96 below the boss, and scored 35 of 72 against the Gold top ten; late shield attackers caused 33 of its 50 ranked losses. Four more rounds followed: earlier shield modeling, fewer CONTROL pulls, cleaner attacks, then Nanaeda's all-defense plan and bowwowforeach's emergency wind. Each was gated on a live screen or a against top-Gold attackers, and none passed.[5][1]

Meanwhile the network that had been live in Gold was diagnosed from its ranked battles: 64 of its 70 wins came on the wild-mana tie-break, it lost all 55 others on base health, and it cast no SHIELD at all. The fixes changed what it trained on. The reward's weight on wild mana dropped from .01 to .001. SHIELD's logit was raised by 15, because cloning a teacher that never shielded had left it about 13 below the chosen option. Half the training games, up from about a third, were played against fixed opponents, mostly scripted bots in the Gold styles; before that, the champion had scored .03 against the one modeled on the boss. And training sampled moves at the same temperature, .5, that the exported bot plays at. Champion 99,250 of the restarted run beat the second search bot 127–1 locally, then won 57 of 58 paired live games against top-Gold shield attackers, where the search bot won 19 of the same 58. On the permanent puzzle it won 120 of its 125 Gold battles, finished 8.03 points above the Gold boss, and was promoted on October 30.[5][1]

When round after round of search changes lands inside the noise of a fair panel, another search tweak is unlikely to break through. Look at what the bot is measured and trained against instead. Here the local copies of the shield attackers didn't predict games against the real ones, and the network moved once its reward, its actions and its opponents matched the Gold meta.

A common question at this stage: the network has stopped improving in Gold, so what should change? Spring Challenge 2022's records show five causes. The network drifted into a habit of farming the tie-break. It never cast SHIELD, an action its cloned teacher never used. Greedy play stalled where sampling kept moving: one champion scored .50 picking its most likely move and .85 sampling, on the same maps. Its heroes decided independently and duplicated each other's work: two of them controlled the same monster on 254 turns of 52 lost battles. And no training opponent played like the Gold meta. Each fix changed what the network sees, does or plays against.[5] Behavior Cloning covers the forgotten action, Neural Networks for Game Bots has units decide in order, and Self-Play Reinforcement Learning covers drift, sampling and opponents.

Game of Drones: still in Gold

Drew on: Loujo (1st), god (2nd) and Gangrene (3rd) from the 2014 contest, and the game's forum thread (tarriel).

In Game of Drones, two to four players move drones over a map of zones. Each zone you hold scores a point a turn, and you lose it when an opponent brings more drones into it than you have.[24] The 2014 winners all planned in turns of travel. Loujo, 1st, listed for every zone the future turns at which drones would be needed to take or defend it, sorted those objectives by how soon and how cheap they were, and assigned drones in that order.[24] The runner-up, god, kept his commitments loose: instead of "From now on I'm going to charge into this zone with 3 drones!", his objectives read "I want to be able to have 3 drones there in 5 turns".[25] With three or four players, god and Gangrene, 3rd, both settled on an edge base, and Gangrene limited his drones to "a zone at an extremity (zone A), but also its two closest neighbors (zones B and C)".[25][26] Loujo also noted why testing a bot against a near-copy of itself teaches nothing in this game: "the score remains 0-0 at the end".[24]

From the author's lab

The lab's best bot is a rollout search. It keeps the earlier bot's drone allocator as its starting policy, tries 10 to 20 turns of drone commitments, and takes the worst case over two opponent models: everyone repeats their last orders, or a model learned from 501 logged games. In three- and four-player games it holds an edge zone and its two nearest neighbors, as god and Gangrene did. The last two rounds each passed a pre-registered paired live panel before submission: better on 39 of 60 pairs and worse on 21 (one-sided sign test p = .014), then better on 29 of 40 and worse on 11 (p = .003). On the permanent puzzle it closed most of its gap to the boss by October 30 but stayed in Gold, and the boss's own score rose during that ranking.[5][1]

The ranked battles show where the gap is. In round 4's, the bot won 30 of 43 one-on-one games without the boss, but finished last in 7 of 9 three-player games that included it. The boss plays deterministically, yet a model of it built from 237 of its logged games was dropped: even when told the boss's zones from the turn before, it could copy only 55 to 67% of its moves.[5]

When you're first in Gold and still below the boss, split your ranked results by opponent and by player count before writing more code, and work on the games you're actually losing. On the game's forum, tarriel gives the same advice: "reread the post competition thread", because "there are usually commonalities between the best bots and everyone else".[27] Here the commonality was the edge base, and it moved the score without yet passing the boss.

08What to reuse in your next game

The five Legend bots on this page share no code, but each one went through the same checks before it was submitted, and those checks transfer to any game.

GameBotLocal vs earlier botLive tests vs bossGold final vs boss
Ultimate Tic-Tac-ToeMCTS.988 [.96, 1.00], 200 games20 of 20+4.48
Tron Battleparanoid alpha-beta.758 [.68, .82], 128 games13 of 20+3.07
The Great Escapeparanoid alpha-beta.945 [.89, .97], 128 games3 of 3 (1v1)+3.17
Mad Pod Racinghand-written.727 [.64, .80], 128 games14 of 20+6.48
Troll Farmhand-written.979, 192 games16 of 20+2.49

"Local" is the bot's points against the author's earlier bot for the same game; "live tests" are test games against the Gold boss before submission. Points count a draw as half a win, and the brackets are 95% Wilson intervals. Every local match used fixed validation maps, with both seats. Troll Farm's Gold final was read with 97% of its ranking games played.[5][1]

  1. Read every write-up and list its claims. Write each one as a change you could test, with the conditions it held under: the author's bot, league and year. A constant from someone else's bot, an exploration weight or a velocity multiplier, is a starting point for your own tuning.
  2. Build on an engine you've checked. Each bot here was measured in a simulator verified against the game's referee or recorded live games, so a local result meant something. Referees and Simulators shows how to verify one.
  3. Measure against your previous bot. Use fixed maps, both seats, and enough games for an interval that excludes .5, on maps you didn't tune on. Measuring Bot Strength works out how many games that takes.
  4. Test live against the boss before you submit. Play it on fixed seeds. CodinGame's own documentation adds the caution: "Beating the boss in test games is a good sign, but the ranking is computed against every player of the room".[2]
  5. Submit, record, and split the results. Save every ranked battle, then break the results down by opponent and by player count, the way Game of Drones' gap showed up.
  6. Read the new league's rules after a promotion. Mad Pod Racing's thrust limit changed between Gold and Legend.

The kind of bot to start with depends on what a turn looks like. In these games it went like this:

GameWhat a turn looks likeWhat reached Legend here
Ultimate Tic-Tac-Toeone move from up to 81, exact rules, no reliable hand-written evaluationMCTS
Tron Battleat most three moves per cycle, territory you can countalpha-beta over Voronoi territory
The Great Escapea step, or a wall in one of up to 128 placesalpha-beta over a pruned move list
Mad Pod Racingan aim point and a thrust for each of two pods, with momentuma hand-written runner and blocker
Troll Farmjobs for several trolls, and whether to train anotherhand-written economy rules
Spring Challenge 2022three heroes, spells, monsters hidden outside their sighta network, after search stalled

Treat the table as a first guess for a similar game, then measure.

09Mistakes these games punished

Copying a constant. An exploration range of 0.3 to 0.5 taken from another bot never beat 0.6 in the lab's Ultimate Tic-Tac-Toe bot, and Hastings's 4 × velocity was tuned on his own pods. Tune every borrowed number on your bot.

Testing against a copy of yourself. Two deterministic bots that play the same way mirror each other: Loujo saw Game of Drones copies end 0–0 in 2014, and the lab's earlier Game of Drones bot did the same against itself in 2026.[24][5] Measure against varied opponents. The Back Track King case study shows the same trap producing a fake win rate.

Trusting local copies of opponents. In Spring Challenge 2022 a version that beat the old one against every local replica of the shield attackers did worse than it against the real ones.[5] Confirm a local result on a pre-registered live panel before you believe it.

Treating promotion as the end. The Mad Pod Racing bot reached Legend from the top of Gold and then ranked in the lower half of the table under the new league's rules.

Keeping a fixed opening forever. Laochao's corridor "usually won against the top players at the time", and within the same contest players learned to counter it.[11]

Permanent puzzles aren't contests

All seven climbs from Gold on this page happened on permanent puzzles, where every league is open and the field changes slowly. In a live contest every player improves at the same time and the top leagues open on a schedule, so a promotion on a puzzle doesn't predict a contest finish.

10What's next

This is the last page in the series' order, so the banner goes back to the Build a Legend Bot hub. For your next game, start from the step-by-step procedure in Capstone: Build the Lab: verify an engine, write the search or rules the post-mortems point to, and measure every change before you submit it. If the game looks more like Spring Challenge 2022, with many units, hidden information and a meta to train against, the machine-learning phase starts at When to Use Machine Learning.

11Sources

Standings and measurements are the author's lab records and carry their dates. Each post-mortem is credited by its author's handle and linked to the original post; the CodinGame blog was unavailable on 2026-10-30, so its posts are linked through the Internet Archive.

  1. Author's lab records, 2026 (private repository): standings. Final Gold rankings, promotions and Legend results in experiments/live-submissions/<puzzle>/rankings.jsonl and submitted.jsonl for the seven games climbed from Gold (last read October 30, 2026); Back Track King's best Legend final in evaluations-20261024.json; Fantastic Bits in AGENTS.md (October 30 entry).
  2. CodinGame, 2026. Leagues and promotion, CodinGame API documentation, retrieved 2026-10-30. Bosses, promotion once your score reaches the boss's, league openings in contests, test games against the boss, and new rules after a promotion.
  3. Tom Alard, 2026. Fighting for #1 in the Ultimate Tic-Tac-Toe Arena. Why naive minimax plays poorly, the ceiling of random-rollout MCTS, and networks inside the search at the top.
  4. CodinGame forum, 2018 to 2026. Ultimate Tic Tac Toe [Puzzle discussion]. Magus (#33, #36) on rollouts and tree reuse, JFB (#26) on a network without search, jacek (#150, #195) on MCTS additions and the center opening, RoboStac (#162) on tree reuse.
  5. Author's lab records, 2026 (private repository): what each bot does and how it was measured. docs/postmortem-lessons.md (October 29 standings and every later round); the README.md of games/tictactoe, tronbattle, madpodracing, trollfarm, spring2022 and gameofdrones; prompts/results/greatescape-legend-20261029.json and trollfarm-legend-20261029.json; experiments/trollfarm-farmer-bc-20261030.json; experiments/live-tests/<puzzle>/ (live tests against the bosses and the Spring 2022 paired panels); experiments/spring2022-attacker-20261026.json; docs/multi-game.md; experiments/runs/trollfarm/config.json.
  6. Andy Sloane (a1k0n), 2010. Google AI Challenge post-mortem. Voronoi territory, counting open edges, articulation points and the chamber correction, and his view of evaluation against depth.
  7. Daniel Hartmeier (dhartmei), 2010, updated 2017. Tron server with Elo ratings. Index of 2010 write-ups with final ranks: a1k0n 1st, Janzert 5th.
  8. Brian Haskin (Janzert), 2010. Janzert's Tron Bots, Information Page. Alpha-beta with iterative deepening, a transposition table, bitboards and a chamber-tree evaluation.
  9. Daniel Hartmeier (dhartmei), 2010. maxsteps: visiting chambers. Searching the separated endgame chamber by chamber through articulation points.
  10. CodinGame forum, 2016 to 2018. Tron Battle (aka Line Racing) multiplayer challenge discussion. dolmen1234 (#36) on paranoid search over all players; Xavier_F (#34) on reaching Legend with a one-ply heuristic.
  11. CodinGame forum, 2015. The Great Escape - Strategies. dimkadimon (#9) on fixed openings, Romka (#10) and Recar (#13) on their selective searches and choice of rival.
  12. Aude (CodinGame), 2015. The Great Escape - Final Report, CodinGame blog (archived copy). The podium: Recar 1st, Romka 3rd.
  13. CodinGame forum, 2021. Mad Pod Racing - Puzzle Discussion, post #538 by 5DN1L. Coders Strike Back is the game's previous name.
  14. CodinGame forum, 2016. Coders Strike Back: Your ideas! Hastings (#22, #26), 4th: aiming at the checkpoint minus 4 × velocity, and offense or defense by race progress.
  15. Magus, 2016. Coders Strikes Back, English translation by Agade. Runner and hunter roles chosen every turn from race progress.
  16. pb4608, 2016. Evolutionary Trajectory Optimization with a Genetic Algorithm, CodinGame blog (archived copy). 3rd in the contest; runner and blocker roles for both players every turn.
  17. delineate, 2026. Codingame Spring Challenge 2026 (delineate), GitHub gist. 1st in Troll Farm: why plain self-play never learned to mine iron, and the curriculum that fixed it.
  18. Yann Moisan (yamo), 2026. My post mortem for the codingame Spring Challenge 2026. 3rd in Troll Farm: wood per turn and a two-troll economy.
  19. gpoussel, 2026. Pull request #29 of the copro repository. A hand-written Troll Farm bot that rates every job by points per turn, promoted to Legend in the post-contest arena.
  20. eulerscheZahl and the Troll Farm authors, 2026. Troll Farm Statistics. How many trolls each Legend player ended its games with, at the contest's end.
  21. CodinGame forum, 2022. Spring Challenge 2022 - Feedbacks & Strategies. PhOeNyX (#15) on wild mana deciding games where no base falls, blasterpoard (#34), 2nd, on a bot without search, and bowwowforeach (#60, #70) on his attacker and chokudai search.
  22. bowwowforeach, 2022. CodinGame Spring Challenge 2022 参加記 (in Japanese). 1st: two rule-based defenders and an attacker chosen by a 15-turn chokudai search.
  23. Nanaeda, 2022. CodinGame Spring Challenge 2022で3位を取った話 (in Japanese). 3rd: all-defense until turn 120, then shielded attacks, chosen against bots that attack early.
  24. Loujo, 2014. Game of Drones AI battle: Loujo's strategy (1st place), CodinGame blog (archived copy). Objectives counted in turns of travel, and the 0-0 between near-identical bots.
  25. god, 2014. Game of Drones AI battle: god's strategy (2nd place), CodinGame blog (archived copy). Flexible objectives, and an edge base with three or four players.
  26. Gangrene, 2014. Game of Drones AI battle: Gangrene's strategy (3rd place), CodinGame blog (archived copy). An extremity zone and its two closest neighbors.
  27. CodinGame forum, 2014 to 2024. Game Of Drones multiplayer challenge discussion. tarriel (#13, 2023) on reaching Legend by rereading the post-contest threads.