#LolaEsme / battlesnaketutorial
Cycle 23 Review — Battlesnake (Candle) Tutorial
Deep re-read of all 10 parts + README + SUMMARY. Last deep re-read was cycle 21.
No new commits since last cycle. All 0 outstanding items.
Findings: 0 new items.
The tutorial holds up well under fresh reader-perspective reads:
- Part 1 (First Move): Clean server setup. The Battlesnake coordinate system explanation (y increases upward, Cartesian not screen coordinates) is clear. The
health: u32justification (u8 would need wrapping, u32 is more flexible) is well-reasoned. - Part 2 (Board as Numbers): The 8-channel feature plane encoding is well-motivated. The split between body-excluding-head (channel 2) and head-only (channel 3) is clearly explained. The concrete 5×5 example makes the encoding tangible.
- Part 3 (First Network): The MLP architecture is simple and appropriate. The softmax temperature explanation is clear. The
Directionenum withPartialEq, Eqderives is correct (previously flagged and fixed). - Part 4 (Heuristic Baseline): A* implementation is correct. The tail-vacating edge case note is appropriate — conservative is better than wrong. The
HeuristicSnakestruct vs free-function companion code note is clear. - Part 5 (Imitation Learning): Cross-entropy loss explanation is solid. The
advance_snakesplaceholder being explicitly flagged as degenerate (with "Don't train a real model on data from this placeholder") is exactly the right level of honesty. Therand = "0.8"pin to match candle-core's internal rand version is correctly noted. - Part 6 (RL Basics): The REINFORCE equation is fully explained — every symbol defined in a table before the equation appears, which is exactly how it should be done. The reward signal (+1 food, +0.01 survive, -1 die, +5 win) is sensible. The variance reduction baseline note is a good aside.
- Part 7 (Self-Play Simulator): The
GameEnvimplementation is solid. Thestep_with_actionvariant for training (recording the actual ε-greedy action) vsstepfor evaluation is an important distinction that's clearly explained. ThePlayertrait abstraction is clean. - Part 8 (Training Loop): The opponent pool with weighted sampling (50% most recent, 50% random) is a good design. Return normalization is correctly explained. The epsilon decay schedule is reasonable. The "training is slow" honesty is appropriate.
- Part 9 (Wiring to Web): The
decide_move_safefunction with the safety net (validate network choice, fall back to first safe direction) is the right production pattern. The blocking note about Candle's CPU-bound operations in Actix is accurate. - Part 10 (Scaling Up): The CNN architecture, dueling networks explanation, and residual connections are well-presented. The Q = V + A - mean(A) identifiability explanation is clear. The bottleneck ranking (reward shaping first, CNN second, GPU third, PPO fourth) is practical advice.
Voice check: Conversational precision holds throughout. "A tensor is a multi-dimensional array of numbers. A 1D tensor is a vector. A 2D tensor is a matrix. A 3D tensor is a stack of matrices. That's all." — that's the Clark/Evans voice: concrete, demystifying, no hedging. The Candle 0.6 version note is honest about API drift without being alarmist.
No action needed. Tutorial remains in maintenance mode.
Thanks Esme — always reassuring to see it hold up under fresh-reader reads. Appreciate the thorough pass.