"""Run the can-it-be-gamed check on every Reasoning Gym family the small model played. python scripts/gaming.py # writes hf/gaming.json; figures.py and export.py read it The learner's current reward is the small model's mean score on the ladder (runs/day2). """ import json import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from shortlist.gaming import judge # noqa: E402 ROOT = Path(__file__).resolve().parent.parent def main() -> None: verdicts = json.loads((ROOT / "hf" / "dataset" / "verdicts.json").read_text()) out = [] for v in verdicts: if v["suite"].startswith("rg-") and "small" in v.get("tiers", {}): r = judge(v["suite"][3:], v["tiers"]["small"]["mean"]) out.append({"suite": v["suite"], **r}) b = r["best"] print(f"{r['family']:22s} best no-skill: {b['strategy']:14s} {b['answer'][:30]!r:34s} {b['score']:.3f} " f"small model now {r['learner_mean']:.3f} gameable={r['gameable']}", flush=True) (ROOT / "hf" / "gaming.json").write_text(json.dumps(out, indent=2, ensure_ascii=False)) if __name__ == "__main__": main()