tune(SNNBot): bullet economy tuning vs Walls — 2/10 wins

Changes:
- Fixed fire power at 3.0 (removes hitRateEMA power ladder noise that
  cleared exemplars mid-battle and corrupted learning)
- Relative velocity encoding: input uses (velDir - bearing) instead of
  absolute velDir, so exemplars generalize across Walls' starting walls
- Fix test winner detection to use per-round score delta instead of
  rank field (rank in round_ended is cumulative battle rank, not round winner)
- Keep exemplars across power changes (no longer relevant with fixed power)
- Store lastBulletSpeed at fire time for accurate EVALUATE lead prediction

Result: 2/10 rounds won vs Walls (Nim); first-round win now possible from
round 1 when aimer generalizes from relative velocity patterns.
Bottleneck: sparse exemplars in early rounds; energy bleeds at P3 cold-start.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 21:23:15 +02:00
parent cd0a19dbc5
commit 0384e2ba6a
2 changed files with 26 additions and 38 deletions
+8 -3
View File
@@ -36,15 +36,20 @@ let r = runBattle(@[snnbotDir, wallsbotDir], rounds = 10)
# Per-round stats
echo "=== Per-round results ==="
var snnWins, wallsWins: int
var prevSnn, prevWalls: int
for rnd in r.rounds:
var snn, walls: BotRoundResult
for br in rnd.results:
if br.name == "SNNBot": snn = br
if br.name == "Walls (Nim)": walls = br
# rank 1 = winner; lower rank is better; default rank=0 means bot not found
let winner = if snn.rank > 0 and (walls.rank == 0 or snn.rank < walls.rank): "SNNBot" else: "Walls"
let snnDelta = snn.score - prevSnn
let wallsDelta = walls.score - prevWalls
prevSnn = snn.score
prevWalls = walls.score
# Use per-round score delta to determine round winner (rank field is cumulative battle rank)
let winner = if snnDelta > wallsDelta: "SNNBot" else: "Walls"
if winner == "SNNBot": inc snnWins else: inc wallsWins
echo fmt"Round {rnd.round:2}: {winner} wins | SNNBot score={snn.score} survived={snn.survived} | Walls score={walls.score} survived={walls.survived}"
echo fmt"Round {rnd.round:2}: {winner} wins | SNNBot +{snnDelta}(={snn.score}) rank={snn.rank} survived={snn.survived} | Walls +{wallsDelta}(={walls.score}) rank={walls.rank} survived={walls.survived}"
# Summary
echo ""