tune(SNNBot): P2 fast bullets vs Walls — 3/20 wins

PATIENCE_TICKS 15→5, ENERGY_GUARD 10→5, fire gate 5° always, power 2.0
(speed 14). P1 (power 1) scored 0/20; P2 compromise wins 3/20.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 23:17:35 +02:00
parent 4bc7baee04
commit d7e499209c
+10 -12
View File
@@ -43,12 +43,12 @@ const
BETA = 1.0 # surrogate steepness (unitless; potentials are unitless)
NOISE_AMP = 0.3 # exploration noise amplitude
# ponytail: uniform exploration noise; upgrade to annealed Gaussian if convergence needs tuning
ENERGY_GUARD = 10.0 # don't fire below this energy
ENERGY_GUARD = 5.0 # P1 costs 1/shot, be aggressive
P3_SPEED = 11.0 # bullet speed for P3 (20 - 3*3); used for exemplar learning
P1_SPEED = 17.0 # bullet speed for P1 (20 - 3*1)
P2_SPEED = 14.0 # bullet speed for P2 (20 - 3*2)
COLD_K = 3 # exemplars needed before leaving cold start
PATIENCE_TICKS = 15 # min ticks before firing
PATIENCE_TICKS = 5 # P1 is forgiving, less patience needed
# ── SNN types ─────────────────────────────────────────────────────────────────
@@ -288,14 +288,14 @@ method onRoundStarted*(bot: SNNBot, e: RoundStartedEvent) =
bot.phase = DECIDE
bot.tick = 0
bot.roundTick = 0
# Reset per-round stats; fire power fixed at 3.0 always
# Reset per-round stats; fire power fixed at 2.0 (P2)
bot.bulletsFired = 0
bot.bulletsHit = 0
bot.hitRateEMA = 0.5 # optimistic start
bot.powerChangeCounter = 0
bot.currentFirePower = 3.0
bot.bulletSpeed = P3_SPEED
bot.lastBulletSpeed = P3_SPEED
bot.currentFirePower = 2.0
bot.bulletSpeed = P2_SPEED
bot.lastBulletSpeed = P2_SPEED
bot.lastEnemyX = 0.0
bot.lastEnemyY = 0.0
bot.lastAbsBearing = 0.0
@@ -436,14 +436,12 @@ method run*(bot: SNNBot) =
aimTo(bot.targetAngle, gunDir)
let err = abs(normalizeRelativeAngle(bot.targetAngle - gunDir))
# Fire gate: strict 3° after warmup, loose 5° during cold start
# Fire gate: 5° always (P1 is fast, even imprecise shots can hit)
let energy = getEnergy()
let warmedUp = bot.res.count >= COLD_K and bot.roundTick >= PATIENCE_TICKS
let gateAngle = if warmedUp: 3.0 else: 5.0
let readyToFire = err < gateAngle and energy >= ENERGY_GUARD and bot.roundTick >= PATIENCE_TICKS
let readyToFire = err < 5.0 and energy >= ENERGY_GUARD and bot.roundTick >= PATIENCE_TICKS
if readyToFire:
bot.lastBulletSpeed = P3_SPEED
discard setFire(3.0)
bot.lastBulletSpeed = P2_SPEED
discard setFire(2.0)
bot.phase = EVALUATE
else:
discard setFire(0.0)