Site: show precomputed statistics; drop the upload and the click-to-select route map (#12)

Step 4a of the Python-first core.

- analysis/stats/measures.yaml (declarative): outcomes and denominators, route targets and
  comparison groups, encounter contexts, the route map's stages, six filter presets and the
  route thresholds (5, 10, 20, 30).
- analysis/stats/site_stats.py computes every number the page shows, for every preset, and
  writes data/public/stats.json: factor tables, models, chance events, encounters, the route map
  for every outcome, route rankings with q-values at every threshold, the valley map's place and
  step counts, and The Odds' summary cards.
- The page now only displays: app.js, ui.js and explorer.js read stats.json; engine.js is no
  longer loaded. The three filter controls become one "Runs" menu; minimum runs become fixed
  thresholds. Removed: "Load a newer route export", click-to-select and "Follow" on the Deep
  Dive route map, and the unused old valley renderer. The coded runs are a CSV download.
- tests/parity/compare_stats.py: every number matches what engine.js computed, for all six
  presets (factor tables, models, encounters, route rankings at every threshold, route map).


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:37:10 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 963b08c522
commit d04b88e7b4
14 changed files with 866 additions and 424 deletions
+4 -10
View File
@@ -185,15 +185,9 @@
const tag = (txt) => `<span class="how">${txt}</span>`;
// A cadet who walks in and either dies or bonds. Deliberate deaths are left out: a rider burned at a bonding
// encounter they did not genuinely attempt (they were after another colour and planned to seek Malek). Runs with
// no recorded outcome are left out too. Same rule the solver uses for encounter odds (ThreshSolver.genuineAttempt).
const S = window.ThreshSolver;
const ended = state.runs.filter((x) => ["Bonded", "Incinerated", "Died before the hour"].includes(x.outcome));
const deliberate = (x) => { if (x.outcome !== "Incinerated" || !S) return false; const v = S.prepareRun(x); return !!v.encCtx && !S.genuineAttempt(x, v.encCtx); };
const cadets = ended.filter((x) => !deliberate(x));
const nDeliberate = ended.length - cadets.length;
const bonded = cadets.filter((x) => x.outcome === "Bonded").length;
const dead = cadets.length - bonded;
const earlyDeaths = cadets.filter((x) => x.outcome === "Died before the hour").length;
// no recorded outcome are left out too. Same rule the route model uses for encounter odds (precomputed in Python).
const O = state.P.overview;
const cadets = { length: O.cadets }, nDeliberate = O.deliberate, bonded = O.bonded, dead = O.dead, earlyDeaths = O.early_deaths;
const cards = [
{ c: "--accent", big: pct(bonded / cadets.length), what: "become a rider", how: `${bonded.toLocaleString()} of ${cadets.length.toLocaleString()} cadets bonded a dragon. ${pct(1 - earlyDeaths / cadets.length)} made it to the tree-or-valley choice alive.`, w: { k: bonded, n: cadets.length } },
{ c: "--death", big: dead.toLocaleString(), what: "riders sent to Malek", how: `${pct(dead / cadets.length)} of cadets were burned or killed. Deliberate deaths (${nDeliberate.toLocaleString()} runs where the rider chose to die and try again) are not counted.`, w: { k: dead, n: cadets.length }, death: true },
@@ -240,7 +234,7 @@
window.AtlasUI = {
render(state) {
renderOverview(state);
if (window.ValleyExplorer) window.ValleyExplorer.setRuns(state);
if (window.ValleyExplorer) window.ValleyExplorer.setStats(state.P);
},
showTab,
};