refactor: strip _garage suffix from adversarial test bots
Renames PatternMover_garage → PatternMover, RandomMover_garage → RandomMover, WaveSurfer_garage → WaveSurfer. Updates all .json, .sh, .nimble, and config.nims files to match TR Booter naming convention (directory name = bot name). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# RandomMover — random speed/turn with persistence, head-on firing.
|
||||
# Purpose: test guns against unpredictable movement.
|
||||
|
||||
import std/[math, os, random]
|
||||
import tankroyale_botapi
|
||||
|
||||
const botJsonPath = currentSourcePath().parentDir / "RandomMover.json"
|
||||
|
||||
type RandomMover = ref object of Bot
|
||||
currentSpeed: float
|
||||
currentTurn: float
|
||||
ticksUntilChange: int
|
||||
|
||||
proc newDirection(bot: RandomMover) =
|
||||
bot.currentSpeed = rand(-8.0..8.0)
|
||||
bot.currentTurn = rand(-10.0..10.0)
|
||||
bot.ticksUntilChange = rand(10..20)
|
||||
|
||||
method onRoundStarted*(bot: RandomMover, e: RoundStartedEvent) =
|
||||
randomize()
|
||||
setAdjustGunForBodyTurn(true)
|
||||
setAdjustRadarForBodyTurn(true)
|
||||
setAdjustRadarForGunTurn(true)
|
||||
newDirection(bot)
|
||||
|
||||
method onScannedBot*(bot: RandomMover, e: ScannedBotEvent) =
|
||||
let bearing = directionTo(getX(), getY(), e.x, e.y)
|
||||
let gunDelta = normalizeRelativeAngle(bearing - getGunDirection())
|
||||
setGunTurnRate(gunDelta.clamp(-MAX_GUN_TURN_RATE, MAX_GUN_TURN_RATE))
|
||||
if abs(gunDelta) < 10.0 and getGunHeat() <= 0.0:
|
||||
discard setFire(1.0)
|
||||
|
||||
method run*(bot: RandomMover) =
|
||||
while isRunning():
|
||||
dec bot.ticksUntilChange
|
||||
if bot.ticksUntilChange <= 0:
|
||||
newDirection(bot)
|
||||
|
||||
setTargetSpeed(bot.currentSpeed)
|
||||
setTurnRate(bot.currentTurn)
|
||||
setRadarTurnRate(45.0)
|
||||
go()
|
||||
|
||||
when isMainModule:
|
||||
var bot = RandomMover()
|
||||
start(bot, botJsonPath)
|
||||
Reference in New Issue
Block a user