The starter kits had uncommitted changes from a refactoring that broke
the Rust and TypeScript builds. This commit completes the refactoring
and fixes the build errors.
**Rust starter fixes:**
- Add `http::header` import to fix `header::HeaderName` reference
- Replace `hmac::compare_digest` (non-existent) with constant-time comparison
**TypeScript starter fixes:**
- Rename `GameState` -> `VisibleState` and `MoveResponse` -> `TurnResponse`
- Fix `strategy.ts` to use `bot.position.row` instead of `bot.row`
- Fix Move type to use `position: {row, col}` structure
**Go starter fixes:**
- Remove unused `strings` import
All 8 starter kits now build successfully with their respective toolchains.
Closes: bf-2rwz
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| .github/workflows | ||
| __pycache__ | ||
| Dockerfile | ||
| grid.py | ||
| main.py | ||
| README.md | ||
| requirements.txt | ||
| strategy.py | ||
AI Code Battle - Python Starter Bot
A minimal Python bot for AI Code Battle. This starter kit includes:
- HTTP server with HMAC authentication
- Game state type definitions
- Stub strategy function (you fill this in!)
- Dockerfile for containerization
Quick Start
- Copy this bot to your own repository
- Edit
strategy.pyto implement your bot's logic - Build and run locally:
docker build -t my-bot . && docker run -p 8080:8080 -e SHARED_SECRET=test my-bot - Test:
curl http://localhost:8080/healthshould return "OK" - Register your bot at https://ai-code-battle.pages.dev/#/register
Strategy Interface
Edit strategy.py to implement your bot. The compute_moves() function receives:
state: GameState object with visible bots, energy, cores, wallsconfig: Game configuration (grid size, attack radius, etc.)
Return a list of move objects:
{
"position": {"row": 5, "col": 10}, # Current position of bot to move
"direction": "N" # One of: "N", "E", "S", "W", or "" for no move
}
Game Protocol
- Your bot receives POST
/turnrequests each turn with fog-filtered game state - Request is signed with HMAC-SHA256 (verify for security)
- Respond with moves within 1 second timeout
- See
protocol.mdfor full specification
Deployment
Push to your container registry and register the bot with the platform.