59fad00b5c
A minimal Tank Royale bot that boots and stands still. Body, gun and radar are set to white once at init (team convention: white = not programmed yet); the tick loop only calls go(). - DevControlBot/ holds the single bot module, its metadata JSON, the BotLauncher entry script and the nimble file - DevControlBot.sh is a thin wrapper around the runBot nimble task: release build by default, --debug for the classic diagnostic build - dependencies resolve at run time from the global nimble store via `nimble path`; optional .env (gitignored) supplies env vars such as SERVER_URL, with existing environment variables taking precedence - build happens in a throwaway mktemp dir removed on exit; no artifacts
33 lines
1.1 KiB
Nim
33 lines
1.1 KiB
Nim
## DevControlBot — control skeleton: boots, stands still, does nothing.
|
|
##
|
|
## Team convention: white means "not programmed yet", so body, gun and radar are
|
|
## all plain white. Colors are applied once at initialization, never per tick.
|
|
##
|
|
## This module is both the bot type and the program entry point (see isMainModule
|
|
## below); there is no separate top-level DevControlBot.nim.
|
|
##
|
|
## API: robocode_tankroyale_botapi 1.0.7 (the renamed tankroyale_botapi package).
|
|
import std/os
|
|
import robocode_tankroyale_botapi
|
|
|
|
type DevControlBot* = ref object of Bot
|
|
|
|
proc newDevControlBot*(): DevControlBot =
|
|
result = DevControlBot()
|
|
setBodyColor(WHITE)
|
|
setTurretColor(WHITE)
|
|
setGunColor(WHITE)
|
|
setRadarColor(WHITE)
|
|
|
|
method run*(bot: DevControlBot) =
|
|
while isRunning():
|
|
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)
|