Files
threshing-atlas/core
cc86343668 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>
2026-11-03 21:04:21 +00:00
..

core

The shared model. Every other part uses it, so a change here touches everything: run npm test after any edit.

File What it does
engine.js Turns a row of the community form (any version of it) into one coded run: the run format, every coding rule, missing answers, email redaction. Also the statistics the site shows.
spec/form.yaml Declarative. Every question of the community form (how to find it in an export) and every answer (what it is coded as), the answers that count as missing, email redaction.
spec/game.yaml Declarative. The game: every decision and its options in order, every roll and what its odds may depend on, every bonding encounter, and the flow of a run from the entrance to the dragons.
atlas/model.py, atlas/solver.py The route model in Python: what each coded run reveals about each step, the count tables and shrinkage, and one interpreter of game.yaml used to solve, evaluate and export the best routes. tests/parity/compare_solver.py checks it against solver.js, which the site and the bot use until the JS advisor replaces it.
atlas/coding.py The Python coding rules: reads form.yaml, codes every row (python -m atlas.coding). Rule tests: tests/core/test_coding.py.
graph.js The route graph: the bot's scene graph, the decision-variable graph shared by all sources, the crosswalk from the bot's on-screen text to form answers, Beta credible intervals.
solver.js The decision model: every choice and roll in a run, chance estimates with empirical-Bayes back-off, backward induction for each dragon, and the advisor the site and the bot use to get advice from any point in a run.

All three JS files have no dependencies and run unchanged in Node and the browser. The site and Ken's bot load the published copies (https://ekcschiano.github.io/threshing-atlas/solver.js etc.), so their file names on the site must not change.

To support a new answer, add it to spec/form.yaml. To change a rule, edit atlas/coding.py, add a test case, and (until the site stops coding rows in the browser) mirror it in codeRow() in engine.js; tests/parity/ fails if they disagree.

The project is moving to Python plus declarative spec files; JavaScript stays only where it must run in the browser or in Ken's bot (see docs/ROADMAP.md).