From cod to walrus: what I learned building a Traversal bot

Traversal is a two-player strategy game on a 10×10 board where every square has a height. I rebuilt it and opened a bot arena at traversal-bot.app, and of course I wanted my own bot at the top. Between 22 and 28 October I built a whole lineage of them, mostly named after sea creatures that eat the previous one. This is what that week taught me.

The game in two minutes

The board changes every game. Heights go from 0 to 6, neighbouring squares never differ by more than 2, and the terrain is symmetric under a half-turn so neither side is favoured. Each player has six pieces, two of each type, and every piece splits 6 points between Movement and Force:

Piece Movement Force
Explorer 5 1
Vanguard 4 2
Sentinel 3 3

On your turn you move one piece, orthogonally, square by square. A step costs 1 on flat ground and |height difference| + 1 otherwise, and the total must fit in the piece's Movement. You can't walk through other pieces.

A piece on the far row with at least one Movement point left can exit, and scores its Force. The game ends as soon as two pieces have exited, both players combined, and the higher score wins (with a cap of 200 plies, a ply being one player's move).

You attack by moving onto an enemy piece, and win if your attack is at least its defence. Attack is your Force, +1 if you start higher than the target (−1 if lower), plus the Force of every other friendly piece next to the target. Defence is the target's Force, +1 per friendly piece next to it. A captured piece is simply gone: it scores nothing.

Then the rule that changes everything: if the very first piece to exit is a Sentinel, its owner wins on the spot. Sentinels are the slowest pieces. So every game is a race: get a Sentinel out first, or get anything out before the opponent's Sentinel, which cancels its instant win and starts a race to the second exit. In the arena's first 1,242 games, 67% ended with a Sentinel exit.

It's a good playground for bots: perfect information, no dice, a small board, around 80 legal moves per position. But with a new terrain every game, there is no opening book and no endgame table: everything a bot knows must be relative to the terrain.

The arena: fuel is time

A bot is a WebAssembly module. It gets 2 billion units of fuel per move, roughly one per executed instruction, refilled every move and impossible to save. Run out and you lose. Add 64 MB of memory (kept between moves of a game), a 1 MB module, no threads, no SIMD, no clock.

That clock is short. A Mac runs around 28 billion of these instructions per second, so a move is worth about 70 milliseconds of thinking. The strongest house bot, Mont Blanc, uses about 0.8 billion: a 4-ply alpha-beta search (minimax that skips branches it can prove irrelevant) keeping only the 7 most promising moves at each node.

In chess, the legal moves of a position come from a few table lookups. Here, the legal moves of each piece are a shortest-path search over the terrain, and a decent evaluation runs two more. One node of my early bots cost about 87,000 fuel, so they saw 20,000 to 30,000 positions per move, 6 to 8 plies deep. Every trick borrowed from chess engines had to be re-priced in that currency.

Day one: steal from Stockfish

The first five bots all date from 22 October.

  • rapide ("fast") re-coded Mont Blanc's evaluation exactly, five times cheaper, and searched until the fuel ran out. It used the textbook kit: iterative deepening (1 ply, then 2, then 3…), principal variation search or PVS (search the expected best move fully, the others with a cheap "can it beat this?" probe), a transposition table or TT (a cache of searched positions, kept across moves), late move reductions or LMR (search badly ranked moves less deep), and a quiescence search (keep following captures and exits past the horizon). It scored 79.8% against Mont Blanc over 400 games.
  • morue added the rest of the Stockfish toolbox: aspiration windows, null move (if passing your turn is already good enough, stop searching), late move pruning and futility pruning (skip quiet moves that look hopeless near the leaves). Morue is French for cod, and dried cod is stockfish. It scored 61.4% against rapide over 1,000 games, about +80 Elo.
  • orque, the orca that eats the cod, got a faster move generator and one game-specific idea: moves that block the opponent's runner are searched first, and a few of them are never pruned. +86 over morue. It wins 93% against Mont Blanc, and it now powers the game reviews on the site.
  • requin (shark) made nodes cheaper again, for instance by trying the cached best move before generating any other. +105 over orque.

Each generation was worth +80 to +105 Elo, and the boring explanation was the same every time: 1.4 to 1.7 times more nodes for the same fuel. Meanwhile I tuned 14 search parameters, 600 to 1,000 games per setting, and nothing rose above the noise.

Losing in public

Then I took requin online on traversalgame.com, and it lost to another player's bot. I replayed the games with a 1.5-million-node analysis. One sums up the game: my bot left pieces where they could be taken, then exited a Vanguard first (2 points) while the opponent's Sentinel was one move from the edge. The Sentinel exited second: lost, 2 to 3.

So requin2 changed nothing in the search. Only the evaluation: pieces on the board worth more, and a new term for the race to the second exit. It beat requin 82% of the time (a native duel at 50,000 nodes per move, on 100 terrains). Two numbers in the evaluation had beaten a day of search work. That became the theme of the week.

Morse: let the data write the evaluation

The next family, Morse (walrus), went from v1 to v16 on 23 and 24 October. Every change was measured twice. First a native duel at equal nodes (800 games, fast, ±22 Elo), which says whether the bot plays better. Then a duel in the real sandbox at equal fuel (1,000 games), which says whether it's worth the price. The versions that made it, each against the previous kept version:

version change equal nodes equal fuel
v1 evaluation weights learned (Texel) +52 +15
v2 bitboards same play +55
v4 learned move ordering +60 +40
v5 small neural network, mixed labels +49 +40
v10 richer network inputs +49 +22
v11 same network, cheaper same play +7
v13 distillation +41 +57

Texel tuning (fitting the evaluation weights by logistic regression so they predict game results) on 360,000 positions held surprises. An Explorer is worth nothing by itself (−3): only its progress counts. The Sentinel race term I'd inherited at 150 came out at 24, while the race to the second exit came out at 115. But the new evaluation cost 54,600 fuel instead of 38,000, and at equal fuel the +52 shrank to +15.

Bitboards won it back. The 100 squares fit in a single u128, one bit per square, and a piece's moves become a flood fill by cost layers instead of a Dijkstra:

// layers[d]: empty squares reached at exact cost d. slope[dir][c]: squares
// from which a step in direction dir costs c (computed once per terrain).
for d in 1..=budget {
    let mut next = 0;
    for c in 1..=d {
        for dir in 0..4 {
            next |= shift(layers[d - c] & slope[dir][c], dir);
        }
    }
    next &= empty & !seen;
    layers[d] = next;
    seen |= next;
}

Move generation dropped from 53,300 to 27,400 fuel, and caching the evaluation's path costs took it from 54,600 to 16,900. A node went from about 101,000 to 79,000 fuel: 28% more nodes, worth +55 Elo.

Learned move ordering came from Arimaa programs: a softmax model (one score per move, trained to predict which move a deep search picks) over 14 cheap features. The weights read like advice: avoid squares next to enemies, flee threatened squares, block the runner, move Sentinels first and Explorers last. It also cost 18% more fuel per node, which ate a third of the gain.

The neural network was tiny: 32 hidden neurons, with inputs per piece such as (side, type, cost to exit on this terrain), never an absolute square. Trained on game results, it played worse (−7): a result is a noisy label. Trained on a 50/50 mix of the result and a search score, it gained +49. Inputs about interactions (enemy neighbours, pieces under attack, turns lost to obstacles) gave another +49, until 16% more fuel per node halved it in the arena. v11 merged weight rows to win the speed back.

Then distillation: label positions with something much stronger than the bot, and train the bot's small network to imitate it. The teacher was Morse's own search at 200,000 nodes per position, eight times a real move, run offline with no fuel limit. On 247,000 teacher positions, the student's error fell 26% below the linear evaluation's, and v13 beat v11 by +57 at equal fuel. On the site it's called Distilled Morse. Measured directly, v11 beat requin2 by +126 ± 24, and Mont Blanc 98.8% of the time.

Everything that didn't work

After v13 came four more plans: Fable (a better student), Cortex93 (a convolutional network), Doc Gyneco (below) and Eminem, which studies its opponents' games before the battle. With Morse's own dead ends, failures outnumber wins:

  • Threat extensions (search one ply deeper when a winning exit is threatened): −37. Threats last many plies in a race, and extending each one eats the node budget.
  • Correction history (a recent Stockfish trick that learns, per position signature, how wrong the static evaluation tends to be): −120. My signature was too coarse, so the corrections were noise of up to ±300 that skewed every pruning decision.
  • A hybrid MCTS (Monte Carlo tree search with small alpha-beta searches inside) looked exactly equal to alpha-beta in the native duel. In the arena it scored 4% (−552 ± 95): an MCTS node cost about 900,000 fuel against 106,000. A duel at equal nodes means nothing if the engines don't pay the same price per node.
  • More data of the same quality: −3. Bigger networks (64 and 128 neurons): no validation gain. A second round of distillation, with v13 as teacher and twice the data: six students, −17 on average. A deeper teacher (Fable, 500,000 nodes): +13 ± 22, inconclusive.
  • "Clean" data, keeping only quiet positions as chess folklore recommends: −24. My quiescence search evaluates exactly the positions where the opponent has captures, and I had thrown those away.
  • ProbCut (cut a branch when a shallow search predicts the deep one will fail): +11 ± 15 at best, −28 with a tighter margin.
  • A convolutional network (Cortex93), seeing the board as an image, KataGo-style. Alone, it learned the 160 training terrains by heart. With 1,000 synthetic terrains it generalised, but only to the level of the linear evaluation. As a correction on top of v13's network it finally cut the error by 13 to 17%, but even a micro version (two layers of 8 filters) cost at least 187 times v13's network in fuel. Five pilots, a bit more than a day, abandoned.
  • SPSA (tuning all search margins at once from slightly perturbed game pairs): stopped by its own rule after 100 iterations, no margin having moved a fifth of a step.
  • An opponent model (Eminem), trained on 113,114 moves by other bots on the site, beat my ordering by 4.5 points at guessing their move. The threshold, written down beforehand, was 5. Abandoned.

The pattern: every extra bit of selectivity lost, and every 13 to 18% of extra fuel per node cost 10 to 20 Elo.

The comeback through the inputs

Cortex93 left one clue: about 10% of information the small network couldn't see. Doc Gyneco went looking for it. Removing the convolutional network's input planes group by group put almost all of it in the threats planes, and showed it was spatial: with 1×1 filters (each square only sees itself), 14% of the gain remained. The signal isn't "this piece is attacked", it's who threatens what around each piece.

So I wrote four hand-made inputs per piece: how many enemies can take it, how many it can take, how much of its path to the exit is covered, how many enemies are within two squares. They cost 9.4% more fuel per node. At equal fuel, Doc Gyneco beat v13 by +69 ± 22 over 1,000 games, and on 27 October it took first place on the site's leaderboard.

Measuring is the hard part

The most humbling lessons weren't about bots at all.

Noise is huge. 800 games give ±22 Elo, for changes worth 10 to 20. Retraining v11's network on the same data with other seeds gave −25 and 0 against the original. v13 was itself the best of four seeds (+41, 0, +20, +14), so every later network was compared to a lucky draw: the winner's curse. After that, candidates only faced a control trained the same way, on the same seeds.

Validation doesn't predict play. One student validated as well as v13's network and lost by 64 Elo.

The lab isn't the site. v13 beat v11 by +57 in my arena, but on the site v11 ranked ahead of it (2325 vs 2299, within the margins). My test pool was all Morse versions: inbred. And the site played a different game, with 67% of games ending on a Sentinel exit against 40% locally. Big gaps do transfer, though. On 30 November, after about 3,000 games each, Doc Gyneco sits at 2196 ± 14 and Distilled Morse at 2127 ± 13: the same 69 points the lab measured.

Read your losses. I replayed every loss with a 200,000-node search and marked the decisive mistake. Of 439 local losses, 64.5% were "positional", with no tactical cause, 18.9% left a piece hanging, and 27% of decisive mistakes came in the first 20 plies. On the site, 75.9% of v13's 87 losses were positional. In its Sentinel losses, the decisive mistake came a median 14 plies before the opponent's Sentinel exited, and only 3 of 59 within the last 6 plies. The race was lost in the middlegame, long before anyone could see it. So the Sentinel-race solver I'd planned since Morse (df-pn, a proof search over threats and replies) was dropped before I wrote a line of it.

Other people are good. On 26 October the number one wasn't mine: Base44 led both Morses. Doc Gyneco took the top spot the next day. On 30 November it's fourth, behind Tainted_Soul, T1 Faker and Tar_Soul, and Tainted_Soul, now at its 15th version, wasn't even in the top five a month earlier.

A lot of the bots up there come from vibe coders, and the label undersells them. They play the game. They have a feel for which moves are wrong, and they hand that intuition to an AI coding agent that writes the code. I started from search algorithms and worked my way toward the game; they started from the game and let the agent handle the algorithms. On this leaderboard, their approach works better than mine. For the record, I spent three years on a PhD in multi-agent systems, and the arena doesn't read theses. It reads win rates.

There's a less romantic reading too. The evaluation is public: submit a bot and you know exactly where it stands. With a feedback signal that clean, the first iterations are easy. Each new version fixes an obvious weakness and climbs, and for a while first place looks like a matter of tokens. But the curve flattens. After enough versions, the obvious weaknesses are gone, the gains shrink to noise, and spending more tokens mostly buys another bot at the same level. Past that point, iterating stops being enough, and you have to understand why the bot loses.

That's the fun part. Also slightly humbling.

What I'd tell someone starting

  1. Price everything in the arena's currency. A gain at equal nodes isn't a gain until it survives at equal fuel.
  2. Fix the evaluation before deepening the search. Inside it, inputs and labels matter more than network size.
  3. Write the threshold before the experiment, and pilot at a tenth of the cost. A failed pilot is a cheap result.
  4. Never compare against a selected winner. Use a control trained the same way.
  5. Leave your lab early. Play the real leaderboard and read your losses.
  6. Keep a journal with every failed number, so you never pay for the same idea twice.

The SDK and example bots are on GitHub, and the arena is open at traversal-bot.app. Come and take fourth place from me.