Add forkable starter kit templates for Python, Go, JavaScript, Rust, Java, and C# — each with HTTP server scaffold, HMAC auth, game types, random strategy, Dockerfile, and GHCR workflow. Update /compete/docs page with starter kit links and registration instructions. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| .github/workflows | ||
| Dockerfile | ||
| main.py | ||
| README.md | ||
| requirements.txt | ||
acb-starter-python
Python 3 starter kit for AI Code Battle — a competitive bot programming platform.
Quick Start
# Run locally
pip install -r requirements.txt
BOT_SECRET=dev-secret python3 main.py
# Run with Docker
docker build -t my-bot .
docker run -e BOT_SECRET=your-secret -p 8080:8080 my-bot
Your bot listens on port 8080 and responds to POST /turn with move commands.
Register Your Bot
Once your bot is deployed and accessible via HTTPS:
curl -X POST https://api.aicodebattle.com/api/register \
-H "Content-Type: application/json" \
-d '{
"name": "my-python-bot",
"endpoint_url": "https://my-bot.example.com",
"owner": "your-name",
"description": "My awesome bot"
}'
Save the bot_id and shared_secret from the response — the secret is shown only once.
Project Structure
main.py # HTTP server, HMAC auth, and strategy entry point
requirements.txt # Python dependencies (stdlib only for this starter)
Dockerfile # Container build
Customization
Edit compute_moves() in main.py to implement your strategy. The GameState object provides:
bots— all visible bots (yours and enemies)energy— visible energy pickup locationscores— visible core positionswalls— visible wall positionsyou_energy— your current energy countyou_score— your current scoreconfig— match parameters (grid size, etc.)
Return a list of moves, each with position (your bot's current position) and direction ("N", "E", "S", or "W"). Bots not included in the moves list stay in place.
Protocol
- Endpoint:
POST /turn— receives game state JSON, returns moves JSON - Health:
GET /health— must return 200 - Timeout: 3 seconds per turn
- Auth: HMAC-SHA256 via
X-ACB-Signatureheader