Files
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

63 lines
2.3 KiB
Nim
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Opponent matrices. Garages may also act as opponents (any --bot dir can be
## pulled in via `.battletest.json`), so "all" = shared adversaries + `extra`.
import std/os
import ./resolve
type
Suite* = object
name*: string
opponents*: seq[string] ## directories, not stems
const
Baseline* = "baseline"
All* = "all"
Gauntlet* = "GAUNTLET"
SharedAdversaries* = RepoRoot / "common_libs" / "test_framework" / "adversaries"
proc adversaryDirs*(): seq[string] =
## Every shared adversary: the ones in common_libs/test_framework/adversaries
## plus the runner's own adversaries/ (Observer). Lazily computed, so adding
## an adversary is just a new directory — no code change.
for root in [SharedAdversaries, AdversaryRoot]:
if not dirExists(root): continue
for kind, p in walkDir(root):
if kind == pcDir:
let stem = lastPathPart(p)
if fileExists(p / (stem & ".nim")) or fileExists(p / "src" / (stem & ".nim")):
result.add p
proc suite*(name: string, extra: openArray[string] = []): Suite =
## baseline = two cheap reference bots; all = every shared adversary;
## GAUNTLET = baseline ∪ all ∪ any extra opponents named in --opponents.
var dirs: seq[string]
if name == Baseline:
dirs = @[SharedAdversaries / "SittingDuck", SharedAdversaries / "OscillatorBot"]
elif name == All or name == Gauntlet:
dirs = adversaryDirs()
if name == Gauntlet:
dirs.add SharedAdversaries / "SittingDuck"
dirs.add SharedAdversaries / "OscillatorBot"
var uniq: seq[string]
for d in dirs:
if d notin uniq: uniq.add d
dirs = uniq
else:
dirs = @[name] # treated as a path (a garage acting as opponent)
for e in extra:
if e notin dirs: dirs.add e
result = Suite(name: name, opponents: dirs)
proc isDegenerate*(opponentStem: string): bool =
## CAVEAT: a SittingDuck matchup is DEGENERATE in this harness — both bots
## report score 0 / survival 0 regardless of play. Survival vs SittingDuck is
## NO-SIGNAL (its score differential is still valid). See README.
opponentStem == "SittingDuck"
when isMainModule:
doAssert suite(Baseline).opponents.len == 2
doAssert isDegenerate("SittingDuck")
doAssert not isDegenerate("OscillatorBot")
echo "suites.nim self-check passed: ", adversaryDirs().len, " adversaries"