Valley map: bully fight starts at the fight's outcomes; figures moved off the place

Clicking the bully fight now assumes you stepped in, so every dragon's route fans out
through the bullies' fate and the forks (like the wounded cadet), counting the risk of
dying in the fight. The three fighters sit beside the clearing instead of on its marker.

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:32:13 +00:00
co-authored by Claude Opus 5.5
parent 68587a55f0
commit 1646844fa6
12 changed files with 9 additions and 7 deletions
+8 -6
View File
@@ -87,7 +87,7 @@
"dir:Center": { force: { direction: "Center" }, at: "fs" }, "dir:Center": { force: { direction: "Center" }, at: "fs" },
"dir:East": { force: { direction: "East" }, at: "fs" }, "dir:East": { force: { direction: "East" }, at: "fs" },
scream: { force: {}, at: "scream" }, scream: { force: {}, at: "scream" },
bully: { force: { scream: INV }, at: "clearing" }, bully: { force: { scream: INV, clearing: HELPC }, at: "fate", risk: true, note: "You stepped in to help your squadmate, so these chances include the risk of being killed in the fight. Walking away instead leads to the hour's walk." },
wounded: { force: { scream: "Keep walking" }, at: "wounded" }, wounded: { force: { scream: "Keep walking" }, at: "wounded" },
away: { force: { scream: INV, clearing: "Walk away" }, at: "hour" }, away: { force: { scream: INV, clearing: "Walk away" }, at: "hour" },
"res:Killed the bullies yourself": { force: { scream: INV, clearing: HELPC, fate: "Killed the bullies yourself" }, at: "post" }, "res:Killed the bullies yourself": { force: { scream: INV, clearing: HELPC, fate: "Killed the bullies yourself" }, at: "post" },
@@ -117,11 +117,12 @@
if (s.kind === "end") return { x: 0, w: reached ? 1 : 0 }; if (s.kind === "end") return { x: 0, w: reached ? 1 : 0 };
const live = reached && s.risk ? 1 - s.risk.p : 1; const live = reached && s.risk ? 1 - s.risk.p : 1;
const atPoint = !reached && s.var === pt.at && Object.keys(pt.force).every((k) => h[k] != null || k === pt.at); const atPoint = !reached && s.var === pt.at && Object.keys(pt.force).every((k) => h[k] != null || k === pt.at);
const live2 = atPoint && pt.risk && s.risk ? 1 - s.risk.p : live;
if (reached || atPoint) { if (reached || atPoint) {
if (s.kind === "decision") return { x: live * Math.max(...Object.values(s.options).map((v) => v.pX)), w: 1 }; if (s.kind === "decision") return { x: live2 * Math.max(...Object.values(s.options).map((v) => v.pX)), w: 1 };
let x = 0; let x = 0;
for (const [b, p] of Object.entries(s.probs)) if (p) x += p * rec({ ...h, [s.var]: b }, true).x; for (const [b, p] of Object.entries(s.probs)) if (p) x += p * rec({ ...h, [s.var]: b }, true).x;
return { x: live * x, w: 1 }; return { x: live2 * x, w: 1 };
} }
const forced = pt.force[s.var]; const forced = pt.force[s.var];
if (s.kind === "decision") { if (s.kind === "decision") {
@@ -337,9 +338,9 @@
/* ---------- the people (and the thorn) of the valley ---------- */ /* ---------- the people (and the thorn) of the valley ---------- */
const SCENERY = [ const SCENERY = [
{ at: "bully", fig: "defender", dx: 6, sc: 0.42, tip: "The bully fight", text: "Your squadmate holds off two cadets who have bullied them since Parapet. Help them, or walk away." }, { at: "bully", fig: "defender", dx: -150, dy: 62, sc: 0.42, tip: "The bully fight", text: "Your squadmate holds off two cadets who have bullied them since Parapet. Help them, or walk away." },
{ at: "bully", fig: "lunging", dx: 30, sc: 0.42, tip: "The bully fight", text: "The bigger cadet swings a sword; the smaller one has a dagger ready to throw." }, { at: "bully", fig: "lunging", dx: -126, dy: 62, sc: 0.42, tip: "The bully fight", text: "The bigger cadet swings a sword; the smaller one has a dagger ready to throw." },
{ at: "bully", fig: "throwing", dx: 58, sc: 0.42, tip: "The bully fight", text: "Assess first, even the numbers, or put yourself in the middle. Then decide the bullies' fate." }, { at: "bully", fig: "throwing", dx: -98, dy: 62, sc: 0.42, tip: "The bully fight", text: "Assess first, even the numbers, or put yourself in the middle. Then decide the bullies' fate." },
{ at: "wounded", fig: "lying", dx: -72, dy: 4, sc: 0.56, tip: "The wounded cadet", text: "Ignore the scream and you find a badly wounded cadet. Tie a tourniquet, leave them, or take their weapons." }, { at: "wounded", fig: "lying", dx: -72, dy: 4, sc: 0.56, tip: "The wounded cadet", text: "Ignore the scream and you find a badly wounded cadet. Tie a tourniquet, leave them, or take their weapons." },
{ at: "hour", fig: "thorns", dx: -66, dy: 6, sc: 0.44, tip: "An hour's walk", text: "No dragon for an hour, and a thorn cuts the back of your hand. Then: climb the tallest tree, or walk on to the valley centre." }, { at: "hour", fig: "thorns", dx: -66, dy: 6, sc: 0.44, tip: "An hour's walk", text: "No dragon for an hour, and a thorn cuts the back of your hand. Then: climb the tallest tree, or walk on to the valley centre." },
]; ];
@@ -567,6 +568,7 @@
return `<div class="ex-head"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="5" fill="var(--accent)"/><circle cx="12" cy="12" r="10" fill="none" stroke="var(--accent)" stroke-width="2"/></svg> return `<div class="ex-head"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="5" fill="var(--accent)"/><circle cx="12" cy="12" r="10" fill="none" stroke="var(--accent)" stroke-width="2"/></svg>
<div><span class="eyebrow">Starting from</span><h2 id="h-valley">${esc(name)}</h2></div> <div><span class="eyebrow">Starting from</span><h2 id="h-valley">${esc(name)}</h2></div>
<button type="button" class="ex-close" id="ex-clear-point" aria-label="Back to the whole valley">×</button></div> <button type="button" class="ex-close" id="ex-clear-point" aria-label="Back to the whole valley">×</button></div>
${POINTS[st.point].note ? `<p class="small">${esc(POINTS[st.point].note)}</p>` : ""}
<p class="small muted">If you are here, this is your best chance of bonding each dragon from here on, playing the best route after this point. Earlier rolls are averaged over the ways of getting here. Pick a dragon to follow its route step by step.</p> <p class="small muted">If you are here, this is your best chance of bonding each dragon from here on, playing the best route after this point. Earlier rolls are averaged over the ways of getting here. Pick a dragon to follow its route step by step.</p>
<div class="ex-from">${rows}</div> <div class="ex-from">${rows}</div>
<div class="seg" role="group" aria-label="Goal"><button type="button" data-o="eventually" aria-pressed="${st.objective === "eventually"}">Only this dragon</button><button type="button" data-o="thisAttempt" aria-pressed="${st.objective === "thisAttempt"}">Best odds this run</button></div> <div class="seg" role="group" aria-label="Goal"><button type="button" data-o="eventually" aria-pressed="${st.objective === "eventually"}">Only this dragon</button><button type="button" data-o="thisAttempt" aria-pressed="${st.objective === "thisAttempt"}">Best odds this run</button></div>
+1 -1
View File
@@ -675,7 +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>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>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>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> <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. Clicking the bully fight means you stepped in to help, so those chances include the risk of dying in the fight and the routes run through the bullies' fate; walking away is the hour's walk. For Orange and Brown, the Greens rescue is used only when their own meadow is out of reach.</p>
</div> </div>
<div class="mpanel method" role="tabpanel" id="mt-6-panel" aria-labelledby="mt-6" hidden> <div class="mpanel method" role="tabpanel" id="mt-6-panel" aria-labelledby="mt-6" hidden>
<h3>Missing answers</h3> <h3>Missing answers</h3>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 KiB

After

Width:  |  Height:  |  Size: 688 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 KiB

After

Width:  |  Height:  |  Size: 808 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 KiB

After

Width:  |  Height:  |  Size: 605 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 KiB

After

Width:  |  Height:  |  Size: 697 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 KiB

After

Width:  |  Height:  |  Size: 540 KiB