ai-code-battle/PROGRESS.md
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

4.1 KiB

AI Code Battle - Implementation Progress

Current Phase: Phase 2 - HTTP Protocol & Strategy Bots

Status: COMPLETE

Phase 1 Completed

  • Go module initialization (github.com/aicodebattle/acb)
  • Project structure (engine/, cmd/acb-local/, cmd/acb-mapgen/)
  • Core types (engine/types.go)
  • Grid implementation (engine/grid.go) - Toroidal wrapping, distances, visibility
  • Game state (engine/game.go) - State management, fog of war
  • Turn execution (engine/turn.go) - Movement, combat, capture, energy, spawn
  • Replay writer (engine/replay.go) - Full replay JSON format
  • Match runner (engine/match.go) - Concurrent bot communication
  • Map generator (cmd/acb-mapgen/) - Rotational symmetry, connectivity validation
  • Unit tests - 32+ tests passing, determinism verified

Phase 2 Completed

  • HMAC Authentication (engine/auth.go)
    • Request signing: {match_id}.{turn}.{timestamp}.{sha256(body)}
    • Response signing: {match_id}.{turn}.{sha256(body)}
    • Timestamp tolerance (30s) for replay attack prevention
    • Secret generation (256-bit, hex-encoded)
  • HTTP Bot Client (engine/bot_http.go)
    • HTTPBot implementing BotInterface
    • Per-turn timeout (3s default)
    • Crash detection (10 consecutive failures)
    • Move validation (position ownership, direction validity)
    • Response signature verification
  • Integration Tests (engine/integration_test.go)
    • Full HTTP match between mock bots
    • HMAC authentication round-trip
    • Response signing verification
  • Strategy Bot Implementations (6 languages)
    • RandomBot (Python) - Random moves, rating floor
    • GathererBot (Go) - Energy-focused, combat avoidance
    • RusherBot (Rust) - Aggressive core rushing
    • GuardianBot (PHP) - Defensive core protection
    • SwarmBot (TypeScript) - Formation-based combat
    • HunterBot (Java) - Target isolation and hunting

Exit Criteria Progress

Criterion Status
HMAC auth implementation Complete
HTTP bot client with timeout Complete
6 strategy bots in 6 languages Complete
All bots have Dockerfile Complete
Integration tests passing Complete

Next Phase: Phase 3 - Replay Viewer

Status: Ready to start

File Structure

ai-code-battle/
├── go.mod
├── engine/
│   ├── types.go        # Core data types
│   ├── grid.go         # Toroidal grid implementation
│   ├── game.go         # Game state management
│   ├── turn.go         # Turn execution phases
│   ├── replay.go       # Replay recording
│   ├── match.go        # Match runner
│   ├── bot_local.go    # Local bot interface
│   ├── bot_http.go     # HTTP bot client
│   ├── auth.go         # HMAC authentication
│   └── *_test.go       # Test files
├── cmd/
│   ├── acb-local/      # CLI match runner
│   └── acb-mapgen/     # Map generator
├── bots/
│   ├── random/         # Python - RandomBot
│   ├── gatherer/       # Go - GathererBot
│   ├── rusher/         # Rust - RusherBot
│   ├── guardian/       # PHP - GuardianBot
│   ├── swarm/          # TypeScript - SwarmBot
│   └── hunter/         # Java - HunterBot
└── docs/
    └── plan/
        └── plan.md     # Full implementation plan

Strategy Bot Summary

Bot Language Strategy Expected Rank
RandomBot Python Random valid moves 6th (floor)
GathererBot Go Energy collection, avoid combat 4th-5th
RusherBot Rust Rush enemy cores aggressively 4th-5th
GuardianBot PHP Defend cores, cautious expansion 3rd-4th
SwarmBot TypeScript Formation cohesion, group advance 1st-2nd
HunterBot Java Target isolated enemies 1st-2nd

Running Tests

go test ./engine/... -v

Building CLI Tools

go build ./cmd/acb-local
go build ./cmd/acb-mapgen

Running a Match

./acb-local -seed 42 -max-turns 100 -output replay.json -verbose