feat(BNNBot): print Hamming distance from previous tick
This commit is contained in:
Binary file not shown.
@@ -20,6 +20,8 @@ type
|
|||||||
heading: float # enemy heading (degrees)
|
heading: float # enemy heading (degrees)
|
||||||
distance: float
|
distance: float
|
||||||
tick: int
|
tick: int
|
||||||
|
prevVec: BinaryVector
|
||||||
|
hasPrev: bool
|
||||||
|
|
||||||
method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
|
method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
|
||||||
let bx = getX(); let by = getY()
|
let bx = getX(); let by = getY()
|
||||||
@@ -41,7 +43,10 @@ method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
|
|||||||
heading: bot.heading,
|
heading: bot.heading,
|
||||||
)
|
)
|
||||||
let vec = encode(scan)
|
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) =
|
method onRoundStarted*(bot: BNNBot, e: RoundStartedEvent) =
|
||||||
setAdjustGunForBodyTurn(true)
|
setAdjustGunForBodyTurn(true)
|
||||||
@@ -51,6 +56,7 @@ method onRoundStarted*(bot: BNNBot, e: RoundStartedEvent) =
|
|||||||
bot.hasContact = false
|
bot.hasContact = false
|
||||||
bot.hasLastPos = false
|
bot.hasLastPos = false
|
||||||
bot.tick = 0
|
bot.tick = 0
|
||||||
|
bot.hasPrev = false
|
||||||
setTargetSpeed(0.0)
|
setTargetSpeed(0.0)
|
||||||
setTurnRate(0.0)
|
setTurnRate(0.0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user