style(ModularBot): ANSI colored log tags — gun yellow, move cyan
This commit is contained in:
@@ -32,6 +32,14 @@ const DebugVBullets = false
|
||||
const DebugCircular = false
|
||||
const GunNames = ["HeadOn", "Linear", "Tsetlin", "Circular", "GuessFactor", "Pattern", "AntiSurf", "WallBounce", "Accel", "StopShot", "Displace", "AvgLead", "DecayGF"]
|
||||
|
||||
const
|
||||
CLR_GUN = "\e[33m" # yellow
|
||||
CLR_MOVE = "\e[36m" # cyan
|
||||
CLR_FIRE = "\e[31m" # red
|
||||
CLR_RADAR = "\e[32m" # green
|
||||
CLR_ROUND = "\e[1;37m" # bold white
|
||||
CLR_RST = "\e[0m" # reset
|
||||
|
||||
type
|
||||
ModularBot = ref object of Bot
|
||||
hasContact: bool
|
||||
@@ -164,7 +172,7 @@ method onScannedBot*(bot: ModularBot, e: ScannedBotEvent) =
|
||||
|
||||
# Log gun switch + update turret/bullet colors
|
||||
if selectedGun != bot.currentGun:
|
||||
echo fmt"[gun] switched: {GunNames[selectedGun]}"
|
||||
echo CLR_GUN & fmt"[gun] switched: {GunNames[selectedGun]}" & CLR_RST
|
||||
bot.currentGun = selectedGun
|
||||
case selectedGun
|
||||
of 0: setTurretColor("#FF3333"); setBulletColor("#FF6666") # HeadOn: warm red
|
||||
@@ -218,7 +226,7 @@ method onHitByBullet*(bot: ModularBot, e: HitByBulletEvent) =
|
||||
method onRoundEnded*(bot: ModularBot, e: RoundEndedEventForBot) =
|
||||
let newId = bot.moveTracker.bestMovement()
|
||||
if newId != bot.movementId:
|
||||
echo "[move] switching: ", (if newId == 0: "phantom_meteor" else: "wave_surfer")
|
||||
echo CLR_MOVE & "[move] switching: " & (if newId == 0: "phantom_meteor" else: "wave_surfer") & CLR_RST
|
||||
bot.movementId = newId
|
||||
|
||||
method onRoundStarted*(bot: ModularBot, e: RoundStartedEvent) =
|
||||
@@ -236,13 +244,13 @@ method onRoundStarted*(bot: ModularBot, e: RoundStartedEvent) =
|
||||
if bot.movementId == 0:
|
||||
bot.mover.resetRound()
|
||||
setBodyColor("#FF9900") # PhantomMeteor: deep orange/gold
|
||||
echo "[move] using phantom_meteor"
|
||||
echo CLR_MOVE & "[move] using phantom_meteor" & CLR_RST
|
||||
else:
|
||||
bot.waveMover.resetRound()
|
||||
setBodyColor("#0099FF") # WaveSurfer: blue
|
||||
echo "[move] using wave_surfer"
|
||||
echo CLR_MOVE & "[move] using wave_surfer" & CLR_RST
|
||||
|
||||
echo fmt"[gun] starting: {GunNames[0]}"
|
||||
echo CLR_GUN & fmt"[gun] starting: {GunNames[0]}" & CLR_RST
|
||||
# tracker fitness persists across rounds (rolling window carries over)
|
||||
|
||||
method onGameStarted*(bot: ModularBot, e: GameStartedEventForBot) =
|
||||
@@ -266,7 +274,7 @@ method run*(bot: ModularBot) =
|
||||
let activeId = bot.moveTracker.bestMovement()
|
||||
if activeId != bot.movementId:
|
||||
bot.movementId = activeId
|
||||
echo "[move] switched to: ", (if activeId == 0: "phantom_meteor" else: "wave_surfer")
|
||||
echo CLR_MOVE & "[move] switched to: " & (if activeId == 0: "phantom_meteor" else: "wave_surfer") & CLR_RST
|
||||
let (spd, tr) = if bot.movementId == 0: phantomCmd else: waveSurfCmd
|
||||
setTargetSpeed(spd)
|
||||
setTurnRate(tr)
|
||||
|
||||
Reference in New Issue
Block a user