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 | ||
| src | ||
| .gitignore | ||
| Cargo.toml | ||
| Dockerfile | ||
| README.md | ||
AI Code Battle - Rust Starter Bot
A minimal Rust bot for AI Code Battle using Axum framework with type-safe game types.
Quick Start
- Copy this bot to your own repository
- Edit
src/strategy.rsto implement your bot's logic - Build:
cargo build --release - Run:
SHARED_SECRET=test ./target/release/starter-bot - Test:
curl http://localhost:8080/healthshould return "OK"
Strategy Interface
Implement the compute_moves function in src/strategy.rs:
pub fn compute_moves(state: &VisibleState) -> Vec<Move> {
state.bots.iter()
.filter(|bot| bot.owner == state.you.id)
.map(|bot| Move {
position: bot.position,
direction: Direction::None,
})
.collect()
}
Deployment
Build a release binary, package in Docker container, push to registry, and register at https://ai-code-battle.pages.dev/#/register