feat: Phase 8 — surface player_explanation in simulation results JSON

Extract player_explanation from validation dict in each turn log
entry within _run_game_loop(). The React frontend can now render
validator explanations when player_explanation is non-null.
This commit is contained in:
KoalaTrapLord authored and GitHub committed 2026-03-21 13:37:09 -04:00
1 parent c67ce422d8
commit 8c34cb0966
1 file changed
+5
+5
View File
@@ -136,6 +136,11 @@ def _run_game_loop(engine, deck_a, deck_b, deck_name, opponent_name,
name_b=opponent_name, **kw)
game_data = result.to_dict()
game_data['gameNumber'] = i + 1
# Phase 8: Surface player_explanation from validation in turn log
for turn_entry in game_data.get('log', []):
v = turn_entry.get('validation')
if isinstance(v, dict) and v.get('player_explanation'):
turn_entry['player_explanation'] = v['player_explanation']
game_results.append(game_data)
if result.winner == 0: