Commit graph

20 commits

Author SHA1 Message Date
jedarden
ea04f4debb style: apply gofmt alignment fixes across codebase
Tab/space alignment consistency from running gofmt on all packages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 10:40:33 -04:00
jedarden
54548e4873 fix(bots): remove timestamp from verify_signature signing string
All 10 non-gatherer bots included timestamp in the request verification
signing string but the engine (auth.go SignRequest) does not include
timestamp. Every incoming turn request failed 401 verification, bots
crashed after 10 turns, and all matches ended in stalemate.

The engine documentation in auth.go is also misleading (old comment
mentioned timestamp in signing string) but the actual implementation
never included it. Fixed all language implementations to match.

Affected: random (py), swarm (ts), hunter (java), guardian (php),
          rusher (rs), assassin (rs), phalanx (rs), opportunist (go),
          farmer (go), scout (py), raider (java)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:43:44 -04:00
jedarden
f4baa4b817 fix(rusher): add musl-dev to fix crti.o linker error on Alpine
rust:1.85-alpine does not include musl-dev, causing the gcc linker to
fail with "cannot find crti.o". Required for serde_derive and other
proc-macro crates to compile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 08:41:49 -04:00
jedarden
04cf11be83 fix(bots): use thin LTO and Cargo.lock in rusher build
- Switch from full LTO (lto=true) to thin LTO to avoid memory/ICE issues
- Include Cargo.lock in Dockerfile for reproducible dependency resolution
- Use opt-level='s' (balanced size/speed) instead of 'z' (max size opt)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:39:16 -04:00
jedarden
6899b2efa0 fix(bots): fix gatherer Go compile error - declare nearestEnergy in function scope
The nearestEnergy variable was referenced inside findNearestEnergy() but
only declared in the caller's scope. Declare it locally and use _ in caller.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:33:28 -04:00
jedarden
8bcfdf57b3 fix(bots): remove tracked target/ from rusher bot, add .gitignore
The NEEDLE worker committed Rust's target/ directory which contained local
pre-compiled debug artifacts. This caused cargo to fail during CI builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:32:01 -04:00
jedarden
88bd70640a fix(types): add missing ReplayPlayer import and type annotation for transcript feature
- Add ReplayPlayer to type imports in replay-viewer.ts
- Add explicit type annotation for entry parameter in replay.ts transcript map
- Fixes TypeScript compilation errors for §15.3 screen reader transcript feature
2026-04-22 18:20:56 -04:00
jedarden
6c1f031071 feat(config): add season_id + rules_version to Config per §4.2
- SeasonID and RulesVersion already present in engine/types.go Config struct
- Worker already populates from active season row via DB join
- Config embedded in VisibleState sent to bots each turn (including turn 0)
- All starter kits (go, python, rust, java, csharp) already expose and log fields
- Add season_id/rules_version logging to JavaScript starter on turn 0
- TypeScript Config interface already includes season_id and rules_version

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 18:09:26 -04:00
jedarden
4dd91decad feat(bot): implement Kamikaze bot (JavaScript) — aggressive self-sacrifice archetype
Max-aggression strategy with unconditional attack: every unit charges the
nearest enemy, never retreats, and presses engagements within attack range.
Fixed self-collision bug by reserving all starting positions and freeing
them as bots move away. Falls back to enemy core rushing when no enemies
are visible, with exploratory spreading when no targets exist.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 17:11:28 -04:00
jedarden
cecbc4a2a0 fix(bot): fix Opportunist retreat and attack pathfinding bugs
Two bugs in the Opportunist bot strategy:

1. retreatMove: when a lone bot is surrounded by enemies with no nearby
   allies, all passable directions scored below the -1 initial threshold
   due to flat enemy penalties. Fixed by scoring distance-from-enemies
   as a positive value (further = better) instead of a flat penalty,
   ensuring the bot always picks the safest direction.

2. attackMove: BFS could never reach enemy targets because the passable
   function excluded all enemy positions. The target IS an enemy, so the
   path was unreachable. Fixed by wrapping passable to treat the target
   position as passable during attack pathfinding.

All 19 tests now pass, including TestComputeMovesRetreat and
TestComputeMovesNearbyAdvantageAttack.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 17:03:02 -04:00
jedarden
e3e59396f3 chore: add .gitignore to assassin bot, remove build artifacts
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:56:23 -04:00
jedarden
f11d00a177 feat(bot): add Assassin bot (Rust) — decapitation archetype
All units rush the nearest enemy core via BFS, ignoring enemy units
and economy. No perimeter defense — full commitment to core destruction.
Targets persist across turns for consistent pathing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:55:33 -04:00
jedarden
2df70c8ae0 feat(bot): add Nomad bot (Python) — constant relocation archetype
Mobile archetype that never camps. Picks a target region every ~20 turns
(random corner, opposite side, or enemy core), migrates all units toward
it, briefly engages enemies on arrival, then relocates again.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:48:12 -04:00
jedarden
53377d577f feat(bot): add Raider bot (Java) — hit-and-run harasser archetype
Implements a hit-and-run strategy that scouts for lone enemy bots,
attacks from flanking positions, then retreats after 1-2 engagement
turns to avoid reinforcements. Defends own core when under pressure.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:44:34 -04:00
jedarden
ed4be7a4d3 feat(bot): add Phalanx bot (Rust) — tight formation archetype
Formation-based combat bot that moves all units as a coordinated group:
- Circular mean centroid computation (toroidal-aware)
- Hexagonal packing formation slots with greedy slot assignment
- Rally mode when mean distance from centroid exceeds 3 cells
- Scored movement: formation cohesion + advance toward enemy concentration
- Attack range bonus when engaging enemies in formation
- Self-collision avoidance via claimed destination tracking
- 10 unit tests covering all core algorithms

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:43:39 -04:00
jedarden
62a5aa52ac feat(bot): add Scout bot (Python) — fog exploration archetype
Exploration-maximizing bot that maintains per-cell last-seen tick counters,
moves toward the stalest unobserved territory using forward-cone staleness
scoring, flees from enemies within extended combat range, and distributes
multiple bots across angular zones for maximum map coverage.

Archetype: Low Aggression, Low Economy, High Exploration, Low Formation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:40:35 -04:00
jedarden
5a1130c77a feat(bot): add Pacifist bot (JavaScript) — non-aggressive attrition archetype
PacifistBot never attacks; it survives by maximizing distance from enemies
and retreating toward own core when cornered. Pure evasion strategy that
wins via opponent elimination by third parties.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:32:50 -04:00
jedarden
5362b6c011 feat(bot): add Farmer bot (Go) — economy-maximizer archetype
Economy-maximizing bot that prioritizes energy collection and spawning
while avoiding combat entirely. Seeks nearest uncontested energy via BFS,
flees enemies within 3 cells, avoids contested energy tiles, and stays
near active cores for maximum spawn throughput. Includes 12 unit tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:30:26 -04:00
jedarden
3cefabb9ed feat(bot): add Defender bot (C#) — core-hugging perimeter archetype
Core-defense strategy: bots patrol evenly-spaced slots around their
own core, intercept enemies entering the perimeter radius, and never
chase past the perimeter. Falls back to energy gathering when cores
are lost.

MAP-Elites profile: Low Aggression, Low Economy, Low Exploration, High Formation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 16:19:08 -04:00
jedarden
6f1b50384c Complete Phase 2: HTTP protocol and 6 strategy bots
Phase 2 Implementation:
- HMAC authentication for engine-to-bot communication
  - Request signing with timestamp anti-replay
  - Response signing for integrity verification
- HTTP bot client with timeout and crash detection
  - Per-turn 3s timeout, 10 consecutive failure crash threshold
  - Move validation (position ownership, direction validity)
- Integration tests for HTTP match execution
- 6 strategy bots in 6 languages:
  - RandomBot (Python): Random valid moves - rating floor
  - GathererBot (Go): Energy-focused with combat avoidance
  - RusherBot (Rust): Aggressive core rushing via BFS
  - GuardianBot (PHP): Defensive core protection
  - SwarmBot (TypeScript): Formation-based group combat
  - HunterBot (Java): Target isolation and hunting

All bots include:
- HMAC signature verification
- Dockerfile for containerization
- README documentation

All engine tests passing (32+ tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 07:00:38 -04:00