j142 retire the ADE+SBC gun (rack id 17): the owner watched it, it does not learn, throw it away

Remove guns/bitbrain_net.nim (+README), test_bitbrain_net.nim,
measure_bitbrain_scaling.nim, rack id 17 and all of its plumbing in
selector.nim / ModularBot.nim / env_report.nim, the TR_BITBRAIN_NET switch
and the NEW-NETWORK TR_BITBRAIN_* knobs, and the BitBrainNet arm of
run_prediction_quality.nim.

With id 17 gone there is nothing to disambiguate, so the legacy namespace
becomes the ONLY one: TR_RACK_BITBRAIN always selects id 16 LEADGAIN and
every TR_BITBRAIN_<X> in the frozen 14-suffix alias set always means
TR_LEADGAIN_<X>. The alias layer and its [depr] line stay.

KEPT: the common_libs/bitbrain/ SBC library (learned_surfer imports
bitbrain/sbc), lead_gain at id 16 with env TR_LEADGAIN_* and log tag [lg],
and the c9b6753 crash fix (NumRackGuns widths + test_rack_stat_width).

Tombstone: docs/bitbrain_campaign.md ## RETIRED and one cross-reference line
in docs/gun_campaign.md. Shipped defaults unchanged: clean env -> rack
active 1v1 = PATTERN, movement default strafe.
This commit is contained in:
2026-09-26 19:20:23 +02:00
parent c9b67530db
commit 5e32ec16df
18 changed files with 279 additions and 1732 deletions
+8 -21
View File
@@ -16,7 +16,7 @@
import std/[os, strformat, strutils, times, math]
import gun_harness/[gun_interface, virtual_bullets, prediction_quality]
import guns/[head_on, pattern_matcher, tm_horizon, lead_gain, bitbrain_net]
import guns/[head_on, pattern_matcher, tm_horizon, lead_gain]
# arm indices (fixed order = fixed output)
const
@@ -43,16 +43,12 @@ const
# is the rule the corrector must match; it needs no learning (range is known at fire
# time). The table was selected in-sample from this corpus.
A_BAND* = 13
## The REAL ADE+SBC gun (rack id 17, `guns/bitbrain_net.nim`): Pattern base plus
## a fine-grained, class-resolved angular correction from the network. The gun
## is default OFF (`TR_BITBRAIN_NET=0`), so the arm turns its own switch on
## here — the ruler is the one place that must exercise it.
A_BBN* = 14
BandGainTable* = [1.0, 1.0, 1.0, 0.0, 0.0]
## (The ADE+SBC gun that used to be arm 14 — rack id 17, `guns/bitbrain_net.nim`
## — was RETIRED and removed. See `docs/bitbrain_campaign.md` §RETIRED.)
ArmNames* = ["Oracle", "OracleQuant", "HeadOn", "Pattern", "PatternGain1.5",
"PatternGain2.0", "PatternGain3.0", "NaiveLinear", "TMHorizon", "LeadGain",
"PatternGain0.25", "PatternGain0.50", "PatternGain0.75", "PatternBandGain",
"BitBrainNet"]
"PatternGain0.25", "PatternGain0.50", "PatternGain0.75", "PatternBandGain"]
const
## The five sub-unity gain arms, in increasing order, resolved to arm indices.
@@ -102,7 +98,6 @@ type Ctx = object
naive: NaiveLinearGun
tmh: TmHorizonGun
lg: LeadGainGun
bbn: BitbrainNetGun
headon: HeadOnGun
st: WorldState
enemy: seq[EnemyInfo]
@@ -180,10 +175,6 @@ proc runRound(ctx: var Ctx, arms: var seq[ArmAcc], r: int) =
let bp = predict(ctx.lg, ctx.st, speed)
let bl = wrap180(bearingDeg(ox, oy, bp.x, bp.y) - los)
arms[A_LG].record(rng, wrap180(bl - targetLead), bl, targetLead)
# BITBRAIN (ADE+SBC): Pattern base + the network's fine-grained correction
let np2 = predict(ctx.bbn, ctx.st, speed)
let nl2 = wrap180(bearingDeg(ox, oy, np2.x, np2.y) - los)
arms[A_BBN].record(rng, wrap180(nl2 - targetLead), nl2, targetLead)
proc runOne(runPath: string, arms: var seq[ArmAcc], shotsCont, shotsQuant: var ShotStat,
doShots: bool, timing: bool, cont: bool): int =
@@ -197,7 +188,6 @@ proc runOne(runPath: string, arms: var seq[ArmAcc], shotsCont, shotsQuant: var S
naive: NaiveLinearGun(lastTick: -1),
tmh: initTmHorizonGun(),
lg: initLeadGainGun(),
bbn: initBitbrainNetGun(),
headon: HeadOnGun(),
st: WorldState(arenaWidth: c.arenaW, arenaHeight: c.arenaH),
enemy: newSeq[EnemyInfo](1))
@@ -313,10 +303,9 @@ proc main() =
let mPat = overallMean(arms, A_PATTERN)
let mTmh = overallMean(arms, A_TMH)
let mLg = overallMean(arms, A_LG)
let mBbn = overallMean(arms, A_BBN)
let mLin = overallMean(arms, A_NAIVE)
let ordOk = mHead > mPat and mHead > mTmh and mHead > mLg and mHead > mBbn
echo fmt"3. HeadOn (static LOS) mean|err| = {mHead:.3f} deg vs Pattern {mPat:.3f} / TMHorizon {mTmh:.3f} / LeadGain {mLg:.3f} / BitBrainNet {mBbn:.3f}"
let ordOk = mHead > mPat and mHead > mTmh and mHead > mLg
echo fmt"3. HeadOn (static LOS) mean|err| = {mHead:.3f} deg vs Pattern {mPat:.3f} / TMHorizon {mTmh:.3f} / LeadGain {mLg:.3f}"
let ordMsg = if ordOk: "OK (static gun worst among real guns)" else: "UNEXPECTED: a predictive gun is worse than static LOS"
echo fmt" -> {ordMsg}"
echo fmt" NaiveLinear mean|err| = {mLin:.3f} deg (over-leads; see the lead-gain sweep for why a larger"
@@ -335,7 +324,7 @@ proc main() =
echo "=".repeat(120)
echo "HEADROOM -- the direct answer: how far each arm is from the oracle ceiling, per band"
echo "=" .repeat(120)
let hdr = "band Pattern n Pattern|err| Pattern hpx Oracle hpx headroom pp naive hpx TMHoriz hpx LeadGain hpx BitBrainNet hpx"
let hdr = "band Pattern n Pattern|err| Pattern hpx Oracle hpx headroom pp naive hpx TMHoriz hpx LeadGain hpx"
echo hdr
echo "-".repeat(hdr.len)
for b in 0 ..< NBands:
@@ -343,10 +332,8 @@ proc main() =
let orc = arms[A_ORACLE].bands[b]
let hp = pat.hitProxy
let ohp = orc.hitProxy
echo fmt"{BandLabels[b]:<9} {pat.n:>8} {fmt3(meanAbs(pat)):>12} {fmt4(hp):>12} {fmt4(ohp):>12} {ohp - hp:>13.4f} {fmt4(arms[A_NAIVE].bands[b].hitProxy):>11} {fmt4(arms[A_TMH].bands[b].hitProxy):>12} {fmt4(arms[A_LG].bands[b].hitProxy):>13} {fmt4(arms[A_BBN].bands[b].hitProxy):>15}"
echo fmt"{BandLabels[b]:<9} {pat.n:>8} {fmt3(meanAbs(pat)):>12} {fmt4(hp):>12} {fmt4(ohp):>12} {ohp - hp:>13.4f} {fmt4(arms[A_NAIVE].bands[b].hitProxy):>11} {fmt4(arms[A_TMH].bands[b].hitProxy):>12} {fmt4(arms[A_LG].bands[b].hitProxy):>13}"
echo ""
echo "BitBrainNet hpx = the ADE+SBC gun (rack id 17), Pattern base + a class-resolved"
echo "angular correction. VETO-CAPABLE OFFLINE CHECK ONLY, never a live claim."
echo "hitProxy = fraction of tick-bins aimed within atan(18/range) of the true interception point."
echo "headroom pp = oracle hitProxy - Pattern hitProxy = the absolute hit-probability points available"
echo "to a perfect predictor (the campaign is playing for a slice of this)."