merge j160-ramfloor: the energy-reserve FIRING FLOOR + ENEMY-EXHAUSTION ram trigger (default off)
TR_RAM_FLOOR_ENERGY and TR_RAM_ENEMY_ENERGY, both default 0.0, plus common_libs/movements/ram_decision.nim, the fire gate in ModularBot.nim, two offline measure_* tools and the A/B record. The j163 A/B (450 runs/arm, 0 env mis-set) is a clean negative: round-win 40.30% -> 39.70%, sign-flip p=0.7676, MDE 4.73 pp. DO NOT ADOPT; TR_RAM_FLOOR_ENERGY stays 0.0. The mechanism barely fired (0.04% of ticks, not the 9.6% the offline ruler predicted), so the null does not prove the knob inert. # Conflicts: # common_libs/tests/test_tfil_commit_env.nim
This commit is contained in:
@@ -98,6 +98,8 @@ TR_RAM_PLAN=off # the change-of-plan trigger (enemy outguns us while
|
||||
TR_RAM_PLAN_DIST=250.0 # px; max range at which the plan trigger may fire
|
||||
TR_RAM_PLAN_MARGIN=20.0 # energy advantage the plan trigger needs
|
||||
TR_RAM_PLAN_HITRATE=0.05 # pooled virtual hit rate below which the gun duel counts as failing
|
||||
TR_RAM_FLOOR_ENERGY=0.0 # j160 firing floor: at/below this self energy stop firing (0 = off)
|
||||
TR_RAM_ENEMY_ENERGY=0.0 # j160 exhaustion: last-scanned enemy energy <= this -> ram (0 = off)
|
||||
|
||||
# ── movement internals: tfil (the floor-is-lava field) ──────────────────────
|
||||
TR_TFIL_RANGE_LO=100.0 # px; lower edge of the range band the ring mover prefers
|
||||
|
||||
@@ -1459,9 +1459,14 @@ method run*(bot: ModularBot) =
|
||||
let distPx = hypot(pred.x - getX(), pred.y - getY())
|
||||
|
||||
if shouldFire(gunDir, aimTarget, gunHeat, distPx):
|
||||
# j160 FIRING FLOOR: at/below TR_RAM_FLOOR_ENERGY self energy we hold
|
||||
# the reserve for the ram instead of spending it on a shot. Off by
|
||||
# default (`RamFloorEnergy = 0.0`), and `ramming` (the exhaustion
|
||||
# trigger) wins the conflict, so an engaged ram never starves itself.
|
||||
let floorBlocks = fireFloorBlocks(RamFloorEnergy, getEnergy(), shouldRam)
|
||||
# Enqueue the selected gun so onBulletFired can stamp the server's bulletId.
|
||||
# getEnergy() > power mirrors the server's "bot.energy <= firepower" reject.
|
||||
if setFire(power) and getEnergy() > power:
|
||||
if not floorBlocks and setFire(power) and getEnergy() > power:
|
||||
bot.pendingFires.add(PendingShot(
|
||||
gunId: selectedGun,
|
||||
angleErr: abs(normDelta),
|
||||
|
||||
@@ -416,6 +416,8 @@ proc printEffectiveValues(ctx: EnvReportContext) =
|
||||
emit("TR_RAM_PLAN_MARGIN", $RamPlanMargin, sourceOf("TR_RAM_PLAN_MARGIN"))
|
||||
emit("TR_RAM_PLAN_HITRATE", $RamPlanHitRate, sourceOf("TR_RAM_PLAN_HITRATE"))
|
||||
emit("TR_RAM_LOG", onOff(RamLog), sourceOfPresence("TR_RAM_LOG"))
|
||||
emit("TR_RAM_FLOOR_ENERGY", $RamFloorEnergy, sourceOf("TR_RAM_FLOOR_ENERGY"))
|
||||
emit("TR_RAM_ENEMY_ENERGY", $RamEnemyEnergy, sourceOf("TR_RAM_ENEMY_ENERGY"))
|
||||
|
||||
# ── the horizon TM gun ────────────────────────────────────────────────────
|
||||
# `resetLearning`/`targetChanged` resolve the lazily-read fields at round
|
||||
@@ -667,6 +669,7 @@ proc knownEnvNames*(): seq[string] =
|
||||
"TR_RAM_OPPORTUNITY", "TR_RAM_OPP_DIST", "TR_RAM_OPP_MARGIN",
|
||||
"TR_RAM_ABORT_DMG", "TR_RAM_PLAN", "TR_RAM_PLAN_DIST",
|
||||
"TR_RAM_PLAN_MARGIN", "TR_RAM_PLAN_HITRATE", "TR_RAM_LOG",
|
||||
"TR_RAM_FLOOR_ENERGY", "TR_RAM_ENEMY_ENERGY",
|
||||
"TR_TFIL_RANGE_LO", "TR_TFIL_RANGE_HI", "TR_TFIL_RANGE_TEMP",
|
||||
"TR_TFIL_RING_COMMIT_ARRIVAL", "TR_TFIL_RING_NOREV_SPEED",
|
||||
"TR_TFIL_RANGE_K", "TR_TFIL_CORRIDOR_HEAT", "TR_TFIL_WALL_HOTNESS",
|
||||
|
||||
Reference in New Issue
Block a user