Commit Graph
13 Commits
Author SHA1 Message Date
SirStone b6425ac7f2 tfil: hold the committed dodge while a bullet is within 15 tiles
Proposal #2 (active-dodge commit lock), milder half only: while a tracked
bullet is within LockRadiusTiles (15 x 36px), suppress the tile-crossing
replan so the committed dodge direction survives the crossing.  The 15-tick
dwell and the danger safety valve still apply.

A hard freeze until the bullet passed (no dwell expiry) was measured and
reverted: the bot parked on the committed tile and absorbed the shot
(damage taken/round 26.8 -> 53.9 over 12 opponents x 20 rounds).

Measured on 12 opponents x 40 rounds (RawRecord, verified CONTIGUOUS):
damage taken/round 30.8 -> 25.5, damage dealt/round 73.2 -> 72.1,
rounds won 358/480 -> 360/480.

Raising CommitTicks 15 -> 25 (proposal #3) measured harmful and was reverted.
Proposal #1 (speculative bullet on 'could fire') not implemented: TFIL already
spawns a tracked bullet from the same-tick energy drop, and speculation would
be a ~70% false-positive flood.
2026-10-06 20:14:35 +02:00
SirStone 2fd2388f32 gun belief: bound dead reckoning, reject untrustworthy velocity samples
Cap dead-reckoning lead at MaxDeadReckonTicks (freeze at the last scan past
it) and return (0,0) from targetVelocity when the two scans it averages span
more than MaxVelGap ticks. computeGun now uses gunAimErrorDeg.
2026-10-06 19:54:25 +02:00
SirStone eb7f750a3f elm_gun: single aim computation, explicit deg/rad fire boundary + test
predictAim folded the learned correction into the bearing and derived x/y
once instead of recomputing them per branch. New gunAimErrorDeg carries the
degree unit in its name so the FireSlopDeg comparison cannot fall back to the
old degrees-vs-radians mix-up; test_online.nim adds a regression block for it.
2026-10-06 19:54:25 +02:00
SirStone a62391d400 elm_gun: delayed-label online queue, novelty gate, neutral/prior start 2026-10-06 19:37:38 +02:00
SirStone 02c65036d8 ELM: online mode setters and per-opponent reset 2026-10-06 19:37:38 +02:00
SirStone 6a14b0ffd6 DevControlBot: movement-prediction features, gate, radar scan window
Rewrite elm_features.nim as a 32-D enemy-motion vector (7 scan-to-scan
displacement legs, speed stats, heading/turn/curvature, plus the single-frame
geometry). Add a WinCap=8 scan buffer to radar.nim and feed it through
buildBelief. elm_gun.nim now uses the physical bullet speed for the feature
(was the power*10 corpus artifact) and applies the trained correction only when
|correction| > GATE_TAU; below it the gun keeps the exact geometric aim. Retrain
and export weights (H=256, gate_tau=0.1).
2026-10-06 09:00:43 +02:00
SirStone dacb650692 DevControlBot: an ELM gun, its geometric baseline, and an honest null result
Firing wired in behind a compile-time A/B switch (-d:baselineGun): both guns go
through the same predictAim() call and differ only by the learned correction, so
the measured difference is attributable. radar.nim now keeps the two most recent
scans (velocity, scan age, own displacement).

Measured over 20 recorded rounds each vs DrussGT, CassiusClay, Komarious and
Phoenix: the ELM gun LOSES to the geometric baseline on three of four opponents
(Phoenix 51.0% vs 99.5% hit rate). README has the table, the diagnosis and the
two in-game-only bugs measuring exposed (degrees/radians, and features whose
in-game range lies outside the corpus).
2026-10-05 23:48:58 +02:00
SirStone 818bad50fd Train the aim-error ELM on the pooled 9-opponent corpus and export it
train_elm_gun.nim trains H=128, lambda=1e-2, decay=1.0 over every opponent in
tools/elm_bench/gen and writes modules/ELM/elm_gun_weights.txt (trainRmse 0.431
vs a constant baseline 0.933). Pooled is the point: the gun meets opponents it
was not fitted on.
2026-10-05 23:48:58 +02:00
SirStone a94c6131fd ELM engine: export/import weights for offline training
loadWeights/exportWeights move the three matrices in and out of a live ELM so a
model can be fitted offline and shipped as a data file.
2026-10-05 23:48:58 +02:00
SirStone e2d1968a77 Bots: env reporting, TFIL movement, gun selector and docs refresh
DevControlBot   DevControlBot.sh env-file handling and defines, tfil.nim
                  survival-movement rework, README
  ModularBot      .env.example, ModularBot.nim, env_report.nim, vbullet_draw.nim
  PPO_Bot         enemy_tracker.nim
  common_libs     gun_harness/selector.nim
  tests           env_report, lead_gain_legacy, rack_membership,
                  rack_stat_width, tm_pattern_registration adjustments
  docs            env_reference.md, goto-controller-algorithm.md
2026-10-05 22:43:30 +02:00
SirStone 7598f7db4a ELM: pluggable hidden activation (tanh / relu / step)
ActivationKind (atanTanh default, atanRelu, atanStep) on ElmConfig, plus
applyActivation, activationName and parseActivation. The hidden units stay
pure additive nodes: every activation sees the same pre-activation s = a.x + b
and differs only in the scalar nonlinearity g.

tanh is unchanged and bit-identical to the previous version, so existing
callers cannot regress. Two init details are activation-aware, because relu and
step are dead for s <= 0: they get bias U[0,1] instead of U[-1,1], and hidden
weight scale 8/sqrt(inputDim) instead of 1/sqrt(inputDim) (at the tanh scale
the pre-activations barely straddle 0, the Gram matrix loses rank and Thm 2.2
interpolation fails outright).

No RBF option: g(b*||x - a||) reads the distance to a centre in input space,
which is a different node architecture (extra centre + width parameters, its
own init and its own Thm 2.2 validation), not a different g.

Adds tests/test_elm.nim (9 suites) and a `nimble test` task. All pass.
2026-10-05 22:42:12 +02:00
SirStone 67d185880d DevControlBot 1.2.0: TFIL survival movement + universal battle runner
Ported "the floor is lava" (TFIL) movement into DevControlBot as a
self-contained module, DevControlBot/modules/tfil.nim. It has no runtime
dependency on common_libs/: the port is a standalone implementation,
parity-verified against the common_libs original over 2000 differential
ticks with zero divergences. Do not re-introduce the dependency and do
not edit the original to match.

Debug graphics (per-tile lava heat, tracked bullets and their danger
corridors, enemy core/aura, reachable hull, committed tile) are OFF by
default and compile-time gated behind -d:tfilDebug; see README.md for
the plain `nim c` invocation, since nimble runBot does not forward
compile flags.

Wired into DevControlBot.nim: movement computed between commandRadar()
and go(), fire-event tracking wired up, staleness handling for scanned
enemies, and body colour set to BLACK at init (movement and radar both
claim colour now).

Also adds tools/test_runner, a shared battle-test runner usable by any
garage, with an Observer adversary for quick floor checks.
2026-10-04 18:16:24 +02:00
SirStone caa096d6c9 Add radar lock and melee sweep to DevControlBot
The bot now drives its radar every tick. It still never moves and never
fires: body, turret and gun stay white ("not programmed"), while the
radar paints itself black at init to mark itself as working.

- modules/radar.nim replaces the earlier multi-module radar design with a
  single module holding the whole of it: target memory, mode selection
  and both commands
- two commands, picked from the only fact the bot is sure of (the API's
  getEnemyCount()): one enemy plus a target in hand -> LOCK, servo onto
  its bearing; anything else -> SWEEP at 45 deg/tick, the radar's physics
  cap, a full revolution every 8 ticks
- the lock turns by the delta to the target's bearing plus 5 deg PAST it,
  so the radar CROSSES the bearing every tick instead of settling on it.
  That crossing is what produces a fresh ScannedBotEvent every tick: a
  scan per tick, with no rescan to wait for. Turning by the bare error
  parks the radar on the bearing and the scans stop
- commandRadar() is called before go() on every path, so there is no idle
  branch to fall into and switching modes costs zero turns
- idea derived from ModularBot's radar (Apache-2.0) via common_libs/;
  common_libs/ is not edited in place
- AGENTS.md gains mermaid behaviour diagrams plus pointers to the physics
  and coordinate references
- version bumped to 1.1.0 in both DevControlBot.nimble and
  DevControlBot.json so the two agree

Compiled against robocode_tankroyale_botapi 1.0.7.
2026-10-04 16:22:42 +02:00