- game.yaml: `givens` (first or later attempt) and `distinct` levels that are not pooled; the shadow roll
depends on the attempt first. Form submissions show the shadow on 9% of first attempts and 0.3% of later ones.
- Reporting bias: a roll whose bias cannot be measured can borrow another roll's (`borrow: {shadow: meadow}`),
so form submissions inform the shadow again. An assumption, stated in planner/policy.yaml.
- policy.json: targets.<colour>.firstAttempt (this attempt, eventually). Black: about 1.4% on a first attempt,
0.07% on a later one.
- solver.js: advisor options `attempt`, `fix`, sampling "uniform"; assign() and armFor() for the plan.
- planner/experiments.yaml + build_experiments.py -> data/public/experiments.json (progress and status per
experiment, rebuilt from the bot's runs).
- python -m collection cycle: import bot runs, refit, re-plan, deliver the kit; .gitea/workflows/bot-cycle.yml.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jqCC2LZ4x1WHQ1V57nTsv
57 lines
2.2 KiB
Python
57 lines
2.2 KiB
Python
"""The game tree in core/spec/game.yaml must be complete and consistent."""
|
|
import unittest
|
|
|
|
from atlas import spec
|
|
|
|
G = spec.game()
|
|
|
|
|
|
class GameSpec(unittest.TestCase):
|
|
def test_every_step_is_reachable_and_every_go_exists(self):
|
|
seen, todo = set(), [G["start"]]
|
|
while todo:
|
|
s = todo.pop()
|
|
if s in seen:
|
|
continue
|
|
seen.add(s)
|
|
self.assertIn(s, G["steps"], f"go: {s} has no step")
|
|
for t in G["steps"][s]["then"].values():
|
|
if "go" in t:
|
|
todo.append(t["go"])
|
|
self.assertEqual(seen, set(G["steps"]), "steps nobody goes to")
|
|
|
|
def test_decisions_and_rolls_are_defined(self):
|
|
for name, st in G["steps"].items():
|
|
if "decision" in st:
|
|
d = G["decisions"][st["decision"]]
|
|
for opt in st["then"]:
|
|
self.assertTrue(opt == "default" or opt in d["options"], f"{name}: unknown option {opt}")
|
|
else:
|
|
c = G["chance"][st["chance"]]
|
|
for out in st["then"]:
|
|
self.assertTrue(out == "default" or out in c["outcomes"], f"{name}: unknown outcome {out}")
|
|
|
|
def test_every_branch_says_what_happens(self):
|
|
for name, st in G["steps"].items():
|
|
for k, t in st["then"].items():
|
|
self.assertEqual(sum(x in t for x in ("go", "end", "encounter")), 1, f"{name}/{k}")
|
|
|
|
def test_encounters_exist(self):
|
|
for name, st in G["steps"].items():
|
|
for t in st["then"].values():
|
|
if "encounter" in t and "$" not in t["encounter"]:
|
|
self.assertIn(t["encounter"], G["encounters"])
|
|
for c, encs in G["by_colour"].items():
|
|
for e in encs:
|
|
self.assertIn(e, G["encounters"])
|
|
|
|
def test_chance_contexts_are_earlier_steps(self):
|
|
known = {"company", "left", "direction", "fs", "react", "scream", "clearing", "fight", "dagger", "cadet", "post",
|
|
"hour", "shadow", "descend", "red", "valley", "meadow"} | set(G.get("givens") or {})
|
|
for k, c in G["chance"].items():
|
|
self.assertTrue(set(c["context"]) <= known, k)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|