Commit graph

5 commits

Author SHA1 Message Date
jedarden
390ebba52a fix(bots): add zone edge margin to strategy bots for combat density
Strategy bots (GathererBot, RusherBot, SwarmBot) now move toward zone
center when within 2 tiles of the zone edge, not just when outside.
This anticipates the shrinking zone and prevents bots from moving
away from center due to energy-seeking logic.

Test results: 60% of matches now have combat deaths (3/5), up from 0%.
Zone margin of 2 tiles aligns with engine's built-in bot behavior.

Fixes gap identified in test replay where gatherer bot at distance 5
from center (zone radius 6) moved away from center and died from
zone_death instead of engaging in combat.

Closes: bf-2ham

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 08:42:44 -04:00
jedarden
4f1b26f6fe feat(bots): add zone bounds awareness to GathererBot, RusherBot, SwarmBot
- Add ZoneBounds type to bot state structs (Go, Rust, TypeScript)
- GathererBot now moves toward zone center when outside or near edge
- Bots can see zone bounds in fog-filtered state (per plan §3.7.1)
- Fixes gofmt formatting in types.go and bot_strategies.go

This improves bot survival and combat behavior by making them
zone-aware, preventing unnecessary zone deaths when the safe area
shrinks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 08:03:30 -04:00
jedarden
ad70675c38 feat(bots): make SwarmBot and RusherBot actively seek combat
Previously both bots avoided enemy positions during pathfinding,
preventing active engagement. Now both bots get bonuses for moving
toward enemies, encouraging them to enter attack range intentionally.

SwarmBot (bots/swarm/src/strategy.ts):
- Added bonus for getting closer to enemies (score += (currentDist - newDist) * 5)
- Existing bonus for being in attack range (score += 50) now more achievable

RusherBot (bots/rusher/src/strategy.rs):
- Added fallback to move toward nearest enemy when no path to target exists
- Prioritizes engagement over random movement when blocked

Impact: Combat now happens consistently across all matches. Test matches show
4 combat deaths in 2-12 turn matches (vs 0-2 deaths in 3-4 turns before).

Closes: bf-1qq8

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 03:20:11 -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
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