diff --git a/apps/atlas/ui.js b/apps/atlas/ui.js index 85b9e46..a041268 100644 --- a/apps/atlas/ui.js +++ b/apps/atlas/ui.js @@ -171,12 +171,20 @@ const cb = r.chance.blue_meadow; const bulkB = stratum(cb, "Bulk"); const tag = (txt) => `${txt}`; - const bonded = Object.entries(r.meta.outcomes).filter(([k]) => k.startsWith("Bonded")).reduce((a, [, v]) => a + v, 0); - const dead = Object.entries(r.meta.outcomes).filter(([k]) => k.startsWith("Incinerated") || k.startsWith("Died")).reduce((a, [, v]) => a + v, 0); + // 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; const cards = [ - // "become a rider" = the run ended bonded to a dragon (reaching the hour alive is not the same thing) - { c: "--accent", big: pct(bonded / r.n), what: "become a rider", how: `${bonded.toLocaleString()} of ${r.n.toLocaleString()} logged runs ended bonded to a dragon. ${pct(reach.p)} made it to the tree-or-valley choice alive; most of the rest were burned at the encounter.`, w: { k: bonded, n: r.n } }, - { c: "--death", big: dead.toLocaleString(), what: "riders sent to Malek", how: `${pct(dead / r.n)} of logged runs ended in fire or worse. Most were riders dying on purpose to try again.`, w: { k: dead, n: r.n }, death: true }, + { 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 }, ]; $("#odds").innerHTML = cards.map((c) => `
${esc(c.big)}${esc(c.what)}${dots(c.w.k, c.w.n, cssVar(c.c))}${tag(c.how)}
`).join(""); getPolicy().then(renderColourOdds);