diff --git a/common_libs/test_framework/adversaries/WallsBot/WallsBot.json b/common_libs/test_framework/adversaries/WallsBot/WallsBot.json new file mode 100644 index 0000000..f701136 --- /dev/null +++ b/common_libs/test_framework/adversaries/WallsBot/WallsBot.json @@ -0,0 +1,9 @@ +{ + "name": "WallsBot", + "version": "0.1.0", + "authors": ["Test"], + "description": "Traces arena perimeter clockwise — test adversary for lead prediction", + "gameTypes": ["classic", "1v1"], + "platform": "Nim", + "programmingLang": "Nim" +} diff --git a/common_libs/test_framework/adversaries/WallsBot/WallsBot.sh b/common_libs/test_framework/adversaries/WallsBot/WallsBot.sh new file mode 100755 index 0000000..937faf7 --- /dev/null +++ b/common_libs/test_framework/adversaries/WallsBot/WallsBot.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd "$(dirname "$0")" +exec ./out/WallsBot 2>> /tmp/wallsbot_stderr.log diff --git a/common_libs/test_framework/adversaries/WallsBot/config.nims b/common_libs/test_framework/adversaries/WallsBot/config.nims new file mode 100644 index 0000000..594b66e --- /dev/null +++ b/common_libs/test_framework/adversaries/WallsBot/config.nims @@ -0,0 +1,2 @@ +--path:"../../.." +switch("outdir", "out") diff --git a/common_libs/test_framework/adversaries/WallsBot/src/WallsBot.json b/common_libs/test_framework/adversaries/WallsBot/src/WallsBot.json new file mode 100644 index 0000000..f701136 --- /dev/null +++ b/common_libs/test_framework/adversaries/WallsBot/src/WallsBot.json @@ -0,0 +1,9 @@ +{ + "name": "WallsBot", + "version": "0.1.0", + "authors": ["Test"], + "description": "Traces arena perimeter clockwise — test adversary for lead prediction", + "gameTypes": ["classic", "1v1"], + "platform": "Nim", + "programmingLang": "Nim" +} diff --git a/common_libs/test_framework/adversaries/WallsBot/src/WallsBot.nim b/common_libs/test_framework/adversaries/WallsBot/src/WallsBot.nim new file mode 100644 index 0000000..53200f0 --- /dev/null +++ b/common_libs/test_framework/adversaries/WallsBot/src/WallsBot.nim @@ -0,0 +1,24 @@ +# WallsBot — traces arena perimeter clockwise. No firing; pure evasion target. +# Turns right 90° on wall hit, then charges forward at max speed. + +import std/os +import tankroyale_botapi + +const botJsonPath = currentSourcePath().parentDir / "WallsBot.json" + +type WallsBot = ref object of Bot + +method onRoundStarted*(bot: WallsBot, e: RoundStartedEvent) = + setTurnRate(90.0) # begin with a right turn to face along the nearest wall + +method onHitWall*(bot: WallsBot, e: HitWallEvent) = + setTurnRate(90.0) # turn right 90° then keep going + +method run*(bot: WallsBot) = + while isRunning(): + setTargetSpeed(MAX_SPEED) + go() + +when isMainModule: + var bot = WallsBot() + start(bot, botJsonPath)