Core: a small JS advisor reads the game from policy.json; engine.js is gone (#13)
Step 4b of the Python-first core. - core/solver.js is now a 250-line advisor (was 900 lines): it reads the game (core/spec/game.yaml, published inside policy.json as model.game) and the count tables, and re-solves from any point in a run with the same interpreter as the Python model. Same API for the site and Ken's bot (advisor, recommendOption, solverHistory). The bot's on-screen text for each option moves to game.yaml (bot_text); the deadly rolls carry their risk labels there too. - tests/core/advisor.test.js: the advisor gives exactly the Python model's values and choices for every colour and goal (to 1e-12, every decision on every published route), walks a run in the game's order, and maps advice onto the bot's screen. - Removed core/engine.js and everything that only compared it with Python (tests/parity/run_engine, compare_runs, compare_results, compare_routes, compare_solver, compare_stats, analysis/stats/ analyze.py). In their place: tests/core/test_stats.py checks the statistics against known answers, test_solver.py checks the route model on a synthetic world (tests/fixtures/synthetic_policy.py). - analysis/network/build-graph.js reads the Python-coded runs; graph.json is byte-identical. - docs/BOT_INTEGRATION.md: what changed for the bot (history keys, new choices, re-sync all three files). Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d04b88e7b4
commit
11b4a0398e
@@ -49,6 +49,23 @@ const OUT = path.join(__dirname, '..', 'vendor', 'threshing-atlas');
|
||||
Run it by hand, or once a day before the first attempt. Commit `vendor/threshing-atlas/` in the bot repo if you
|
||||
want the exact policy in its history.
|
||||
|
||||
### What changed in November 2026
|
||||
|
||||
The calls above are unchanged, but `solver.js` is now a small advisor (about 250 lines) that reads the game itself
|
||||
from `policy.json` (`samples.*.model.game`, from `core/spec/game.yaml`) instead of having it written into the code.
|
||||
For the bot that means:
|
||||
|
||||
- Histories (`h`) use the game's step names: `company`, `leave`, `direction`, `fs`, `react`, `scream`, `clearing`,
|
||||
`fight`, `dagger`, `fate` or `wounded`, `post`, `hour`, `shadow`, `shadowColour`, `descend`, `red`, `valley`,
|
||||
`meadow`, `encounter`. `solverHistory()` already produces these; the old `cadet` and `left` keys are no longer read.
|
||||
- New choices the bot will be asked about: leaving your squadmates (`leave`), how you react to the first dragon
|
||||
(`react`), and, below the tree, jumping onto the Red or letting it pass (`red`). The text the bot sees for each
|
||||
option is in `game.yaml` under `bot_text`, so new screens can be matched by editing that file.
|
||||
- If a history skips a decision but already has a later step (an older record, say), the recommended option is
|
||||
assumed for the skipped one.
|
||||
- Re-sync `solver.js`, `graph.js` and `policy.json` together: the new `solver.js` needs the game inside the new
|
||||
`policy.json`.
|
||||
|
||||
### Asking for advice on a screen
|
||||
|
||||
```js
|
||||
|
||||
+4
-3
@@ -34,7 +34,8 @@ share.
|
||||
2. Route model in Python, built from `core/spec/game.yaml`. **Done** (the bot's text, `core/spec/crosswalk.yaml`, moves with the bot importer and the JS advisor in step 4).
|
||||
3. **Done.** Fix the coding bugs found in the core review (letting the Red pass, "left your squadmates" before the
|
||||
redesigned form, missing bot text), each with a rule test.
|
||||
4. The site shows precomputed statistics with fixed filter presets (**done**: `analysis/stats/site_stats.py`,
|
||||
`measures.yaml`, `data/public/stats.json`; the upload button and the click-to-select route map are gone); next,
|
||||
a small JS advisor that reads the Python-built model replaces `solver.js`, and `engine.js` goes.
|
||||
4. **Done.** The site shows precomputed statistics with fixed filter presets (`analysis/stats/site_stats.py`,
|
||||
`measures.yaml`, `data/public/stats.json`); the upload button and the click-to-select route map are gone; a
|
||||
small JS advisor (`core/solver.js`, about 250 lines) reads the game and the Python-built model from `policy.json`
|
||||
and replaces the 900-line JS solver; `engine.js` is gone.
|
||||
5. `data/dictionary.yaml` for every published column, and Croissant metadata for the datasets.
|
||||
|
||||
Reference in New Issue
Block a user