ai-code-battle/cmd/acb-wasm/build.sh
jedarden b1121ed6f8 feat(playlists): add playlist curation and rebuild logic per §10, with series/seasons/enrichment
Implement auto-curated playlists in the index builder: 12 playlist types
(closest finishes, upsets, comebacks, marathons, rivalry classics, etc.)
with weekly highlight curation. Add DB persistence, R2 pruning exemptions,
frontend pages, and AI commentary enrichment pipeline.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:11:27 -04:00

46 lines
1.4 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Build the WASM engine and the six built-in bot WASM modules.
#
# Usage:
# ./cmd/acb-wasm/build.sh
#
# Outputs are written to web/public/wasm/:
# engine.wasm game engine with loadState/step/runMatch API
# wasm_exec.js Go WASM runtime shim (copied from GOROOT)
# bots/random.wasm Random strategy
# bots/gatherer.wasm Gatherer strategy
# bots/rusher.wasm Rusher strategy
# bots/guardian.wasm Guardian strategy
# bots/swarm.wasm Swarm strategy
# bots/hunter.wasm Hunter strategy
#
# The bot WASM files implement the ACB WASM bot interface:
# acbBot.init(configJSON) initialise for a new match
# acbBot.compute_moves(stateJSON) return movesJSON for the current turn
#
# Prerequisites: Go 1.21+ with WASM support.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
OUT="$REPO_ROOT/web/public/wasm"
mkdir -p "$OUT/bots"
echo "Building engine.wasm…"
GOOS=js GOARCH=wasm go build \
-o "$OUT/engine.wasm" \
./cmd/acb-wasm/
echo "Copying wasm_exec.js…"
cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" "$OUT/"
echo "Building bot WASM modules…"
for bot in random gatherer rusher guardian swarm hunter; do
echo " → bots/${bot}.wasm"
GOOS=js GOARCH=wasm go build \
-o "$OUT/bots/${bot}.wasm" \
"./cmd/acb-wasm/botmain/${bot}/"
done
echo "Done. Outputs in $OUT"