Core: the route model in Python, built from a declarative game.yaml (#10)

Step 2 of the Python-first, declarative core.

- core/spec/game.yaml: the game as data: every decision and its options, every roll and the
  earlier steps its odds may depend on, every bonding encounter, and the flow of a run from the
  entrance to the dragons (set / keep / drop / go / end / encounter). Also how the form's coded
  answers map onto the game.
- core/atlas/model.py: what each coded run reveals about each step, count tables, empirical-Bayes
  shrinkage, and the posterior draws (same random numbers as before, reproducible from the seed).
- core/atlas/solver.py: one interpreter of game.yaml used three ways (solve, evaluate a fixed
  policy, export the published tree) instead of the tree written out five times. Vectorised
  over the 200 posterior draws: the build takes about 2 minutes instead of 4, with no memory flag.
- planner/build_policy.py and policy_report.py replace the JS build and report.

Checked against the JavaScript model: every number in policy.json agrees to within 4e-12
(last-digit differences in log/cos). Three "still best" shares differ by one draw in 200, at
near-ties under the "eventually" objective. POLICY.md is otherwise identical.
tests/parity/compare_solver.py keeps checking JS against Python in CI until the site's JS advisor
replaces solver.js; tests/core/test_game.py checks game.yaml is complete and consistent.


Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ekcSchiano
2026-11-03 21:04:21 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 3536007ade
commit cc86343668
19 changed files with 1291 additions and 110 deletions
+2 -2
View File
@@ -8,13 +8,13 @@
"dev": "node site/build.js && python3 -m http.server 8000 -d dist",
"test:js": "node tests/parity/run_engine.js data/public/form_responses.json tests/out",
"test:py": "PYTHONPATH=core python3 -m atlas.coding && cd analysis/stats && PYTHONPATH=../../core python3 analyze.py && cd ../.. && PYTHONPATH=core python3 -m unittest discover -s tests/core -p 'test_*.py'",
"test:parity": "python3 tests/parity/compare_runs.py && python3 tests/parity/compare_results.py && python3 tests/parity/compare_routes.py",
"test:parity": "python3 tests/parity/compare_runs.py && python3 tests/parity/compare_results.py && python3 tests/parity/compare_routes.py && python3 tests/parity/compare_solver.py",
"test:unit": "node --test tests/core/graph.test.js tests/core/solver.test.js",
"test": "npm run test:js && npm run test:py && npm run test:parity && npm run test:unit",
"graph": "node analysis/network/build-graph.js",
"import-bot": "node collection/bot/import-bot.js",
"check-sources": "python3 collection/sources/update_sources.py",
"policy": "node --max-old-space-size=6000 planner/build-policy.js && node planner/policy-report.js"
"policy": "python3 planner/build_policy.py && python3 planner/policy_report.py"
},
"engines": {
"node": ">=18"