feat(BNNBot): 44-bit encoding with sin/cos bearing+heading, distance%, velocity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# BNNBot — binary encoding data collector.
|
||||
# Radar lock on enemy, converts each scan to a 50-bit BinaryVector, prints it.
|
||||
# Radar lock on enemy, converts each scan to a 44-bit BinaryVector, prints it.
|
||||
# No aiming, no firing — pure scan visualization for BNN research.
|
||||
|
||||
import std/[math, os]
|
||||
@@ -18,7 +18,6 @@ type
|
||||
hasLastPos: bool
|
||||
velocity: float # signed velocity (from heading + speed)
|
||||
heading: float # enemy heading (degrees)
|
||||
speed: float # enemy speed (units/tick)
|
||||
distance: float
|
||||
tick: int
|
||||
|
||||
@@ -27,7 +26,6 @@ method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
|
||||
bot.enemyBearing = directionTo(bx, by, e.x, e.y)
|
||||
bot.distance = distanceTo(bx, by, e.x, e.y)
|
||||
bot.heading = e.direction
|
||||
bot.speed = abs(e.speed)
|
||||
bot.velocity = e.speed # signed: positive = forward, negative = reverse
|
||||
if bot.hasLastPos:
|
||||
discard # velocity from e.speed is more accurate; position delta kept for future use
|
||||
@@ -41,7 +39,6 @@ method onScannedBot*(bot: BNNBot, e: ScannedBotEvent) =
|
||||
distance: bot.distance,
|
||||
velocity: bot.velocity,
|
||||
heading: bot.heading,
|
||||
speed: bot.speed,
|
||||
)
|
||||
let vec = encode(scan)
|
||||
echo $bot.tick, " ", formatBinary(vec)
|
||||
|
||||
Reference in New Issue
Block a user