feat(ai-arena): ✨ Add victory/draw result serialization and victory condition support for AI match tooling
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
f1d169e98d
commit
035a07b069
1 changed files with 12 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue