feat(BNNBot): print Hamming distance from previous tick

This commit is contained in:
2026-09-17 22:58:14 +02:00
parent 27cc5720a3
commit fa4c36acfe
2 changed files with 7 additions and 1 deletions
Binary file not shown.
+7 -1
View File
@@ -20,6 +20,8 @@ type
heading: float # enemy heading (degrees)
distance: float
tick: int
prevVec: BinaryVector
hasPrev: bool
method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
let bx = getX(); let by = getY()
@@ -41,7 +43,10 @@ method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
heading: bot.heading,
)
let vec = encode(scan)
echo $bot.tick, " ", formatBinary(vec)
let distance = if bot.hasPrev: hammingDistance(bot.prevVec, vec) else: 0
echo $bot.tick, " ", formatBinary(vec), " ", distance
bot.prevVec = vec
bot.hasPrev = true
method onRoundStarted*(bot: BNNBot, e: RoundStartedEvent) =
setAdjustGunForBodyTurn(true)
@@ -51,6 +56,7 @@ method onRoundStarted*(bot: BNNBot, e: RoundStartedEvent) =
bot.hasContact = false
bot.hasLastPos = false
bot.tick = 0
bot.hasPrev = false
setTargetSpeed(0.0)
setTurnRate(0.0)