Valley map: progressive disclosure of choices

The idle map shows only the key moments (the entrance, the three directions, the scream, the
bully fight, the wounded cadet, the hour's walk, the tree, the valley centre, the meadow and the
shadow). Clicking one reveals the choices made there as places on the map and as chips in the
panel (each a further place to start from, with a way back), plus the best route to every
dragon. A picked dragon shows only the places on its routes; opening a choice adds the others.

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 21:02:42 +00:00
co-authored by Claude Opus 5.5
parent 83bc19521e
commit 0b025af0f0
13 changed files with 64 additions and 27 deletions
+56 -10
View File
@@ -54,12 +54,32 @@
const c = L[k].colour; const c = L[k].colour;
SPOTS.push({ place: k, first: true, colour: c, pose: FIRST_POSE[c], sc: 0.2, flip: L[k].x > 500 }); SPOTS.push({ place: k, first: true, colour: c, pose: FIRST_POSE[c], sc: 0.2, flip: L[k].x > 500 });
}); });
// every place a choice can lead to is on the map from the start, so no option is hidden until a route is drawn // Progressive disclosure: the idle map shows only the key moments. Clicking one reveals the choices made there
const LANDMARKS = ["comp:Alone", "comp:1 Squadmate", "comp:2 Squadmates", "dir:West", "dir:Center", "dir:East", "scream", "bully", "away", "wounded", // (and the best route to every dragon from it); a picked dragon shows only its path and the choices taken on it.
"res:Killed the bullies yourself", "res:Squadmate's revenge", "res:Left bullies to the dragons", const KEY = ["dir:West", "dir:Center", "dir:East", "scream", "bully", "wounded", "hour", "tree", "valley", "meadow", "stream"];
"res:Tourniquet", "res:Left injured cadet", "res:Took their weapons", const FATES = ["res:Killed the bullies yourself", "res:Squadmate's revenge", "res:Left bullies to the dragons"];
"fork:West", "fork:Forest", "fork:East", "hour", "tree", "valley", "meadow", "stream"]; const FORKS = ["fork:West", "fork:Forest", "fork:East"];
const LANDMARK_NAME = { "dir:West": "West, toward the scent", "dir:Center": "Forest centre", "dir:East": "East, toward the roar", "fork:Forest": "The fork" }; const CHILDREN = {
gate: ["comp:Alone", "comp:1 Squadmate", "comp:2 Squadmates"],
bully: ["away"].concat(FATES),
wounded: ["res:Tourniquet", "res:Left injured cadet", "res:Took their weapons"],
...Object.fromEntries(FATES.map((f) => [f, FORKS])),
};
const PARENT = {};
for (const [p, kids] of Object.entries(CHILDREN)) kids.forEach((k) => { if (!PARENT[k]) PARENT[k] = p; });
/** Places drawn on the idle map: the key moments, plus the choices at (and around) the place you picked. */
function visiblePlaces() {
const ids = new Set(KEY);
let p = st.point;
if (p) {
ids.add(p);
(CHILDREN[p] || []).forEach((k) => ids.add(k));
// the way here: each earlier choice point with its alternatives, so you can switch
for (let q = PARENT[p]; q; q = PARENT[q]) { ids.add(q); (CHILDREN[q] || []).forEach((k) => ids.add(k)); }
}
return ids;
}
const LANDMARK_NAME = { gate: "The entrance", "dir:West": "West, toward the scent", "dir:Center": "Forest centre", "dir:East": "East, toward the roar", "fork:Forest": "The fork" };
/* ---------- state ---------- */ /* ---------- state ---------- */
const st = { const st = {
@@ -84,6 +104,7 @@
// face next ("at"). Choices before it that are not listed stay free, and the best play is assumed for them. // face next ("at"). Choices before it that are not listed stay free, and the best play is assumed for them.
const INV = "Investigate the scream", HELPC = "Help your squadmate"; const INV = "Investigate the scream", HELPC = "Help your squadmate";
const POINTS = { const POINTS = {
gate: { force: {}, at: "company" },
"comp:Alone": { force: { company: "Alone" }, at: "direction" }, "comp:Alone": { force: { company: "Alone" }, at: "direction" },
"comp:1 Squadmate": { force: { company: "1 Squadmate" }, at: "direction" }, "comp:1 Squadmate": { force: { company: "1 Squadmate" }, at: "direction" },
"comp:2 Squadmates": { force: { company: "2 Squadmates" }, at: "direction" }, "comp:2 Squadmates": { force: { company: "2 Squadmates" }, at: "direction" },
@@ -372,7 +393,8 @@
} }
function drawLandmarks(g, onRoute) { function drawLandmarks(g, onRoute) {
const ids = new Set(LANDMARKS); // with a dragon picked: only the places on its routes (opened choices add theirs)
const ids = st.colour ? new Set() : visiblePlaces();
onRoute.forEach((id) => { if (L[id] && L[id].kind !== "dragon") ids.add(id); }); onRoute.forEach((id) => { if (L[id] && L[id].kind !== "dragon") ids.add(id); });
ids.forEach((id) => { ids.forEach((id) => {
const P = L[id]; const P = L[id];
@@ -396,7 +418,18 @@
hit.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } }); hit.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } });
} }
}); });
el("text", { x: GATE.x, y: GATE.y + 14, "text-anchor": "middle", "font-size": 11, "letter-spacing": "0.16em", fill: PAPER.ink, "font-family": "var(--font-label)", "paint-order": "stroke", stroke: PAPER.halo, "stroke-width": 3 }, g).textContent = "ENTER THE VALLEY"; const gt = el("text", { x: GATE.x, y: GATE.y + 14, "text-anchor": "middle", "font-size": 11, "letter-spacing": "0.16em", fill: PAPER.ink, "font-family": "var(--font-label)", "paint-order": "stroke", stroke: PAPER.halo, "stroke-width": 3 }, g);
gt.textContent = "ENTER THE VALLEY";
if (!st.colour && st.policy) {
// the entrance is a key moment too: who you go in with
const hit = el("g", { class: "ex-place", tabindex: 0, role: "button", "aria-label": "The entrance: who you enter with, and the best way to every dragon" }, g);
el("rect", { x: GATE.x - 70, y: GATE.y - 2, width: 140, height: 22, fill: "transparent" }, hit);
hit.appendChild(gt);
el("title", {}, hit).textContent = "The entrance: who you enter with";
const go = () => { st.point = st.point === "gate" ? null : "gate"; st.info = null; writeHash(); render(); };
hit.addEventListener("click", go);
hit.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } });
}
} }
function drawTraffic(g) { function drawTraffic(g) {
@@ -624,12 +657,23 @@
} }
return `<span class="eyebrow">Unofficial atlas · built from ${st.runs ? st.runs.length.toLocaleString() : "thousands of"} logged runs</span> return `<span class="eyebrow">Unofficial atlas · built from ${st.runs ? st.runs.length.toLocaleString() : "thousands of"} logged runs</span>
<h2 id="h-valley">The valley</h2> <h2 id="h-valley">The valley</h2>
<p class="small muted">Every dragon is drawn where riders meet it. The fainter it is, the fewer riders reach it. Choose one to see every way to it, and how likely each is. Or click a place name on the map to see your best chance at each dragon from there.</p> <p class="small muted">Every dragon is drawn where riders meet it. The fainter it is, the fewer riders reach it. Choose one to see its best route and the choices on it. Or click a key moment on the map, including the entrance, to see the choices you make there and your best chance at each dragon from it.</p>
${chooser()}${info} ${chooser()}${info}
${trafficToggle()} ${trafficToggle()}
<p class="small muted">Prefer the numbers? <a href="#odds">The Odds</a> has the statistics behind the map.</p>`; <p class="small muted">Prefer the numbers? <a href="#odds">The Odds</a> has the statistics behind the map.</p>`;
} }
const placeName = (id) => LANDMARK_NAME[id] || (L[id] && L[id].name) || id;
/** The choices made at the picked place, each a further place to start from, and the way back up. */
function choicesHere() {
const kids = (CHILDREN[st.point] || []).filter((k) => POINTS[k]);
const up = PARENT[st.point];
if (!kids.length && !up) return "";
return `<div class="ex-here">${kids.length ? `<span class="eyebrow">Your choices here</span>
<div class="ex-here-row">${kids.map((k) => `<button type="button" class="ex-chip" data-pt="${esc(k)}">${esc((L[k] && L[k].name) || placeName(k))}</button>`).join("")}</div>` : ""}
${up ? `<button type="button" class="linklike" data-pt="${esc(up)}">← Back to ${esc(placeName(up).toLowerCase())}</button>` : ""}</div>`;
}
function panelFrom(list) { function panelFrom(list) {
const name = LANDMARK_NAME[st.point] || (L[st.point] && L[st.point].name) || st.point; const name = LANDMARK_NAME[st.point] || (L[st.point] && L[st.point].name) || st.point;
const top = Math.max(1e-12, ...list.map((x) => x.v || 0)); const top = Math.max(1e-12, ...list.map((x) => x.v || 0));
@@ -641,7 +685,8 @@
<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>` : ""} ${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">From 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>
${choicesHere()}
<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>
${trafficToggle()}`; ${trafficToggle()}`;
@@ -699,6 +744,7 @@
$$("[data-s]", p).forEach((b) => b.addEventListener("click", () => { st.sample = b.dataset.s; render(); })); $$("[data-s]", p).forEach((b) => b.addEventListener("click", () => { st.sample = b.dataset.s; render(); }));
const tr = $("#ex-traffic", p); if (tr) tr.addEventListener("change", () => { st.traffic = tr.checked; render(); }); const tr = $("#ex-traffic", p); if (tr) tr.addEventListener("change", () => { st.traffic = tr.checked; render(); });
const cl = $("#ex-clear", p); if (cl) cl.addEventListener("click", () => select(null)); const cl = $("#ex-clear", p); if (cl) cl.addEventListener("click", () => select(null));
$$("[data-pt]", p).forEach((b) => b.addEventListener("click", () => { st.point = b.dataset.pt; writeHash(); render(); }));
const cp = $("#ex-clear-point", p); if (cp) cp.addEventListener("click", () => { st.point = null; writeHash(); render(); }); const cp = $("#ex-clear-point", p); if (cp) cp.addEventListener("click", () => { st.point = null; writeHash(); render(); });
$$(".ex-from-row[data-c]", p).forEach((b) => b.addEventListener("click", () => { $$(".ex-from-row[data-c]", p).forEach((b) => b.addEventListener("click", () => {
// follow that dragon's route, keeping this place on it // follow that dragon's route, keeping this place on it
+5 -1
View File
@@ -343,6 +343,10 @@ footer { border-top-color: var(--line); }
.ex-place { cursor: pointer; } .ex-place { cursor: pointer; }
.ex-place:hover text, .ex-place:focus-visible text { text-decoration: underline; fill-opacity: 1; } .ex-place:hover text, .ex-place:focus-visible text { text-decoration: underline; fill-opacity: 1; }
.ex-place:focus { outline: none; } .ex-place:focus { outline: none; }
.ex-here { display: grid; gap: 6px; margin: 10px 0 4px; justify-items: start; }
.ex-here-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--ink); font-size: .85rem; }
.ex-chip:hover, .ex-chip:focus-visible { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ex-from { display: grid; gap: 6px; margin: 12px 0; } .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 { 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 svg { width: 44px; height: 36px; }
@@ -441,7 +445,7 @@ a { color: var(--accent); text-underline-offset: 2px; }
<section id="valley-sec" aria-labelledby="h-valley" class="explorer"> <section id="valley-sec" aria-labelledby="h-valley" class="explorer">
<div class="ex-shell deco" id="ex-shell"> <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-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">Pick a dragon, or a place to start from</div> <div class="ex-hint" id="ex-hint">Pick a dragon, or a key moment</div>
<div class="ex-tip" id="ex-tip" hidden></div> <div class="ex-tip" id="ex-tip" hidden></div>
</div> </div>
<aside class="ex-panel" id="ex-panel" aria-live="polite"></aside> <aside class="ex-panel" id="ex-panel" aria-live="polite"></aside>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 KiB

After

Width:  |  Height:  |  Size: 738 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 KiB

After

Width:  |  Height:  |  Size: 837 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

+1 -1
View File
File diff suppressed because one or more lines are too long
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: 549 KiB

After

Width:  |  Height:  |  Size: 542 KiB

+2 -15
View File
@@ -1,33 +1,20 @@
Alone
One squadmate
Two squadmates
West, toward the scent West, toward the scent
Forest centre Forest centre
East, toward the roar East, toward the roar
The scream The scream
The bully fight The bully fight
Walked away
The wounded cadet The wounded cadet
Kill them
Squadmate's revenge
Dragons decide
Tourniquet
Leave them
Take their weapons
West fork
The fork
East fork
An hour's walk An hour's walk
The tallest tree The tallest tree
Valley centre Valley centre
The meadow The meadow
The shadow The shadow
ENTER THE VALLEY ENTER THE VALLEY
PICK A DRAGON, OR A PLACE TO START FROM PICK A DRAGON, OR A KEY MOMENT
UNOFFICIAL ATLAS · BUILT FROM 5,651 LOGGED RUNS UNOFFICIAL ATLAS · BUILT FROM 5,651 LOGGED RUNS
The valley The valley
Every dragon is drawn where riders meet it. The fainter it is, the fewer riders reach it. Choose one to see every way to it, and how likely each is. Or click a place name on the map to see your best chance at each dragon from there. Every dragon is drawn where riders meet it. The fainter it is, the fewer riders reach it. Choose one to see its best route and the choices on it. Or click a key moment on the map, including the entrance, to see the choices you make there and your best chance at each dragon from it.
RED RED
ORANGE ORANGE