bug fixes

This commit is contained in:
sam-paech 2025-07-10 07:06:34 +10:00
parent 754cf8e23b
commit 2338e3c6e6
6 changed files with 170 additions and 32 deletions

View file

@ -23,6 +23,7 @@ Version: 2.0 (Hard Mode with complete validation)
import os
import json
import csv
import sys
import argparse
from pathlib import Path
from collections import defaultdict, Counter
@ -42,6 +43,8 @@ except ImportError:
"models.PowerEnum not found via absolute or relative import. "
) from exc
csv.field_size_limit(sys.maxsize)
class StatisticalGameAnalyzer:
"""Production-ready analyzer for AI Diplomacy game statistics.
@ -363,6 +366,8 @@ class StatisticalGameAnalyzer:
# Categorize by relationship
recipient = msg.get('recipient_power')
if recipient is None:
continue
try:
normalized_recipient = PowerEnum(recipient).value
except ValueError:
@ -696,6 +701,8 @@ class StatisticalGameAnalyzer:
# Categorize by relationship
recipient = msg.get('recipient_power')
if recipient is None:
continue
# This will coerce some known aliases to match the 7 acceptable names (see models.py)
normalized_recipient = PowerEnum(recipient)