Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4a72a08a9 |
+35
-1
@@ -753,6 +753,37 @@
|
|||||||
${trafficToggle()}`;
|
${trafficToggle()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Inside the bonding encounter: the answers the bot gave, screen by screen, on its best logged way to bond this
|
||||||
|
* colour (data/tree.json, analysis/tree/build_tree.py), with what every other answer did. Only shown when the bot's
|
||||||
|
* way goes through the same encounter as the route; the community form does not record these answers. */
|
||||||
|
const TREE_SIDE = (enc) => (/^(valley|meadow)-/.test(enc) ? "valley" : "tree");
|
||||||
|
function encounterAnswers(enc) {
|
||||||
|
const t = st.tree;
|
||||||
|
if (!t) return '<p class="small muted ex-inside">Loading the answers inside the encounter…</p>';
|
||||||
|
const best = (t.best || {})[st.colour];
|
||||||
|
const picks = best && best.picks && best.picks.length ? best.picks : null;
|
||||||
|
const hourAt = picks ? picks.findIndex((p) => (t.screens[p.screen] || {}).stage === "THORN_WALK") : -1;
|
||||||
|
const side = hourAt >= 0 && /valley/i.test(picks[hourAt].text) ? "valley" : "tree";
|
||||||
|
const viaShadow = picks && picks.some((p) => /shadow/i.test(p.text) && !/descend/i.test(p.text));
|
||||||
|
const fits = picks && hourAt >= 0 && side === TREE_SIDE(enc) && (enc.startsWith("shadow-") ? viaShadow : !viaShadow || side === "valley");
|
||||||
|
if (!fits) return `<p class="small muted ex-inside">The bot hasn't bonded a ${st.colour} through ${esc(ENC_NAME[enc] || enc)} yet, so the answers inside this encounter aren't mapped. The community form records only how the encounter ended, not the answers given.</p>`;
|
||||||
|
const died = (o) => (o.to && o.to.DIED ? o.to.DIED.n : 0);
|
||||||
|
const rows = picks.slice(hourAt + 1).map((p, i) => {
|
||||||
|
const sc = t.screens[p.screen] || { options: {} };
|
||||||
|
const me = sc.options[p.option] || { n: p.n, to: {} };
|
||||||
|
const lived = me.n - died(me);
|
||||||
|
const others = Object.entries(sc.options).filter(([k]) => k !== p.option).map(([, o]) =>
|
||||||
|
`<li>${esc(o.text)} <small>${o.n ? `died ${died(o)} of ${o.n}` : "untested"}</small></li>`).join("");
|
||||||
|
return `<li><span class="n">${i + 1}</span><div><b>${esc(p.text)}</b>
|
||||||
|
<small>${me.n ? `got through ${lived} of ${me.n} times` : ""}${me.kind === "fixed" && me.n ? " · always the same so far" : me.kind === "dice" ? " · a roll" : ""}</small>
|
||||||
|
${others ? `<details><summary>Other answers here</summary><ul>${others}</ul></details>` : ""}</div></li>`;
|
||||||
|
}).join("");
|
||||||
|
const end = Object.keys((t.screens[picks[picks.length - 1].screen] || { options: {} }).options[picks[picks.length - 1].option]?.to || {}).find((k) => k.startsWith("BONDED"));
|
||||||
|
return `<div class="ex-inside"><span class="eyebrow">Inside the encounter: the answers that bonded</span>
|
||||||
|
<ol>${rows}</ol>
|
||||||
|
<p class="small muted">${end ? `Bonded a ${end.split(":")[1]}. ` : ""}From the bot's own runs (it logs every screen it sees), so the counts are small; untested answers may also work.</p></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
function panelRoutes(routes) {
|
function panelRoutes(routes) {
|
||||||
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
||||||
const T = model().targets[st.colour], b = T[st.objective];
|
const T = model().targets[st.colour], b = T[st.objective];
|
||||||
@@ -772,7 +803,8 @@
|
|||||||
const open = st.expanded === s.var;
|
const open = st.expanded === s.var;
|
||||||
const opts = open ? `<div class="ex-opts">${Object.entries(s.options).sort((a, c) => c[1].pX - a[1].pX).map(([v, val]) =>
|
const opts = open ? `<div class="ex-opts">${Object.entries(s.options).sort((a, c) => c[1].pX - a[1].pX).map(([v, val]) =>
|
||||||
`<button type="button" class="ex-opt${v === s.taken ? " on" : ""}" data-var="${s.var}" data-v="${esc(v)}"><span>${esc(v)}${v === s.choice ? ' <em class="rec">best</em>' : ""}</span><b>${pct(val.pX)}</b></button>`).join("")}</div>` : "";
|
`<button type="button" class="ex-opt${v === s.taken ? " on" : ""}" data-var="${s.var}" data-v="${esc(v)}"><span>${esc(v)}${v === s.choice ? ' <em class="rec">best</em>' : ""}</span><b>${pct(val.pX)}</b></button>`).join("")}</div>` : "";
|
||||||
return `<li class="dec${open ? " open" : ""}"><button type="button" class="ex-step" data-var="${s.var}" aria-expanded="${open}"><span>${esc(s.label)}</span><b>${esc(String(s.taken))}</b><small>${s.userSet ? "your choice" : "best"} · ${s.var === "encounter" ? pct(s.options[s.taken].pX) : pct(s.options[s.taken].pX)}</small></button>${opts}</li>`;
|
const inside = open && s.var === "encounter" ? encounterAnswers(focus.enc) : "";
|
||||||
|
return `<li class="dec${open ? " open" : ""}"><button type="button" class="ex-step" data-var="${s.var}" aria-expanded="${open}"><span>${esc(s.label)}</span><b>${esc(String(s.taken))}</b><small>${s.userSet ? "your choice" : "best"} · ${s.var === "encounter" ? pct(s.options[s.taken].pX) : pct(s.options[s.taken].pX)}</small></button>${opts}${inside}</li>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
const risks = focus.steps.filter((s) => s.risk && s.risk.p > 0.0005).map((s) => `${s.risk.label.toLowerCase()} ${pct(s.risk.p)}`);
|
const risks = focus.steps.filter((s) => s.risk && s.risk.p > 0.0005).map((s) => `${s.risk.label.toLowerCase()} ${pct(s.risk.p)}`);
|
||||||
const lb = st.policy.samples.lowBias.targets[st.colour].thisAttempt;
|
const lb = st.policy.samples.lowBias.targets[st.colour].thisAttempt;
|
||||||
@@ -926,6 +958,8 @@
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
render();
|
render();
|
||||||
|
// the screen tree (the answers inside each encounter), for the "Bonding encounter" step
|
||||||
|
fetch("data/tree.json").then((r) => r.json()).then((t) => { st.tree = t; if (st.expanded === "encounter") render(); }).catch(() => { st.tree = { best: {}, screens: {} }; });
|
||||||
fetch("data/policy.json").then((r) => r.json()).then((p) => {
|
fetch("data/policy.json").then((r) => r.json()).then((p) => {
|
||||||
st.policy = p;
|
st.policy = p;
|
||||||
S.useGame(p.samples.all); // the game (and where each colour can be bonded) comes with the route model
|
S.useGame(p.samples.all); // the game (and where each colour can be bonded) comes with the route model
|
||||||
|
|||||||
@@ -346,6 +346,14 @@ footer { border-top-color: var(--line); }
|
|||||||
.ex-kinds { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: var(--step--1); color: var(--muted); }
|
.ex-kinds { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: var(--step--1); color: var(--muted); }
|
||||||
.ex-kind { display: inline-flex; align-items: center; gap: 6px; }
|
.ex-kind { display: inline-flex; align-items: center; gap: 6px; }
|
||||||
.ex-kind svg { width: 34px; height: 8px; }
|
.ex-kind svg { width: 34px; height: 8px; }
|
||||||
|
.ex-inside { margin: 10px 0 4px; padding: 10px 12px; border-left: 2px solid var(--c, var(--accent)); background: color-mix(in srgb, var(--bg) 70%, transparent); border-radius: 0 8px 8px 0; }
|
||||||
|
.ex-inside ol { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
|
||||||
|
.ex-inside ol > li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; }
|
||||||
|
.ex-inside .n { font-family: var(--font-display); color: var(--muted); text-align: right; }
|
||||||
|
.ex-inside b { display: block; font-weight: 600; }
|
||||||
|
.ex-inside small { color: var(--muted); }
|
||||||
|
.ex-inside details summary { cursor: pointer; font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.ex-inside ul { margin: 4px 0 0 16px; padding: 0; font-size: var(--step--1); }
|
||||||
.ex-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
|
.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 svg { width: 64px; height: 52px; }
|
||||||
.ex-head h2 { color: var(--c); }
|
.ex-head h2 { color: var(--c); }
|
||||||
|
|||||||
Reference in New Issue
Block a user