#!/usr/bin/env bash # Plays bot-only matches on a run of seeds, under nice, and prints one JSON line per # match, a summary and the verdict. See tools/bot_matches.gd for what is checked. # # tools/bot_matches.sh seeds 1 to 20 # BOT_MATCH_SEEDS=5 BOT_MATCH_FIRST=40 tools/bot_matches.sh set -uo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." count="${BOT_MATCH_SEEDS:-20}" first="${BOT_MATCH_FIRST:-1}" raw="$(nice -n 15 tools/godot.sh --script res://tools/bot_matches.gd -- --seeds="$count" --first="$first" 2>&1)" code=$? grep -E '^\{|^bot-matches' <<<"$raw" if [[ "$code" -ne 0 ]] && ! grep -q '^bot-matches' <<<"$raw"; then echo "bot-matches FAIL: the run exited $code" tail -n 15 <<<"$raw" fi exit "$code"