Implement CoordinatorBot - a multi-role strategy bot that dynamically allocates roles (Attacker/Harvester/Defender/Scout) each turn based on game state. Features: - Per-turn role assignment using greedy Hungarian-style algorithm - Dynamic role rebalancing based on threat level, economic pressure, score - Zone-aware survival logic - HTTP server with HMAC authentication - TypeScript implementation with full type safety Role allocation algorithm: - Base split: 50% attackers, 25% harvesters, 15% defenders, 10% scouts - Adjusts: +10% defenders if threat > 0.3 - Adjusts: +10% harvesters if energy < spawn threshold - Adjusts: +20% attackers if score leads by 5+ - Assigns bots by proximity to role targets Co-Authored-By: Claude <noreply@anthropic.com>
316 lines
8.1 KiB
YAML
316 lines
8.1 KiB
YAML
# AI Code Battle - Bot Host Deployment
|
|
# Runs all 17 strategy bots as a single deployable unit
|
|
#
|
|
# Usage:
|
|
# docker-compose -f docker-compose.bots.yml up -d
|
|
#
|
|
# Environment variables (set in .env or pass directly):
|
|
# BOT_SECRET_RANDOM - Secret for RandomBot
|
|
# BOT_SECRET_GATHERER - Secret for GathererBot
|
|
# BOT_SECRET_RUSHER - Secret for RusherBot
|
|
# BOT_SECRET_GUARDIAN - Secret for GuardianBot
|
|
# BOT_SECRET_SWARM - Secret for SwarmBot
|
|
# BOT_SECRET_HUNTER - Secret for HunterBot
|
|
# BOT_SECRET_DEFENDER - Secret for DefenderBot
|
|
# BOT_SECRET_SCOUT - Secret for ScoutBot
|
|
# BOT_SECRET_FARMER - Secret for FarmerBot
|
|
# BOT_SECRET_PACIFIST - Secret for PacifistBot
|
|
# BOT_SECRET_PHALANX - Secret for PhalanxBot
|
|
# BOT_SECRET_RAIDER - Secret for RaiderBot
|
|
# BOT_SECRET_NOMAD - Secret for NomadBot
|
|
# BOT_SECRET_OPPORTUNIST - Secret for OpportunistBot
|
|
# BOT_SECRET_ASSASSIN - Secret for AssassinBot
|
|
# BOT_SECRET_KAMIKAZE - Secret for KamikazeBot
|
|
# BOT_SECRET_ECONOMIST - Secret for EconomistBot
|
|
# BOT_SECRET_COORDINATOR - Secret for CoordinatorBot
|
|
|
|
services:
|
|
random:
|
|
build:
|
|
context: ./bots/random
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8081:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_RANDOM:-dev-secret-random}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
gatherer:
|
|
build:
|
|
context: ./bots/gatherer
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8082:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_GATHERER:-dev-secret-gatherer}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
rusher:
|
|
build:
|
|
context: ./bots/rusher
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8083:8082"
|
|
environment:
|
|
- BOT_PORT=8082
|
|
- BOT_SECRET=${BOT_SECRET_RUSHER:-dev-secret-rusher}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8082/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
guardian:
|
|
build:
|
|
context: ./bots/guardian
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8084:8083"
|
|
environment:
|
|
- BOT_PORT=8083
|
|
- BOT_SECRET=${BOT_SECRET_GUARDIAN:-dev-secret-guardian}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8083/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
swarm:
|
|
build:
|
|
context: ./bots/swarm
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8085:8084"
|
|
environment:
|
|
- BOT_PORT=8084
|
|
- BOT_SECRET=${BOT_SECRET_SWARM:-dev-secret-swarm}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8084/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
hunter:
|
|
build:
|
|
context: ./bots/hunter
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8086:8085"
|
|
environment:
|
|
- BOT_PORT=8085
|
|
- BOT_SECRET=${BOT_SECRET_HUNTER:-dev-secret-hunter}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8085/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
# ── Phase 13 expansion bots ──────────────────────────────────────────────
|
|
|
|
defender:
|
|
build:
|
|
context: ./bots/defender
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8087:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_DEFENDER:-dev-secret-defender}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
scout:
|
|
build:
|
|
context: ./bots/scout
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8088:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_SCOUT:-dev-secret-scout}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
farmer:
|
|
build:
|
|
context: ./bots/farmer
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8089:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_FARMER:-dev-secret-farmer}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
pacifist:
|
|
build:
|
|
context: ./bots/pacifist
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8090:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_PACIFIST:-dev-secret-pacifist}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
phalanx:
|
|
build:
|
|
context: ./bots/phalanx
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8091:8090"
|
|
environment:
|
|
- BOT_PORT=8090
|
|
- BOT_SECRET=${BOT_SECRET_PHALANX:-dev-secret-phalanx}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8090/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
raider:
|
|
build:
|
|
context: ./bots/raider
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8092:8086"
|
|
environment:
|
|
- BOT_PORT=8086
|
|
- BOT_SECRET=${BOT_SECRET_RAIDER:-dev-secret-raider}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8086/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
nomad:
|
|
build:
|
|
context: ./bots/nomad
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8093:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_NOMAD:-dev-secret-nomad}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
opportunist:
|
|
build:
|
|
context: ./bots/opportunist
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8094:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_OPPORTUNIST:-dev-secret-opportunist}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
assassin:
|
|
build:
|
|
context: ./bots/assassin
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8095:8082"
|
|
environment:
|
|
- BOT_PORT=8082
|
|
- BOT_SECRET=${BOT_SECRET_ASSASSIN:-dev-secret-assassin}
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8082/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
kamikaze:
|
|
build:
|
|
context: ./bots/kamikaze
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8096:8080"
|
|
environment:
|
|
- BOT_PORT=8080
|
|
- BOT_SECRET=${BOT_SECRET_KAMIKAZE:-dev-secret-kamikaze}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
economist:
|
|
build:
|
|
context: ./bots/economist
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8097:8081"
|
|
environment:
|
|
- BOT_PORT=8081
|
|
- BOT_SECRET=${BOT_SECRET_ECONOMIST:-dev-secret-economist}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
|
|
coordinator:
|
|
build:
|
|
context: ./bots/coordinator
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8098:8084"
|
|
environment:
|
|
- BOT_PORT=8084
|
|
- BOT_SECRET=${BOT_SECRET_COORDINATOR:-dev-secret-coordinator}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8084/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|