## Gauntlet: ModularBot vs WaveSurfer, SpinBot, Crazy — 10 rounds each. ## Captures [gun] lines and scores. Run with: ## nim c -r --path:../../common_libs tests/test_gauntlet.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" waveSurferDir = "/home/davide/Projects/SirRoboGarage/WaveSurfer_garage" spinBotDir = samplesDir / "SpinBot" crazyDir = samplesDir / "Crazy" 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 = 240000) 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 WaveSurfer", "WaveSurfer", waveSurferDir) runAndReport("Battle 2/3: vs SpinBot", "SpinBot", spinBotDir) runAndReport("Battle 3/3: vs Crazy", "Crazy", crazyDir) echo "\nGauntlet complete."