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
@@ -282,7 +282,9 @@
|
||||
* Returns the value at the root and a decide(name, h) function giving the best option at any history.
|
||||
* `support` lists the options allowed at each decision (options without enough data are left out).
|
||||
*/
|
||||
function solve(params, X, { lam = 0, support = DECISIONS, record = false } = {}) {
|
||||
function solve(params, X, { lam = 0, support = DECISIONS, record = false, only = null } = {}) {
|
||||
// only: bond only at these encounters (e.g. ["meadow-Blue"]); everywhere else the rider dies on purpose
|
||||
const encOptions = (ctx) => (only && !only.includes(ctx) ? ["Die on purpose"] : support.encounter);
|
||||
const score = (v) => (1 - lam) * v.x - lam * v.o + 1e-9 * v.x - 1e-12 * v.o;
|
||||
const memo = new Map();
|
||||
const choices = new Map();
|
||||
@@ -306,7 +308,7 @@
|
||||
const mix = (dist, f) => Object.entries(dist).reduce((acc, [k, p]) => (p ? add(acc, f(k), p) : acc), ZERO);
|
||||
const die = () => ZERO;
|
||||
|
||||
const encounter = (h, ctx) => best("encounter", { ...h, enc: ctx }, support.encounter, (o) => {
|
||||
const encounter = (h, ctx) => best("encounter", { ...h, enc: ctx }, encOptions(ctx), (o) => {
|
||||
if (o === "Die on purpose") return REACHED;
|
||||
const d = params.encounter(ctx);
|
||||
let x = 0, oth = 0;
|
||||
@@ -601,12 +603,12 @@
|
||||
* It re-solves the model locally (a few milliseconds), so it can advise from ANY history, including histories
|
||||
* that already left the recommended route.
|
||||
*/
|
||||
function advisor(sample, X, objective = "eventually") {
|
||||
function advisor(sample, X, objective = "eventually", { only = null } = {}) {
|
||||
const m = sample.model;
|
||||
const params = makeParams(m.tables, { mode: "mean", alphas: m.alphas });
|
||||
const sol = objective === "eventually"
|
||||
? (() => { const r = solveRatio(params, X, { support: m.support }); return solve(params, X, { support: m.support, lam: r.lam, record: true }); })()
|
||||
: solve(params, X, { support: m.support, record: true });
|
||||
? (() => { const r = solveRatio(params, X, { support: m.support, only }); return solve(params, X, { support: m.support, lam: r.lam, record: true, only }); })()
|
||||
: solve(params, X, { support: m.support, record: true, only });
|
||||
const opts = (name, key) => Object.fromEntries(Object.entries(sol.optionValues(name, key) || {}).map(([o, v]) => [o, { pX: v.x, pOther: v.o, pReach: v.r }]));
|
||||
const dec = (name, key, extra = {}) => ({ kind: "decision", var: name, label: LABEL[name], choice: sol.decide(name, key), options: opts(name, key), ...extra });
|
||||
const cha = (name, key, extra = {}) => ({ kind: "chance", var: name, label: LABEL[name], probs: params.chance(name, key), ...extra });
|
||||
@@ -653,7 +655,9 @@
|
||||
return { kind: "end", encounter: enc, action: h.encounter, outcomes: h.encounter === "Die on purpose" ? { burn: 1 } : params.encounter(enc) };
|
||||
}
|
||||
return {
|
||||
colour: X, objective, value: sol.value, step,
|
||||
colour: X, objective, only, value: sol.value, step,
|
||||
/** attempts recorded at an encounter (genuine attempts only), to show how much data a bond chance rests on */
|
||||
attempts: (ctx) => Object.values(((m.tables.encounter || {})[ctx] || { outcomes: {} }).outcomes).reduce((a, b) => a + b, 0),
|
||||
next(h) {
|
||||
const nd = nextDecision(h);
|
||||
if (!nd) return null;
|
||||
@@ -690,5 +694,11 @@
|
||||
reason: idx < 0 && rec.decision !== "encounter" ? "the recommended choice is not on this screen; use the bot's own rules" : `${rec.label}: ${rec.choice}` };
|
||||
}
|
||||
|
||||
return { COLOURS, DECISIONS, CHANCE, prepareRun, countTables, makeParams, fitAlpha, solverHistory, nextDecision, advisor, solve, solveRatio, evaluate, buildPolicy, locate, recommendOption, genuineAttempt };
|
||||
/** Where each colour can be bonded (encounter contexts). The Greens can also end in an Orange or Brown rescue. */
|
||||
const ENCOUNTERS = {
|
||||
Red: ["valley-Red", "tree-Red"], Orange: ["meadow-Orange", "tree-Greens"], Brown: ["meadow-Brown", "tree-Greens"],
|
||||
Green: ["tree-Greens"], Blue: ["meadow-Blue", "shadow-Blue"], Black: ["shadow-Black"],
|
||||
};
|
||||
|
||||
return { ENCOUNTERS, COLOURS, DECISIONS, CHANCE, prepareRun, countTables, makeParams, fitAlpha, solverHistory, nextDecision, advisor, solve, solveRatio, evaluate, buildPolicy, locate, recommendOption, genuineAttempt };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user