The Valley as the landing page: dragons first, routes on demand
- New tab order: The Valley, The Odds, The Dragons, Deep Dive, Data & Methods (Route Flow and Blue & Black fold into Deep Dive; methods into Data & Methods; old #links redirect). - explorer.js replaces the trails map and the route planner, with progressive disclosure: the painted valley shows landmarks and the dragons where riders meet them (faint = rarely met), no routes and no deaths; hover for a note; choose a dragon to draw every route to every place it can be bonded, with width = chance of still being on the route, and solid / dashed / dotted and opacity for how a route compares with the best; click a choice point to branch off and re-plan; "Why this route?" holds intervals and risks; a toggle shows the community's actual traffic; #valley/blue/meadow-Blue links. - dragons.js: original dragon silhouettes in six poses, built from simple parts. - Solver: route to one specific encounter (only: [...]); ENCOUNTERS per colour, including the Greens rescue for Orange and Brown. - The Odds rewritten for all six dragons, ranked easiest to hardest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bdf66afabc
commit
de80e99c74
+64
-39
@@ -26,9 +26,12 @@
|
||||
function rng(seed) { let s = seed >>> 0; return () => ((s = (s * 1664525 + 1013904223) >>> 0) / 4294967296); }
|
||||
|
||||
// ------------------------------------------------------------ tabs
|
||||
const TABS = ["overview", "planner", "valley", "flow", "rare", "dragons", "deep", "share"];
|
||||
function showTab(name, focus) {
|
||||
if (!TABS.includes(name)) name = "overview";
|
||||
const TABS = ["valley", "odds", "dragons", "deep", "data"];
|
||||
// old links (#overview, #flow, #planner ...) still land somewhere sensible
|
||||
const ALIAS = { overview: "odds", planner: "valley", flow: "deep", rare: "deep", share: "data" };
|
||||
const tabOf = (hash) => { const t = (hash || "").replace(/^#/, "").split("/")[0]; return TABS.includes(t) ? t : ALIAS[t] || null; };
|
||||
function showTab(name, focus, keepHash) {
|
||||
if (!TABS.includes(name)) name = ALIAS[name] || "valley";
|
||||
TABS.forEach((t) => {
|
||||
const on = t === name;
|
||||
$("#tab-" + t).setAttribute("aria-selected", on);
|
||||
@@ -37,8 +40,9 @@
|
||||
});
|
||||
if (focus) $("#tab-" + name).focus();
|
||||
try { $("#tab-" + name).scrollIntoView({ block: "nearest", inline: "center" }); } catch (e) { /* ignore */ }
|
||||
try { history.replaceState(null, "", "#" + name); } catch (e) { /* ignore */ }
|
||||
if (name === "flow" && window.ThreshAtlas && window.ThreshAtlas.state.res) window.dispatchEvent(new Event("resize"));
|
||||
if (!keepHash) { try { history.replaceState(null, "", "#" + name); } catch (e) { /* ignore */ } }
|
||||
if (name === "valley" && window.ValleyExplorer) window.ValleyExplorer.fromHash();
|
||||
if (name === "deep" && window.ThreshAtlas && window.ThreshAtlas.state.res) window.dispatchEvent(new Event("resize"));
|
||||
}
|
||||
TABS.forEach((t, i) => {
|
||||
const b = $("#tab-" + t);
|
||||
@@ -56,14 +60,15 @@
|
||||
const a = e.target.closest('a[href^="#"]');
|
||||
if (!a) return;
|
||||
const id = a.getAttribute("href").slice(1);
|
||||
if (TABS.includes(id)) { e.preventDefault(); showTab(id); return; }
|
||||
if (tabOf(id)) { e.preventDefault(); showTab(tabOf(id)); return; }
|
||||
const target = document.getElementById(id);
|
||||
const panel = target && target.closest(".tabpanel");
|
||||
if (panel && panel.hidden) { e.preventDefault(); showTab(panel.id.replace("panel-", "")); target.scrollIntoView({ behavior: "smooth" }); }
|
||||
});
|
||||
window.addEventListener("hashchange", () => { const h = location.hash.slice(1); if (TABS.includes(h)) showTab(h); });
|
||||
const initial = (location.hash || "").slice(1);
|
||||
showTab(TABS.includes(initial) ? initial : "overview");
|
||||
// #valley/blue/meadow-Blue keeps its sub-path (the explorer reads it)
|
||||
window.addEventListener("hashchange", () => { const t = tabOf(location.hash); if (t) showTab(t, false, t === "valley"); });
|
||||
const initial = tabOf(location.hash);
|
||||
showTab(initial || "valley", false, initial === "valley");
|
||||
|
||||
// ------------------------------------------------------------ hero art (original, generic silhouettes)
|
||||
function drawHero() {
|
||||
@@ -117,59 +122,79 @@
|
||||
}
|
||||
return svg.outerHTML;
|
||||
}
|
||||
// The odds for all six dragons come from the route model (data/policy.json); fetched once.
|
||||
let policyP = null;
|
||||
const getPolicy = () => policyP || (policyP = fetch("data/policy.json").then((r) => r.json()).catch(() => null));
|
||||
const ENC_OF = { Red: "valley-Red", Orange: "meadow-Orange", Brown: "meadow-Brown", Green: "tree-Greens", Blue: "meadow-Blue", Black: "shadow-Black" };
|
||||
const ENC_LABEL = { "valley-Red": "the valley Red", "meadow-Orange": "the meadow Orange", "meadow-Brown": "the meadow Brown", "tree-Greens": "the two Greens", "meadow-Blue": "the meadow Blue", "shadow-Black": "the Black, after the shadow" };
|
||||
const POSE = { Red: "roaring", Orange: "flying", Brown: "resting", Green: "prowling", Blue: "coiled", Black: "flying" };
|
||||
|
||||
function renderColourOdds(policy) {
|
||||
if (!policy) { $("#odds-colours").innerHTML = '<p class="small muted">The route model could not be loaded.</p>'; return; }
|
||||
const lb = policy.samples.lowBias, all = policy.samples.all;
|
||||
const cols = ["Red", "Green", "Orange", "Brown", "Blue", "Black"]
|
||||
.map((c) => ({ c, p: lb.targets[c].eventually.pX.mean, pAll: all.targets[c].eventually.pX.mean, lo: lb.targets[c].eventually.pX.lo, hi: lb.targets[c].eventually.pX.hi }))
|
||||
.sort((a, b) => b.p - a.p);
|
||||
const enc = (c) => { const e = (all.model.tables.encounter || {})[ENC_OF[c]] || { outcomes: {} }; const n = Object.values(e.outcomes).reduce((a, b) => a + b, 0); return { k: e.outcomes[c] || 0, n }; };
|
||||
const art = (c) => window.DragonArt ? `<svg class="odd-art" viewBox="0 0 200 160" aria-hidden="true">${window.DragonArt.svg(POSE[c], { fill: `var(${DV[c]})`, eyeFill: "var(--bg)" })}</svg>` : "";
|
||||
$("#odds-colours").innerHTML = cols.map(({ c, p, pAll, lo, hi }) => {
|
||||
const e = enc(c);
|
||||
return `<a class="odd odd-colour" href="#valley/${c.toLowerCase()}" style="--c: var(${DV[c]})">${art(c)}
|
||||
<span class="big">1 in ${oneIn(p)}</span><span class="what">runs end bonded to ${/^[AEIOU]/.test(c) ? "an" : "a"} ${c}, on the best route</span>
|
||||
${dots(Math.round(p * 1000), 1000, cssVar(DV[c]))}
|
||||
<span class="how">${pct(p, p < 0.1 ? 1 : 0)} per attempt (95% ${pct(lo, 1)}–${pct(hi, 1)}), from riders who logged every run${Math.abs(pAll - p) / p > 0.25 ? `; all form posts suggest ${pct(pAll, 1)}` : ""}. At ${ENC_LABEL[ENC_OF[c]]}, ${e.k} of ${e.n} genuine attempts bonded.</span>
|
||||
<span class="go">See the route →</span></a>`;
|
||||
}).join("");
|
||||
$("#combo").innerHTML = `<div class="ladder"><span class="eyebrow">Easiest to hardest, in attempts on the best route</span><ol>${cols.map(({ c, p }) =>
|
||||
`<li style="--c: var(${DV[c]}); --w: ${Math.min(100, (100 * Math.log(1 / p + 1)) / Math.log(1 / cols[cols.length - 1].p + 1)).toFixed(1)}%"><span>${c}</span><i></i><b>${oneIn(p)}</b></li>`).join("")}</ol>
|
||||
<p class="small muted">If you die on purpose whenever a run goes wrong and keep trying, this is about how many attempts each dragon takes. Each attempt costs a cooldown.</p></div>`;
|
||||
const meadowAlpha = all.model.alphas.meadow, shadowAlpha = all.model.alphas.shadow;
|
||||
const t2 = $("#truth-history");
|
||||
if (t2) t2.innerHTML = `<h3>Earlier choices barely change who waits</h3><p class="small">${meadowAlpha >= 10000 ? "Which dragon waits in the meadow shows no link to anything you chose before." : "Which dragon waits in the meadow depends only a little on earlier choices."} ${shadowAlpha >= 500 ? "The shadow at the tree depends on them only weakly." : "The shadow at the tree shows some dependence on earlier choices, but the evidence is thin."} The model lets every roll depend on your history, and measured how much it does. Choices the form doesn't record (what you answered inside an encounter) might still matter.</p>`;
|
||||
const t3 = $("#truth-burn");
|
||||
if (t3) {
|
||||
const rates = cols.map(({ c }) => ({ c, ...enc(c) })).filter((x) => x.n >= 20).map((x) => ({ ...x, p: x.k / x.n })).sort((a, b) => a.p - b.p);
|
||||
t3.innerHTML = `<h3>The right answer can still burn</h3><p class="small">Even with the community's best answers, bond chances at the encounter run from ${pct(rates[0].p)} (${esc(ENC_LABEL[ENC_OF[rates[0].c]])}) to ${pct(rates[rates.length - 1].p)} (${esc(ENC_LABEL[ENC_OF[rates[rates.length - 1].c]])}). One death with the "right" answer doesn't mean the answer was wrong.</p>`;
|
||||
}
|
||||
}
|
||||
|
||||
function renderOverview(state) {
|
||||
const r = state.res;
|
||||
const reach = r.factors.reach_hour.overall;
|
||||
const cb = r.chance.blue_meadow, cs = r.chance.shadow;
|
||||
const bulkB = stratum(cb, "Bulk"), bulkS = stratum(cs, "Bulk");
|
||||
const blueSeen = bulkB && bulkB.n >= 30 ? bulkB : cb.overall;
|
||||
const shadow = bulkS && bulkS.n >= 30 ? bulkS : cs.overall;
|
||||
const encB = r.encounters.find((e) => e.context === "Blue (meadow)").overall;
|
||||
const encK = r.encounters.find((e) => e.context === "Black (shadow)").overall;
|
||||
const shadowP = shadow.k === 0 ? shadow.hi : shadow.p;
|
||||
const cb = r.chance.blue_meadow;
|
||||
const bulkB = stratum(cb, "Bulk");
|
||||
const tag = (txt) => `<span class="how">${txt}</span>`;
|
||||
const dead = Object.entries(r.meta.outcomes).filter(([k]) => k.startsWith("Incinerated") || k.startsWith("Died")).reduce((a, [, v]) => a + v, 0);
|
||||
const cards = [
|
||||
{ c: "--accent", big: pct(reach.p), what: "reach the hour alive", how: `${reach.k.toLocaleString()} of ${reach.n.toLocaleString()} logged runs made it past the cadets to the tree-or-valley choice.`, w: reach },
|
||||
{ c: DV.Blue, big: `1 in ${oneIn(blueSeen.p)}`, what: "meadow visits has a Blue", how: blueSeen === bulkB ? `From riders who logged every run (${blueSeen.k}/${blueSeen.n}). The spreadsheet's headline says ${pct(cb.overall.p)}, inflated by lucky runs being shared more.` : `${blueSeen.k}/${blueSeen.n} meadow visits.`, w: blueSeen },
|
||||
{ c: DV.Blue, big: pct(encB.p), what: "of Blue attempts end in a bond", how: `${encB.k} of ${encB.n}. Riders who reached a Blue were usually burned, even with the community's best answers.`, w: encB },
|
||||
{ c: DV.Black, big: shadow.k === 0 ? `< ${pct(shadow.hi, 0)}` : `1 in ${oneIn(shadow.p)}`, what: "of tree climbs show the shadow", how: shadow === bulkS ? `Riders who logged every climb saw it ${shadow.k} times in ${shadow.n}. Form posts show more (${pct(cs.overall.p, 1)}), again because lucky runs get shared.` : `${shadow.k}/${shadow.n} tree climbs.`, w: shadow, scale: 1000 },
|
||||
{ c: DV.Black, big: pct(encK.p), what: "of riders who meet the Black bond it", how: `${encK.k} of ${encK.n}. Getting there is the hard part.`, w: encK },
|
||||
{ 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 },
|
||||
];
|
||||
const dead = Object.entries(r.meta.outcomes).filter(([k]) => k.startsWith("Incinerated") || k.startsWith("Died")).reduce((a, [, v]) => a + v, 0);
|
||||
cards.push({ 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 });
|
||||
$("#odds").innerHTML = cards.map((c) => `<div class="odd${c.death ? " death deco" : ""}" style="--c: var(${c.c})"><span class="big">${esc(c.big)}</span><span class="what">${esc(c.what)}</span>${c.scale ? "" : dots(c.w.k, c.w.n, cssVar(c.c))}${tag(c.how)}</div>`).join("");
|
||||
const pBlueRun = blueSeen.p * encB.p, pBlackRun = shadowP * encK.p;
|
||||
$("#combo").innerHTML = `
|
||||
<div class="odd" style="--c: var(${DV.Blue})"><span class="big">≈ 1 in ${oneIn(pBlueRun)}</span><div><div class="what">valley runs ends bonded to a Blue</div>${tag(`A Blue has to show up (about ${pct(blueSeen.p)}) and then accept you (about ${pct(encB.p)}).`)}</div></div>
|
||||
<div class="odd" style="--c: var(${DV.Black})"><span class="big">${shadow.k === 0 ? "<" : "≈"} 1 in ${oneIn(pBlackRun)}</span><div><div class="what">tree climbs ends bonded to a Black</div>${tag(`The shadow has to appear (${shadow.k === 0 ? "under " + pct(shadow.hi, 1) : "about " + pct(shadow.p, 1)}) and the Black has to accept you (about ${pct(encK.p)}).`)}</div></div>`;
|
||||
$("#odds").innerHTML = cards.map((c) => `<div class="odd${c.death ? " death deco" : ""}" style="--c: var(${c.c})"><span class="big">${esc(c.big)}</span><span class="what">${esc(c.what)}</span>${dots(c.w.k, c.w.n, cssVar(c.c))}${tag(c.how)}</div>`).join("");
|
||||
getPolicy().then(renderColourOdds);
|
||||
|
||||
// journey
|
||||
const fr = r.factors.reach_hour.rows;
|
||||
const lvl = (f, l) => fr.find((x) => x.factor === f && x.level === l);
|
||||
const alone = lvl("company", "Alone"), two = lvl("company", "2 Squadmates");
|
||||
const helpK = lvl("resolution", "DIED in combat");
|
||||
const mb = r.models.blue_meadow;
|
||||
const routeSig = mb ? mb.terms.filter((t) => ["direction", "first_sighting", "resolution", "company"].includes(t.factor) && t.p < 0.05 && !/Unsure|Unknown|Multiple/.test(t.level)) : [];
|
||||
const fork = r.factors.shadow.rows.find((x) => x.factor === "post_path" && x.level === "Forest");
|
||||
const rest = r.factors.shadow.rows.filter((x) => x.factor === "post_path" && x.level !== "Forest");
|
||||
const restK = rest.reduce((a, x) => a + x.k, 0), restN = rest.reduce((a, x) => a + x.n, 0);
|
||||
const greens = r.green_rescue;
|
||||
const stops = [
|
||||
{ t: "Choose company", d: "Go in alone, or with one or two squadmates.", v: alone && two ? `Alone, ${pct(alone.p)} reached the hour. With two squadmates, ${pct(two.p)} did.` : "" },
|
||||
{ t: "Pick a direction", d: "East toward the roar, west toward the scent, or the forest centre.", v: routeSig.some((x) => x.factor === "direction") ? "Direction shows some link to the Blue." : "No sign that direction changes your Blue odds." },
|
||||
{ t: "Pick a direction", d: "East toward the roar, west toward the scent, or the forest centre.", v: "Direction decides which first dragon can find you." },
|
||||
{ t: "The first dragon", d: "A dragon finds you. Which colour is the game's roll, not yours.", v: "Keep your eyes down. This one is about surviving, not bonding.", roll: true },
|
||||
{ t: "The scream", d: "Help the squadmate fighting two cadets, walk away, or ignore it and find a wounded cadet.", v: helpK ? `${helpK.n} logged runs died in the fight.` : "" },
|
||||
{ t: "Fork in the road", d: "After the fight: west, deeper into the forest, or east.", v: fork && restN ? `Shadows came from "deeper" ${pct(fork.p, 1)} of the time, vs ${pct(restK / restN, 1)} otherwise. A lead, not proof.` : "" },
|
||||
{ t: "Tree or valley", d: "Climb the tallest tree, or walk to the valley centre.", v: "The tree holds Reds, Greens and the rare shadow. The valley holds Red, Orange, Brown and the meadow Blue." },
|
||||
{ t: "Fork in the road", d: "After the fight: west, deeper into the forest, or east.", v: "Only the bully path has a fork." },
|
||||
{ t: "Tree or valley", d: "Climb the tallest tree, or walk to the valley centre.", v: "The tree holds a Red, two Greens and the rare shadow. The valley holds a Red, then the meadow's Orange, Brown and sometimes a Blue." },
|
||||
{ t: "The bonding", d: "Who is waiting is partly luck. Then every answer is a test.", v: greens.green_encounters ? `At the two Greens, ${pct((greens.rescued_orange + greens.rescued_brown) / greens.green_encounters)} were rescued by an Orange or Brown.` : "", roll: true },
|
||||
];
|
||||
$("#journey").innerHTML = stops.map((s, i) => `<div class="stop${s.roll ? " roll" : ""}"><span class="n">${["I", "II", "III", "IV", "V", "VI", "VII"][i]}</span><span class="t">${esc(s.t)}</span><span class="d">${esc(s.d)}</span>${s.v ? `<span class="verdict">${esc(s.v)}</span>` : ""}</div>`).join("");
|
||||
|
||||
const chase = stratum(cb, "Form: chasing Blue");
|
||||
$("#truths").innerHTML = `
|
||||
<div class="truth"><h3>Lucky runs get shared</h3><p class="small">Riders hunting a rare dragon logged a Blue in ${pct(chase ? chase.p : null)} of their meadow visits. Riders who logged every run saw it in ${pct(bulkB ? bulkB.p : null)}. The game can't know what you're chasing, so the difference is who chose to write in.</p></div>
|
||||
<div class="truth"><h3>No secret route to the Blue, so far</h3><p class="small">${routeSig.length ? `A few recorded choices showed a link: ${esc(routeSig.map((t) => t.term).join(", "))}.` : "Once that reporting bias is accounted for, none of the recorded choices (direction, first dragon, the cadets, company) changed how often the Blue appeared."} Choices the form doesn't record might still matter.</p></div>
|
||||
<div class="truth"><h3>The right answer can still burn</h3><p class="small">Only ${pct(encB.p)} of Blue attempts bonded, about what the community's step-by-step odds predict. One death with the "right" answer doesn't mean the answer was wrong. Try again in four hours.</p></div>`;
|
||||
<div class="truth"><h3>Lucky runs get shared</h3><p class="small">Riders hunting a rare dragon logged a Blue in ${pct(chase ? chase.p : null)} of their meadow visits. Riders who logged every run saw it in ${pct(bulkB ? bulkB.p : null)}. The game can't know what you're chasing, so the difference is who chose to write in. The odds above lean on the riders who logged every run.</p></div>
|
||||
<div class="truth" id="truth-history"></div>
|
||||
<div class="truth" id="truth-burn"></div>`;
|
||||
$("#h-truths-kicker").textContent = `What ${r.n.toLocaleString()} runs say`;
|
||||
$("#hero-tagline").textContent = `Every path through the valley, mapped from ${r.n.toLocaleString()} runs riders logged.`;
|
||||
}
|
||||
|
||||
@@ -186,7 +211,7 @@
|
||||
window.AtlasUI = {
|
||||
render(state) {
|
||||
renderOverview(state);
|
||||
if (window.ValleyMap) window.ValleyMap.render(state);
|
||||
if (window.ValleyExplorer) window.ValleyExplorer.setRuns(state);
|
||||
},
|
||||
showTab,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user