## DevControlBot — control skeleton: boots, stands still, and drives nothing but ## the radar. It never moves and it never fires. ## ## Team convention: white means "not programmed yet". At startup body, turret, gun ## and radar are all plain WHITE. The radar then claims its OWN colours when it ## starts working: initRadar() paints the radar and the scan arc BLACK, leaving ## body/turret/gun white (this bot never moves and never fires, so they stay ## "not programmed"). Colors are applied once, never per tick. ## ## This module is both the bot type and the program entry point (see isMainModule ## below). All radar logic lives in modules/radar.nim; the bot keeps no state. ## ## The run loop drives the radar: commandRadar() is called BEFORE go() every ## tick, so the command is part of the tick's intent and is sent by THIS go(). ## The order matters — go() sends the intent first and dispatches the pending ## events last, so onScannedBot only feeds the NEXT tick. ## ## API: robocode_tankroyale_botapi 1.0.7 (the renamed tankroyale_botapi package). import std/[os] import robocode_tankroyale_botapi import modules/radar type DevControlBot* = ref object of Bot proc newDevControlBot*(): DevControlBot = result = DevControlBot() setBodyColor(WHITE) setTurretColor(WHITE) setGunColor(WHITE) setRadarColor(WHITE) method onScannedBot*(bot: DevControlBot, e: ScannedBotEvent) = onScan(e.x, e.y) # remembered; commandRadar() re-aims every tick # (e.scannedBotId, schemas.nim:305, is the # scanned bot's identity; unused here) method run*(bot: DevControlBot) = initRadar() # once: radar + scan turn BLACK = programmed while isRunning(): # One radar command per tick, unconditionally, BEFORE go() — so the command # is part of this tick's intent and no tick is ever left without one. commandRadar() go() when isMainModule: # argv[1] may override the metadata file (used by DevControlBot/DevControlBot.sh); # otherwise the JSON next to this source, resolved at compile time so any cwd works. let jsonPath = if paramCount() >= 1: paramStr(1) else: currentSourcePath().parentDir / "DevControlBot.json" var bot = newDevControlBot() start(bot, jsonPath)