ai-code-battle/starters/go/README.md
jedarden fe04cd275d fix(starter-kits): complete incomplete refactoring and fix build errors
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>
2026-05-25 22:40:37 -04:00

981 B

AI Code Battle - Go Starter Bot

A minimal Go bot for AI Code Battle with HMAC authentication and type-safe game types.

Quick Start

  1. Copy this bot to your own repository
  2. Edit strategy.go to implement your bot's logic
  3. Build: go build -o bot .
  4. Run: SHARED_SECRET=test ./bot
  5. Test: curl http://localhost:8080/health should return "OK"

Strategy Interface

Implement the ComputeMoves function in strategy.go:

func ComputeMoves(state *engine.VisibleState) []engine.Move {
    moves := make([]engine.Move, 0)
    for _, bot := range state.Bots {
        if bot.Owner == state.You.ID {
            // TODO: Add your strategy here
            moves = append(moves, engine.Move{
                Position: bot.Position,
                Direction: engine.DirNone, // Hold position
            })
        }
    }
    return moves
}

Deployment

Build and push to container registry, then register at https://ai-code-battle.pages.dev/#/register