diff --git a/BNNBot_garage/BNNBot b/BNNBot_garage/BNNBot index c46d981..57ce404 100755 Binary files a/BNNBot_garage/BNNBot and b/BNNBot_garage/BNNBot differ diff --git a/BNNBot_garage/src/BNNBot.nim b/BNNBot_garage/src/BNNBot.nim index 8c301c3..8cd3794 100644 --- a/BNNBot_garage/src/BNNBot.nim +++ b/BNNBot_garage/src/BNNBot.nim @@ -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) diff --git a/BNNBot_garage/src/binary_encoding.nim b/BNNBot_garage/src/binary_encoding.nim index 19db837..7b689e0 100644 --- a/BNNBot_garage/src/binary_encoding.nim +++ b/BNNBot_garage/src/binary_encoding.nim @@ -1,42 +1,61 @@ -## binary_encoding — scan data → binary vector (10-bit per value). - import std/math const - BITS_PER_VALUE* = 10 - NUM_VALUES* = 5 - TOTAL_BITS* = BITS_PER_VALUE * NUM_VALUES # 50 + TOTAL_BITS* = 44 type BinaryVector* = array[TOTAL_BITS, uint8] ScanData* = object - bearing*: float # 0-360 - distance*: float # 0-2000 - velocity*: float # -8 to +8 - heading*: float # 0-360 - speed*: float # 0-8 + bearing*: float # 0-360 degrees + distance*: float # 0-1414 pixels (will be converted to 0-100%) + velocity*: float # -8 to +8 integer steps + heading*: float # 0-360 degrees -proc toBits(value: float, minVal, maxVal: float): array[BITS_PER_VALUE, uint8] = - let clamped = clamp(value, minVal, maxVal) - let norm = (clamped - minVal) / (maxVal - minVal) - let intVal = int(norm * 1023.0) # 0-1023 fits in 10 bits - for i in 0..