feat(test_framework): use TR_SAMPLE_BOTS env var for external bot directory
Adds TR_SAMPLE_BOTS env var support to point to external sample bots (Walls, Fire, SpinBot, etc). Updates test_bullet_economy.nim to use Walls from the sample-bots directory instead of custom WallsBot, removing the hardcoded path dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
## Bullet economy test: SNNBot vs WallsBot.
|
||||
## Prints per-round and summary stats for tuning. No hard pass/fail.
|
||||
## Requires TR server JARs (set TR_SERVER_JAR / TR_BATTLE_RUNNER env vars).
|
||||
## Set TR_SAMPLE_BOTS to point to sample-bots directory (e.g. sample-bots-nim-linux-1.0.7).
|
||||
|
||||
import std/[os, strformat]
|
||||
import test_framework/battle_result
|
||||
@@ -8,19 +9,27 @@ import test_framework/battle_result
|
||||
const
|
||||
DefaultServerJar = "/home/davide/Projects/tank-royale/server/build/libs/robocode-tankroyale-server-0.35.5-all.jar"
|
||||
DefaultRunnerJar = "/home/davide/Projects/tank-royale/runner/examples/lib/robocode-tankroyale-runner.jar"
|
||||
DefaultSampleBots = "/home/davide/Downloads/robocode-tankroyale/sample-bots-nim-linux-1.0.7"
|
||||
|
||||
let serverJar = getEnv("TR_SERVER_JAR", DefaultServerJar)
|
||||
let runnerJar = getEnv("TR_BATTLE_RUNNER", DefaultRunnerJar)
|
||||
let sampleBotsDir = getEnv("TR_SAMPLE_BOTS", DefaultSampleBots)
|
||||
|
||||
if not fileExists(serverJar) or not fileExists(runnerJar):
|
||||
echo "Skipping: JAR files not found (set TR_SERVER_JAR / TR_BATTLE_RUNNER to override)"
|
||||
quit(0)
|
||||
|
||||
if not dirExists(sampleBotsDir):
|
||||
echo "Skipping: sample bots directory not found at ", sampleBotsDir
|
||||
echo "Set TR_SAMPLE_BOTS to override"
|
||||
quit(0)
|
||||
|
||||
import test_framework/test_framework
|
||||
|
||||
const
|
||||
snnbotDir = currentSourcePath().parentDir.parentDir
|
||||
wallsbotDir = currentSourcePath().parentDir.parentDir.parentDir /
|
||||
"common_libs" / "test_framework" / "adversaries" / "WallsBot"
|
||||
snnbotDir = currentSourcePath().parentDir.parentDir
|
||||
|
||||
let wallsbotDir = sampleBotsDir / "Walls"
|
||||
|
||||
let r = runBattle(@[snnbotDir, wallsbotDir], rounds = 10)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user