diff --git a/tools/ai-arena.sh b/tools/ai-arena.sh index a0a80b08..92b939d8 100755 --- a/tools/ai-arena.sh +++ b/tools/ai-arena.sh @@ -264,7 +264,18 @@ for ((i = 0; i < N; i++)); do continue fi if [ "$HAS_JQ" -eq 1 ]; then - line=$(jq -r '[.match_id, .players[0].name, .players[1].name, .winner_name, .final_turn, .victory_type] | @tsv' "$RESULT") + # A draw serializes as winner_name="" + victory_type="draw" (or + # winner_index=-1). Any of those signals should render "DRAW" in + # the Winner column — checking `.winner_name == ""` is the cheapest + # invariant; the game enforces it in _build_result_dict. + line=$(jq -r '[ + .match_id, + .players[0].name, + .players[1].name, + (if (.winner_name // "") == "" then "DRAW" else .winner_name end), + .final_turn, + .victory_type + ] | @tsv' "$RESULT") IFS=$'\t' read -r mid p1 p2 win turn type <<<"$line" printf "%-12s %-14s %-14s %-14s %-6s %-12s\n" "$mid" "$p1" "$p2" "$win" "$turn" "$type" else