Files
wikideck/scripts/sim/summary.py
T

12 lines
899 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Usage: python3 scripts/sim/summary.py <out-dir> -> one-line-per-ruleset summary table (markdown)
import json, glob, sys, os
d = sys.argv[1]
print('| ruleset | n | draws | first-player WR | heavy | swarm | curve | starters | greedy>maxpower | decided in 1st third |')
print('|---|---|---|---|---|---|---|---|---|---|')
for f in sorted(glob.glob(os.path.join(d, '*.stats.json'))):
s = json.load(open(f)); by = s['byDeck']
g = lambda k: f"{by[k]['rate']*100:.1f}%" if k in by else 'n/a'
sk = s['skill'].get('greedy>maxpower', {}).get('rate')
fp = s['firstPlayer']
print(f"| {s['ruleset']} | {s['matches']} | {s['draws']} | {fp['rate']*100:.1f}% [{fp['lo']*100:.1f}–{fp['hi']*100:.1f}] | {g('heavy')} | {g('swarm')} | {g('curve')} | {s['byTag'].get('arch:starter',{}).get('rate',0)*100:.1f}% | {sk*100 if sk else float('nan'):.1f}% | {s['early']['decidedByThird']*100:.1f}% |")