No description
Find a file
jedarden 32d7dd07e7 feat(index-builder): merge latest site build artifact before Pages deploy (§8.4, §11.3)
Add crane CLI to the runtime Dockerfile so the index builder can pull the
latest SPA shell from the Forgejo container registry on each cycle. The
existing syncSiteBuild logic checks for a newer image digest, extracts
the dist/ assets via crane export, and overlays generated JSON data files
on top before deploying to Cloudflare Pages.

- Dockerfile: install go-containerregistry crane binary (v0.20.2)
- sitebuild.go: new file with syncSiteBuild, craneDigest, craneExport,
  digest caching, fallback to baked-in /app/web/dist
- main.go: wire initCraneAuth at startup, replace hardcoded webDistDir
  with syncSiteBuild call in runBuildCycle
- sitebuild_test.go: 18 tests for extractRegistry, digest caching,
  fallback logic, crane auth config, and copyWebAssets overlay behavior

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 17:52:03 -04:00
.github/workflows chore(ci): disable GitHub Actions — CI/CD is handled by Argo Workflows 2026-04-21 08:43:22 -04:00
bots feat(bot): implement Kamikaze bot (JavaScript) — aggressive self-sacrifice archetype 2026-04-22 17:11:28 -04:00
cmd feat(index-builder): merge latest site build artifact before Pages deploy (§8.4, §11.3) 2026-04-22 17:52:03 -04:00
docs feat(acb-api): implement bot registration, job coordination, and replay endpoints per plan §12 Phase 4 2026-04-21 08:58:42 -04:00
engine feat(index): implement match thumbnail PNG generation (§7.2, §14.3) 2026-04-22 17:42:36 -04:00
manifests feat(evolver): add workflow completion polling to promoter 2026-04-22 17:46:33 -04:00
metrics feat(api): add token-bucket rate limiting to public endpoints 2026-04-22 16:52:29 -04:00
ratelimit feat(api): add token-bucket rate limiting to public endpoints 2026-04-22 16:52:29 -04:00
scripts feat(acb-api): implement bot registration, job coordination, and replay endpoints per plan §12 Phase 4 2026-04-21 08:58:42 -04:00
starters feat(matchmaker): implement §6.1 Pareto skill-proximity + LRU pairing algorithm 2026-04-22 17:35:00 -04:00
web feat(matchmaker): implement §6.1 Pareto skill-proximity + LRU pairing algorithm 2026-04-22 17:35:00 -04:00
.env.example docs: Update deployment guide for K8s + B2 architecture 2026-03-29 11:24:06 -04:00
.gitignore feat(playlists): add playlist curation and rebuild logic per §10, with series/seasons/enrichment 2026-04-21 16:11:27 -04:00
.needle-predispatch-sha feat(matchmaker): implement §6.1 Pareto skill-proximity + LRU pairing algorithm 2026-04-22 17:35:00 -04:00
DEPLOYMENT.md feat(scripts): add R2 bucket setup script with custom domain config 2026-04-06 06:42:53 -04:00
DEPLOYMENT_STEPS.md docs: add deployment completion instructions 2026-04-08 16:55:20 -04:00
docker-compose.bots.yml Start Phase 6: Add deployment configuration and containers 2026-03-24 09:41:14 -04:00
docker-compose.workers.yml Start Phase 6: Add deployment configuration and containers 2026-03-24 09:41:14 -04:00
go.mod feat(evolver): expand MAP-Elites from 2-D to 4-D grid per §10.2 2026-04-22 15:44:39 -04:00
go.sum feat(evolver): expand MAP-Elites from 2-D to 4-D grid per §10.2 2026-04-22 15:44:39 -04:00
PROGRESS.md docs: document series/season scheduler verification in PROGRESS.md 2026-04-21 16:39:43 -04:00
README.md Add README.md with project overview and quick start guide 2026-03-24 10:39:32 -04:00
wrangler.toml feat(ci): configure Cloudflare Pages build output directory 2026-04-08 17:07:37 -04:00

AI Code Battle

A competitive bot programming platform where participants write HTTP servers that control units on a grid world.

Overview

AI Code Battle is a game simulation platform where:

  • Participants write bots in any language that expose HTTP endpoints
  • Bots compete on a toroidal (wrapping) grid world
  • Matches are executed offline and presented as completed replays
  • A web platform shows leaderboards, match history, and replay viewers

Quick Start

Prerequisites

  • Go 1.21+ (for game engine and CLI tools)
  • Node.js 18+ (for web and worker components)
  • Docker (for containerized deployment)

Running Locally

# Build CLI tools
go build ./cmd/acb-local
go build ./cmd/acb-mapgen

# Run a match between built-in bots
./acb-local -seed 42 -max-turns 100 -output replay.json -verbose

# Start web development server
cd web && npm install && npm run dev
# Open http://localhost:3000/app.html

Viewing Replays

  1. Open the web app at http://localhost:3000/app.html
  2. Navigate to "Replay Viewer" in the menu
  3. Load a replay JSON file or enter a URL

Project Structure

ai-code-battle/
├── engine/              # Go game simulation library
│   ├── types.go         # Core data types
│   ├── grid.go          # Toroidal grid implementation
│   ├── game.go          # Game state management
│   ├── turn.go          # Turn execution phases
│   ├── replay.go        # Replay recording
│   └── *_test.go        # Test files
├── cmd/
│   ├── acb-local/       # CLI match runner
│   ├── acb-mapgen/      # Map generator
│   ├── acb-worker/      # Match execution worker
│   └── acb-indexer/     # Index builder for static files
├── web/                 # Cloudflare Pages SPA
│   ├── src/
│   │   ├── pages/       # Page components
│   │   ├── replay-viewer.ts  # Canvas replay renderer
│   │   └── app.ts       # SPA entry point
│   └── public/          # Static assets
├── worker-api/          # Cloudflare Worker API
│   └── src/
│       ├── index.ts     # Router + cron dispatcher
│       ├── jobs.ts      # Job coordination
│       ├── bots.ts      # Bot management
│       └── glicko2.ts   # Rating system
├── bots/                # Strategy bot implementations
│   ├── random/          # Python - RandomBot
│   ├── gatherer/        # Go - GathererBot
│   ├── rusher/          # Rust - RusherBot
│   ├── guardian/        # PHP - GuardianBot
│   ├── swarm/           # TypeScript - SwarmBot
│   └── hunter/          # Java - HunterBot
└── docs/plan/           # Implementation plan

Strategy Bots

Bot Language Strategy
RandomBot Python Random valid moves (baseline)
GathererBot Go Energy collection, avoid combat
RusherBot Rust Rush enemy cores aggressively
GuardianBot PHP Defend cores, cautious expansion
SwarmBot TypeScript Formation cohesion, group advance
HunterBot Java Target isolated enemies

Deployment

See DEPLOYMENT.md for detailed deployment instructions.

Quick Deploy

# Start all strategy bots
docker-compose -f docker-compose.bots.yml up -d

# Start match workers
docker-compose -f docker-compose.workers.yml up -d

Testing

# Go engine tests
go test ./engine/... -v

# Worker API tests
cd worker-api && npm test

# Index builder tests
cd cmd/acb-indexer && npm test

Architecture

The platform uses a split architecture:

  • Cloudflare (free tier): Static site, API endpoints, D1 database, R2 storage
  • Rackspace Spot: Match workers, bot containers, index builder

See docs/plan/plan.md for the full implementation plan.

License

MIT