#!/usr/bin/env bash
# The simulation segment against every pass of the simulation recordings
# (needs `tools/bin/py -m mw_harness sim-record` first). One Godot process
# per recording (they are large).
#   tools/bin/sim-check [NAME ...] [--only TEXT] [--show N] [--from I] [--count N] [--roundtrip]
#   tools/bin/sim-check [NAME ...] --think   # also our AI against every recorded think
#   tools/bin/sim-check [NAME ...] --ai      # our AI as the CPU control (no recorded thinks)
#   tools/bin/sim-check NAME --detail PASS [--ai]
#   -j N: N recordings at once (the output as one at a time)
source "$(dirname "${BASH_SOURCE[0]}")/_common.sh"
here="$(dirname "${BASH_SOURCE[0]}")"
source "$here/_recordings.sh"
names=(); opts=()
while (( $# )); do
  case "$1" in
    -j) export MW_JOBS="$2"; shift 2 ;;
    --only|--show|--from|--count|--detail) opts+=("$1" "$2"); shift 2 ;;
    --*) opts+=("$1"); shift ;;
    *) names+=("$1"); shift ;;
  esac
done
if (( ${#names[@]} == 0 )); then
  names=("${MW_REC_V2[@]}")
fi
mw_each_recording res://test/sim/sim_check.gd "${names[@]}" -- "${opts[@]}"
