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

118 lines
4.1 KiB
Markdown

# AI Code Battle - Implementation Progress
## Current Phase: Phase 2 - HTTP Protocol & Strategy Bots
**Status: ✅ COMPLETE**
### Phase 1 Completed
- [x] Go module initialization (`github.com/aicodebattle/acb`)
- [x] Project structure (`engine/`, `cmd/acb-local/`, `cmd/acb-mapgen/`)
- [x] Core types (`engine/types.go`)
- [x] Grid implementation (`engine/grid.go`) - Toroidal wrapping, distances, visibility
- [x] Game state (`engine/game.go`) - State management, fog of war
- [x] Turn execution (`engine/turn.go`) - Movement, combat, capture, energy, spawn
- [x] Replay writer (`engine/replay.go`) - Full replay JSON format
- [x] Match runner (`engine/match.go`) - Concurrent bot communication
- [x] Map generator (`cmd/acb-mapgen/`) - Rotational symmetry, connectivity validation
- [x] Unit tests - 32+ tests passing, determinism verified
### Phase 2 Completed
- [x] 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)
- [x] 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
- [x] Integration Tests (`engine/integration_test.go`)
- Full HTTP match between mock bots
- HMAC authentication round-trip
- Response signing verification
- [x] 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
```bash
go test ./engine/... -v
```
## Building CLI Tools
```bash
go build ./cmd/acb-local
go build ./cmd/acb-mapgen
```
## Running a Match
```bash
./acb-local -seed 42 -max-turns 100 -output replay.json -verbose
```