Valley map: start from any place and see every dragon's best route from there

Click a place name before choosing a dragon to see your chance of each dragon
from that point on, one coloured route per dragon, with a panel that ranks them
and links into each route kept through that place. Deep link: #valley/at/<place>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-02 19:24:27 +00:00
co-authored by Claude Opus 5.5
parent e8c177fc15
commit 68587a55f0
19 changed files with 2766 additions and 13 deletions
+15 -1
View File
@@ -340,6 +340,19 @@ footer { border-top-color: var(--line); }
.ex-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ex-head svg { width: 64px; height: 52px; }
.ex-head h2 { color: var(--c); }
.ex-place { cursor: pointer; }
.ex-place:hover text, .ex-place:focus-visible text { text-decoration: underline; fill-opacity: 1; }
.ex-place:focus { outline: none; }
.ex-from { display: grid; gap: 6px; margin: 12px 0; }
.ex-from-row { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 12px 10px 6px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); background: color-mix(in srgb, var(--raised) 85%, #000); color: var(--ink); text-align: left; overflow: hidden; }
.ex-from-row svg { width: 44px; height: 36px; }
.ex-from-row .nm { display: grid; font-weight: 700; color: var(--c); min-width: 0; }
.ex-from-row .nm small { font-weight: 400; color: var(--muted); }
.ex-from-row b { font-size: 1.1rem; }
.ex-from-row i { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--w); background: var(--c); }
.ex-from-row.off { opacity: .55; }
.ex-from-row.off small { grid-column: 3; color: var(--muted); }
button.ex-from-row:hover { border-color: var(--c); }
.ex-close { width: 32px; height: 32px; border-radius: 50%; padding: 0; font-size: 1.1rem; line-height: 1; }
.ex-routes { display: grid; gap: 8px; }
.ex-route-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-family: var(--font-body); text-transform: none; letter-spacing: normal; font-size: var(--step--1); }
@@ -428,7 +441,7 @@ a { color: var(--accent); text-underline-offset: 2px; }
<section id="valley-sec" aria-labelledby="h-valley" class="explorer">
<div class="ex-shell deco" id="ex-shell">
<div class="ex-map-wrap"><svg id="ex-map" viewBox="0 0 1000 790" role="application" aria-label="Map of the threshing valley. Choose a dragon to see the routes to it."></svg>
<div class="ex-hint" id="ex-hint">Choose a dragon to see the way to it</div>
<div class="ex-hint" id="ex-hint">Choose a dragon, or click a place to start from there</div>
<div class="ex-tip" id="ex-tip" hidden></div>
</div>
<aside class="ex-panel" id="ex-panel" aria-live="polite"></aside>
@@ -662,6 +675,7 @@ adjusted OR = exp(βⱼ), 95% CI = exp(βⱼ ± 1.96·SEⱼ)</div>
<p>The valley map and The Odds come from a solver (<code>solver.js</code>) that treats a run as a decision tree. Your choices are decisions (company, direction, the cadet encounter in the game's order — investigate the scream or keep walking, help your squadmate or walk away, then the bullies' fate or what to do for the wounded cadet — the fork, tree or valley, how to climb down, whether to face the valley Red, and at every bonding encounter whether to attempt the bond or die on purpose). The game's rolls are chance events: which dragon appears first, whether you die at the sighting, in the fight or before the hour, whether the shadow appears and which dragon it is, which dragon waits in the meadow, and how the bonding encounter ends.</p>
<p>Each roll's probability may depend on the choices before it. It is estimated with <b>hierarchical <a href="https://en.wikipedia.org/wiki/Dirichlet-multinomial_distribution" target="_blank" rel="noopener">Dirichlet</a> back-off</b>: the estimate for a full history is pulled toward the estimate for a shorter history, which is pulled toward the overall rate. How strongly is chosen from the data for each roll (<a href="https://en.wikipedia.org/wiki/Empirical_Bayes_method" target="_blank" rel="noopener">empirical Bayes</a>), so the solver does not chase noise in small groups. The best route is then found by <b><a href="https://en.wikipedia.org/wiki/Backward_induction" target="_blank" rel="noopener">backward induction</a></b>, for two goals: the chance of bonding the dragon on this attempt, and, for riders who die on purpose whenever a run goes wrong, the chance that the account eventually ends on that dragon rather than another (maximised by <a href="https://en.wikipedia.org/wiki/Fractional_programming" target="_blank" rel="noopener">Dinkelbach iteration</a>). Ranges come from 200 posterior draws; "stays best in N%" is how often the recommended choice is still best across those draws.</p>
<p>Encounter outcomes use only <b>genuine attempts</b>: runs where the rider wanted that colour, any dragon, or said they would not seek Malek. The two summary cards on The Odds use the same rule in reverse: runs where the rider died on purpose at an encounter they did not want are left out, so they describe cadets who went into the valley and either bonded or died. The "low-bias" numbers use only bulk logs and form runs from riders who were not chasing a rare dragon.</p>
<p><b>Starting from a place.</b> Clicking a place on the map before choosing a dragon shows your chance of each dragon <i>from there on</i>. Choices before that place are the ones that lead to it (or the solver's best, where several do); rolls before it are averaged over the outcomes that can still reach it, weighted by how often they happen and by survival. From the place onward the solver plays the best route for each dragon. A dragon is "not reachable from here" when no logged run went from that place to it. For Orange and Brown, the Greens rescue is used only when their own meadow is out of reach.</p>
</div>
<div class="mpanel method" role="tabpanel" id="mt-6-panel" aria-labelledby="mt-6" hidden>
<h3>Missing answers</h3>