root@kaus.com:~/projects$ cat ai-bomber.md
AI Bomber
researchPersonal
Kbit · page guide
1 / 4
Use the section map on long studies.
Jump between methodology, results, experiments, limitations, and related writing without losing your place.
2 / 4
The narrative carries the claim.
Read each section as problem, method, evidence, and boundary. Negative results remain part of the story.
3 / 4
Inspect figures alongside the narrative.
Read figures in place, scroll wide charts or tables horizontally, and follow any source links for the underlying evidence.
4 / 4
Keep exploring the corpus.
A Bomberman self-play project where win-cause audits retracted a strength claim and tactical gates stopped a later training run.
I built a deterministic C17 game simulator and native C++/LibTorch training pipeline, then tested what its winning checkpoints actually did. An early strength claim failed when most wins proved to be arena-crush outcomes. Later work rebuilt training around an opponent ladder and tactical gates, and a saved-champion audit kept the deployed artifact distinct from the latest network.
Technologies
- C17
- raylib
Skills
- Simulation
- C
- Agent self-play
Links
Related projects
- Headless simulator throughput: ~234,000 steps/sec, single core, no visualizer linked
- 12 CTest suites covering determinism, replay, reward, danger, and hardening
- 8 design docs; 59 C source and header files, 4,296 lines, ~146 KB across src/
- CI matrix: GCC + Clang (-Werror) and MSVC, full suite on every push and PR
- AlphaZero v1 iteration-70 checkpoint, untouched holdout: 66.02% vs native heuristic (41W-87D-0L), zero losses vs all opponents
A win count was not enough
AI Bomber began as a deterministic Bomberman-style environment and grew into an AlphaZero self-play project. Its most consequential result was a retraction. A checkpoint passed an agent-ladder gate, but an outcome audit found that almost all of its wins came from the closing arena crushing the opponent. The score established survival under those rules, while the published claim implied broader combat ability.
That distinction changed the evaluation. Later runs used outcome attribution, tactical probes, and explicit continue-or-stop criteria. A staged rebuild made progress through an opponent ladder, then stopped when self-play failed its consistency requirement. The latest audit asks a further question: do those tactical measurements describe the saved champion that will actually be used, or only the latest network produced by training?
Make the game reproducible before learning from it
Bomb-based play depends on delayed consequences. A tile that is safe now may be lethal when the agent arrives, and a policy needs to reason about movement, blast propagation, escape routes, and the opponent together. If simulation state leaks between agents or danger checks use the wrong time, training can optimize against behavior the evaluator did not intend.
I built the original environment around bounded state, seeded randomness, explicit rules, and inspectable rewards. The base implementation supported rule-based agents before a neural trainer existed. That ordering made it possible to test game behavior on its own and later attach search and learning through the same environment boundary.
One simulation under the tools
The C17 core owns configuration, seeded state, replay storage, and episode metrics. Environment modules implement map generation, movement, bombs and blasts, danger predictions, observations, rewards, and termination. Agents have a shared function-pointer interface with their own storage. Headless runners, benchmarks, evaluators, and the raylib viewer consume the same observation-action-step loop.
Fixed-size state avoids heap pointers in the saved representation and makes copying and serialization straightforward. It also imposes real limits, including a 31x31 maximum grid and fixed bounds on agents and bombs. The visualizer is optional at build time, so headless rollouts do not need graphics dependencies. Native C++/LibTorch training was added above this core rather than replacing the game rules.
architecture · ai-bomber
Small state bugs can change an experiment
The early hardening pass repaired a concrete isolation bug: heuristic and greedy agents used file-static implementation state. Two instances could share random state and interfere with each other. Moving that storage into each agent made independent instances possible and turned the isolation requirement into a tested contract.
Danger checking similarly needed the time of arrival, rather than only the current tile state. A named arrival-time check uses the predicted time to a blast to judge a move. Reward accounting keeps survival, crate destruction, damage, elimination, escape, and penalties separately visible before summing them. That decomposition is useful when an agent’s preferred behavior and the intended task diverge.
The base simulator has 12 CTest suites covering rules, determinism, replay, rewards, agents, and danger, with GCC, Clang, and MSVC in the configured CI matrix. Its reported headless throughput of about 234,000 steps per second comes from a historical commit-message benchmark, not a new measurement in this case study. The original results figure below describes that foundation, not the later learner’s strength.
| Metric | Value | Detail |
|---|---|---|
| Throughput | ~234,000 steps/sec | single core, no visualizer linked |
| Test suites | 12 CTest suites | test_agents, test_blast, test_bomber_env, test_bombs, test_danger, test_determinism, test_hardened, test_map, test_observation, test_replay, test_reward, test_rng |
| Design docs | 8 docs | ARCHITECTURE, ENV_API, OBSERVATION, REWARD, DANGER_MAP, VISUALIZER, ADDING_AGENTS, FUTURE_MODELS |
| Source size | 59 files · 4,296 lines | src/*.c + src/*.h, ~145 KB total |
| CI | 2 jobs / push + PR | GCC + Clang -Werror (Ubuntu), MSVC (Windows), full CTest suite each |
results · ai-bomber · verified against commit c50f423 (2026-07-06)
A learned checkpoint, with a modest trajectory
The first native AlphaZero run completed 100 iterations using a 128-channel, 10-block residual network with 3,250,839 parameters. The retained checkpoint came from iteration 70. Validation improved early, regressed, and recovered to a modestly higher plateau. The run did not show the sharp late transition its grokking hypothesis called for.
Early evaluation was also contaminated by the bootstrap heuristic used in search. Scores from iterations 5 through 20 were heuristic-aided and cannot be read as clean neural-policy results. The later holdout evaluation used the retained checkpoint on seeds excluded from self-play and selection. Keeping that distinction matters because a learning curve can mix different sources of decision quality even when its label stays the same.
run · results/alphazero-native-grokking-v1 · checkpoint eval seed base 900,001 · ringed markers = promoted (iterations 5, 20, 70) · dashed line at 50% is a reference, not a baseline claim
alphazero trajectory · ai-bomber
Read the draws and the opponent beside the score
On the original untouched holdout, the iteration-70 checkpoint recorded 128 wins against random, 41 wins and 87 draws against the native heuristic, and 2 wins and 14 draws against native MCTS, with no losses in those sets. The corresponding heuristic and MCTS scores were 66.02% and 56.25%, counting a draw as half a win. The strong draw component is part of the result, not something a percentage should hide.
The opponent budget also bounds the conclusion. A later diagnostic against a strengthened MCTS opponent with 512 simulations and depth 16 produced 16 draws and no wins. That used a different diagnostic set, so it is not a paired estimate of the budget’s effect. It does establish that the earlier holdout score was insufficient evidence of superiority to the stronger search baseline. A comparison with an earlier NumPy model likewise used different seeds and search budgets and cannot support a clean improvement claim.
Draw-adjusted score = (wins + 0.5 × draws) / games. The 66.02% result combines 41 wins and 87 draws across 128 games.
holdout artifact sha-256 9b3f533b…c2e852c · seed ranges and search budgets differ between the two runs compared above, so the baseline-vs-result pair is not a paired statistical test (doc's own caveat)
alphazero holdout · ai-bomber
The retraction changed what counted as progress
Continuation runs eventually produced a v5 checkpoint described as superhuman on the project’s agent ladder. The next audit found that 95 to 97% of its wins were arena-crush deaths. With sudden death disabled, a control collapsed to near-all draws. The reward assigned the same full value to a crush win and a bomb-kill, while a win-draw-loss gate could not distinguish the two. The claim was retracted and the original document retains that correction.
A bounded replay-reweighting intervention then produced 1 bomb-kill win in 64 games against the control’s 0 in 64, below its frozen success bar, and was stopped. The v7 restart used search and target repairs, teacher imitation, a gated opponent ladder, and guarded self-play. The ladder reached MCTS at 256 simulations, but the following 40-iteration self-play tranche failed tactical consistency: only 3 of 8 probes met the required gate count, against 6 of 8 required.
The smoothed top-rung win-rate criterion held at all 8 probes, which did not mean every raw probe was a winning result. No champion was promoted during that tranche. The July stop was honored, leaving the iteration-65 ladder champion in place. The experiments below retain the intervention and staged-training details without presenting the repeatedly observed ladder as an unseen-opponent strength test.

Measure the champion that will actually be used
The training canary had been measuring the latest network, while the deployable artifact remained the saved champion. The September audit ran both through the same six standalone tactical scenarios, serially, with one native binary and 96-simulation search. It bound every result to checkpoint identity. The standalone seeds differ from the historical canary, so this is a new diagnostic comparison rather than a rerun of July.
The iteration-65 champion passed four scenarios and the iteration-110 checkpoint passed three. Both passed bomb escape, corridor clearing, and trapping, and both failed chase and flame timing. Stall-breaking separated them: the champion passed while the latest exhausted the step budget. Their training histories differ, so this is not a causal estimate of self-play’s effect or a full-game win rate.
The accompanying replay is equally specific. On the first predetermined diagnostic seed, the champion moved and placed bombs, then won at step 121 when the arena crushed the heuristic opponent. There was no bomb-kill. Native saved-state playback and the screenshot were checked, but a separate deterministic resimulation was not performed. The artifact makes the behavior inspectable without turning one illustrative win into combat mastery.
| Scenario | Champion · 65 | Latest · 110 |
|---|---|---|
| Bomb and escape | Pass | Pass |
| Chase | Fail | Fail |
| Clear a corridor | Pass | Pass |
| Flame timing | Fail | Fail |
| Break a stall | Pass | Fail |
| Set a trap | Pass | Pass |
| Passed | 4/6 | 3/6 |

The stopped run remains the result
The project now has a reproducible simulation, a native learning pipeline, retained negative interventions, and checkpoint-specific tactical evidence. Those are useful systems results alongside an unfinished strength claim. The saved champion is not interchangeable with the last training output, a diagnostic gate is not a held-out win rate, and winning by the environment’s closing wall does not demonstrate every skill the game requires.
No training or reserved holdout was consumed for the September audit, and the July stop remains in effect. A further strength claim would need its own declared evaluation, opponent identities, win-cause accounting, and the required controls. Checkpoint-backed human play and full-simulator PPO are separate unfinished work. The immediate achievement is that the project can now attach a narrower, checkable meaning to each reported result.
Experiments
2 experiment write-ups · continued development log
Capped cause-balanced replay reweighting · 2026-07 · completed
Setup
A separate policy-action diagnostic traced the trained policy's raw argmax and found it chose the WAIT action on 63 to 65 percent of steps across four checkpoints, a local optimum rather than an exploration bug. The replay-reweighting experiment tested one fix for it: up-weighting replay samples toward bomb-kill-decisive trajectories, capped at 0.25, against a control arm capped at 0. Both arms forked from the same v6 checkpoint (control03-130) with an identical learning-rate schedule (33,280 updates), and the intervention's pass or fail criteria were frozen and committed before either arm ran, which continued to iteration 154.
Result
The treatment arm produced a bomb-kill rate of 1 out of 64 games against the control arm's 0 out of 64, well short of the frozen bar of at least 6 needed to justify the intervention. A reweighting tracer showed why: the sampler was up-weighting whole winning trajectories, including the passive lead-up before the kill, not the kill-decisive steps themselves, which defeats the local credit assignment the intervention depended on. Reported against the criteria frozen before the run rather than reinterpreted afterward, the verdict was flat to negative, and the intervention was killed.
What it changed
Replay reweighting was not iterated on or retried with new hyperparameters. Combined with the opponent-model ablation's mixed verdict on the same underlying WAIT-bias equilibrium (the mechanism is real, but bomb-prior starvation gates it off), the result was read as evidence that adjusting the data or the reward after training was not enough on its own. The project's response was a full literature-grounded restart, v7, which addressed the same WAIT-collapse mechanism directly inside training instead of patching the replay buffer after the fact, covered in the next experiment.
v7: a staged rebuild from IL bootstrap to guarded self-play · 2026-07 · completed
previously
Replay reweighting and the opponent-model ablation each targeted the same WAIT-collapse equilibrium and each came back flat or only partially confirmed, so patching the existing recipe was abandoned in favor of a full restart. v7 was a literature-grounded redesign, informed directly by a Pommerman and AlphaZero-family survey, executed as four pre-registered stages: Stage 0 search and target repairs, Stage 1 a teacher imitation-learning bootstrap, Stage 2 a gated algorithmic opponent ladder, and Stage 3 guarded self-play, each stage gated before the next could start.
Setup
Stage 1 trained the policy against a curriculum of teacher opponents and had to clear a pre-registered exit gate (at least 4 of 6 criteria, including a bomb-usage rate that reached 10.5 percent) before Stage 2 could start. Stage 2 then promoted the resulting policy up a fixed ladder of opponents in order, random, evasive, greedy-crate, heuristic, alpha-beta, MCTS at 64 simulations, and finally MCTS at 256 simulations, the same class of opponent used as the Stage 1 teacher, with a pre-registered continue-or-stop rule at every rung.
Result
Stage 1 passed its exit gate, and by then the policy's WAIT rate had already fallen to 3.4 percent against the v6 baseline of 63 to 74 percent. Stage 2 cleared every rung on the ladder, holding the top rung, MCTS at 256 simulations, across two probes at scores of 0.656 and 0.641: the IL-trained student was beating the same class of model used as its own teacher in roughly 64 to 69 percent of noise-off diagnostic probes. The last five iterations of Stage 2 recorded a WAIT rate of 17.7 percent, still below the v6 baseline. These stage summaries are not a matched evaluation comparison. Stage 3 then ran guarded self-play for 40 more iterations and reached a plateau: the smoothed top-rung win-rate criterion held on all 8 probes, and by iteration 105 every one of the six behavioral gates had passed at least once over the course of the run, flame-timing, the last to do so, passing for the first time at that exact iteration. The canary criterion, at least 4 of 6 gates passing per probe, was still met in only 3 of 8 probes, short of the 6 of 8 required, and the pre-registered rule for that outcome was stop.
What it changed
The stop was honored rather than re-argued: zero champions were promoted across the whole Stage 3 tranche, and the iteration-65 ladder champion held for all 40 iterations. The write-up calls the result a plateau with tactical oscillation, not a pathology, since the guards against drift worked even though self-play itself added no measurable strength over the ladder-trained champion. Three follow-up designs were proposed in the same write-up, a claim-preparation pass on the frozen champion, a lower-mirror-fraction Stage-3b variant, and gates-on-champion instrumentation, and none had launched as of the July 14 stop. The September audit in this case study subsequently measured the saved champion; no new training recipe was launched.
notes
- At the case-study base commit (c50f423, 2026-07-06) there is no trained neural agent, only rule-based agents. The AlphaZero self-play campaign that followed (July 7 to 14, 2026) produced a real trained checkpoint and is covered in its own sections below, including one retracted claim.