File tree Expand file tree Collapse file tree 2 files changed +885
-700
lines changed Expand file tree Collapse file tree 2 files changed +885
-700
lines changed Original file line number Diff line number Diff line change @@ -2274,11 +2274,27 @@ def efg_to_ef(efg_file: str) -> str:
22742274 else :
22752275 iset_id = None
22762276 elif kind == 't' :
2277- # terminal: extract payoffs
2277+ # terminal: extract payoffs (allow integers and decimals)
22782278 if brace :
2279- # numbers possibly separated by commas
2280- pay_tokens = re .findall (r'(-?\d+)' , brace .group (1 ))
2281- payoffs = [int (x ) for x in pay_tokens ]
2279+ # Match floats like 12.80, .80, -1.5 or integers like 3
2280+ pay_tokens = re .findall (r'(-?\d*\.\d+|-?\d+)' , brace .group (1 ))
2281+ payoffs = []
2282+ for tok in pay_tokens :
2283+ # If token contains a decimal point treat as float and
2284+ # format with two decimal places (keeps trailing zeros),
2285+ # otherwise treat as integer.
2286+ if '.' in tok :
2287+ try :
2288+ v = float (tok )
2289+ payoffs .append ("{:.2f}" .format (v ))
2290+ except Exception :
2291+ # fallback: keep original token
2292+ payoffs .append (tok )
2293+ else :
2294+ try :
2295+ payoffs .append (str (int (tok )))
2296+ except Exception :
2297+ payoffs .append (tok )
22822298 descriptors .append ({
22832299 'kind' : kind ,
22842300 'player' : player ,
You can’t perform that action at this time.
0 commit comments