j146 TFIL: the bullet's own heat becomes tunable (TR_TFIL_BULLET_CORE/AURA, default 10/5 = today) and the field-shape A/B is pre-registered

This commit is contained in:
2026-09-26 22:16:06 +02:00
parent 5dd921c26b
commit 298ea6d586
5 changed files with 164 additions and 3 deletions
+21 -2
View File
@@ -18,8 +18,19 @@ const BulletCoreRadiusMax = 54.0 ## core radius at power 3.0
const BulletAuraExtMin = 36.0 ## aura extension at power 3.0 (slow)
const BulletAuraExtMax = 54.0 ## aura extension at power 0.1 (fast)
const BulletCore = 10.0 ## lava accumulation per bullet-overlapping tile
const BulletAura = 5.0 ## lava accumulation for aura ring tiles
## j146: the bullet's OWN heat was a Nim `const`, so no env arm could move it
## and 10.0 is exactly `PathDangerThreshold` — a bullet is never dangerous on
## its own and the corridor carries the whole field. Same env-overridable-var
## pattern as `CorridorHeat` below; the DEFAULTS are today's `const`s, so the
## default field is bit-identical.
## TR_TFIL_BULLET_CORE default 10.0 lava per bullet-overlapping tile
## TR_TFIL_BULLET_AURA default 5.0 lava for aura ring tiles
const
DefaultBulletCore = 10.0
DefaultBulletAura = 5.0
var
BulletCore* = DefaultBulletCore
BulletAura* = DefaultBulletAura
const EnemyCoreRadius = 18.0 ## half of 36px body
const EnemyAuraRadius = 54.0 ## 18 + 36
@@ -201,6 +212,8 @@ proc loadTfilHeatShapeEnv*() =
CorridorHeat = max(0.0, getEnvFloat("TR_TFIL_CORRIDOR_HEAT", DefaultCorridorHeat))
WallHotness = max(0.0, getEnvFloat("TR_TFIL_WALL_HOTNESS", DefaultWallHotness))
WallRadiance = max(0.0, getEnvFloat("TR_TFIL_WALL_RADIANCE", DefaultWallRadiance))
BulletCore = max(0.0, getEnvFloat("TR_TFIL_BULLET_CORE", DefaultBulletCore))
BulletAura = max(0.0, getEnvFloat("TR_TFIL_BULLET_AURA", DefaultBulletAura))
loadTfilHeatShapeEnv()
@@ -307,6 +320,10 @@ type
## candidate set of the last pick (j145:
## lets a caller measure the REGRET of the
## draw instead of only the drawn value)
lastPickSafe: int ## how many SAFE tiles (pathMaxHeat
## <= PathDangerThreshold) the last pick
## drew from (j146: the size of the set
## the heat SHAPE leaves available)
proc initTFIL*(): TFILModule = TFILModule(debugGraphics: false, fire: initFireTracker())
@@ -352,6 +369,7 @@ proc resetRound*(m: var TFILModule) =
m.picks = 0
m.lastPickPromoted = false
m.lastPickMinTurn = 0.0
m.lastPickSafe = 0
# ── Commit diagnostics (TR_TFIL_COMMIT_LOG, off by default) ──────────────────
# One JSONL line per computeMove call, used by the A/B to prove the treatment
@@ -1119,6 +1137,7 @@ proc computeMove*(m: var TFILModule, ws: WorldState): MoveCommand =
var minTurn = Inf
for t in candidates: minTurn = min(minTurn, t.turnDeg)
m.lastPickMinTurn = if minTurn == Inf: ct.turnDeg else: minTurn
m.lastPickSafe = candidates.len
m.commitTarget = (x: m.marginX + (ct.col.float + 0.5) * GridSize,
y: m.marginY + (ct.row.float + 0.5) * GridSize)
m.commitTicks = TfilCommitTicks