#!/usr/bin/env bash # Regenerates the conformance traces in tests/traces from the TS sim (godot-plan.md ยง2), then the # Godot runner checks them: # godot --headless --script res://tests/conformance.gd # # Usage: tools/make_traces.sh [games] [sets...] (default 1000 games; every set) # tools/make_traces.sh 1000 greedy nocards only the named sets # SIM points at files-tcg/sim (default ~/Troglodyte-Chamber/files-tcg/sim). set -euo pipefail SIM="${SIM:-$HOME/Troglodyte-Chamber/files-tcg/sim}" OUT="$(cd "$(dirname "$0")/.." && pwd)/tests/traces" GAMES="${1:-1000}" shift || true ONLY=("$@") trace() { # name games args... local name="$1" games="$2" shift 2 if [ ${#ONLY[@]} -gt 0 ] && [[ ! " ${ONLY[*]} " == *" $name "* ]]; then return; fi (cd "$SIM" && node src/trace.ts --out "$OUT/$name" -n "$games" "$@") } mkdir -p "$OUT" touch "$OUT/.gdignore" # Random-vs-random games with every Set 1 card, under the default rules. trace main "$GAMES" # Also checks the move-list labels (describe.ts), which costs more per step. trace labels 100 --seed 5001 --labels # The greedy bot (GreedyBot): the runner checks it picks what the TS bot picked at every step. trace greedy 100 --seed 7001 --south greedy --north greedy trace greedy-random 50 --seed 8001 --south greedy --north random trace nocards 50 --seed 9001 --south nocards --north greedy