Files
SirRoboGarage/ModularBot_garage/tests/test_accel_gun.nim
SirStone c034eb9d25 feat(testing): gun rack gauntlet + analysis reports
- fix(ModularBot): onBulletHitBot → onBulletHit (real hits were never tracked)
- feat(ModularBot): per-round gun stats dump to /tmp/gun_stats.jsonl
- feat(ModularBot): gun selection counter per round
- fix(tests): adversary paths _garage suffix removed from 7 test files
- feat(tests): test_gauntlet_5bots.nim — 10-round gauntlet vs all 5 adversaries
- feat(tests): analyze_gun_stats.nim — JSONL parser for gun performance tables
- docs: gun_rack_analysis.md — full per-gun performance report
- docs: gun_rack_summary.md — TL;DR verdict table (keep/drop/tune)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-09-20 21:14:12 +02:00

35 lines
1.6 KiB
Nim

## Test AccelGun: 3 battles vs Crazy, RandomMover, Walls — 10 rounds each.
## Run with: nim c -r --path:../../common_libs tests/test_accel_gun.nim
import std/[os, strformat]
import test_framework/test_framework
const
modularBotDir = currentSourcePath().parentDir.parentDir
samplesDir = "/home/davide/Downloads/robocode-tankroyale/sample-bots-nim-linux-1.0.7"
crazyDir = samplesDir / "Crazy"
wallsDir = samplesDir / "Walls"
randomMoverDir = "/home/davide/Projects/SirRoboGarage/common_libs/test_framework/adversaries/RandomMover"
if not fileExists("/home/davide/Projects/tank-royale/server/build/libs/robocode-tankroyale-server-0.35.5-all.jar") or
not fileExists("/home/davide/Projects/tank-royale/runner/examples/lib/robocode-tankroyale-runner.jar"):
echo "Skipping: Tank Royale JARs not found"
quit(0)
proc runAndReport(label, enemyName, enemyDir: string) =
echo fmt"\n=== {label} ==="
let r = runBattle(@[modularBotDir, enemyDir], rounds = 10, timeout = 180000)
var mbScore = 0
var enScore = 0
for b in r.results:
if b.name == "ModularBot": mbScore = b.totalScore
if b.name == enemyName: enScore = b.totalScore
let winner = if mbScore > enScore: "ModularBot" else: enemyName
echo fmt" ModularBot: {mbScore} {enemyName}: {enScore} → {winner} wins"
echo fmt" Rounds: {r.rounds.len}"
runAndReport("Battle 1/3: vs Crazy", "Crazy", crazyDir)
runAndReport("Battle 2/3: vs RandomMover", "RandomMover", randomMoverDir)
runAndReport("Battle 3/3: vs Walls", "Walls", wallsDir)
echo "\nAccelGun gauntlet complete."