site built from fbf42508
This commit is contained in:
@@ -0,0 +1,124 @@
|
|||||||
|
# Threshing Atlas
|
||||||
|
|
||||||
|
Route probabilities and path finding for the Dragonkind threshing: which choices lead to which
|
||||||
|
dragon, how often, how sure we can be, and (in progress) the best route to each colour.
|
||||||
|
|
||||||
|
Unofficial fan project. Not affiliated with Dragonkind or the Fourth Wing publishers.
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
The project has four parts, built on one shared core. Each folder has its own README.
|
||||||
|
|
||||||
|
```
|
||||||
|
core/ the shared model every part uses. spec/ holds the declarative rules (form.yaml: the community
|
||||||
|
form; game.yaml: the game); atlas/ is the Python package that reads them (coding, route model).
|
||||||
|
solver.js (the route advisor) and graph.js (the bot's text) are the only JavaScript, because
|
||||||
|
they run in the browser and in Ken's bot.
|
||||||
|
collection/ getting data in, as extract -> transform -> load: pipeline.yaml declares every source (the
|
||||||
|
community spreadsheet, Reddit threads, "Report a run", the bot, the route PDF, the register);
|
||||||
|
`python -m collection` runs it and builds data/public/runs_clean.csv from all of them.
|
||||||
|
analysis/ making sense of it: stats/ (measures.yaml and site_stats.py: every number on the page), network/ (builds
|
||||||
|
data/public/graph.json), reports/ (generated reports such as POLICY.md)
|
||||||
|
planner/ the route planner: builds data/public/policy.json and its report; the bot uses it for advice
|
||||||
|
and experiments (docs/BOT_INTEGRATION.md)
|
||||||
|
site/ the Atlas web page (site/atlas/), its build script (site/build.js) and QA checks (site/qa/)
|
||||||
|
data/ public/ (everything published, including runs_clean.csv), dictionary.yaml (every column),
|
||||||
|
croissant.json (dataset metadata), manifest.json (current raw versions), bot/ (anonymised bot
|
||||||
|
runs), derived/ (PDF fingerprint), raw/ (current + previous raw files; never committed)
|
||||||
|
docs/ guides that cross sections: privacy and licences, repo settings, bot data protocol, bot
|
||||||
|
integration, colours, roadmap
|
||||||
|
tests/ core/ (rule, statistics, route model and advisor tests), collection/ (the pipeline), parity/
|
||||||
|
(tools to compare two policies), fixtures/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run it locally
|
||||||
|
|
||||||
|
Requirements: Node 18+, Python 3.9+ (`pip install -r requirements.txt`).
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run dev # builds dist/ and serves it at http://localhost:8000
|
||||||
|
npm test # pipeline, coding rules, statistics, route model, game spec, advisor and bot-text tests
|
||||||
|
```
|
||||||
|
|
||||||
|
## New data from the community sources
|
||||||
|
|
||||||
|
A scheduled workflow (`.gitea/workflows/update-sources.yml` on the Atlas's Gitea; `.github/workflows/` holds the
|
||||||
|
GitHub version) runs the collection pipeline every day
|
||||||
|
(`python -m collection update`, see `collection/README.md`). It checks every source in `collection/pipeline.yaml`,
|
||||||
|
and if anything changed it rebuilds the runs and the analysis, runs the tests and opens a pull request that says
|
||||||
|
what changed: new responses, new or renamed questions, new run reports, new result links on Reddit, and for the PDF
|
||||||
|
the pages and lines that are new. The PDF itself is never committed, only a fingerprint. If a source cannot be
|
||||||
|
reached, or new answers do not match `data/dictionary.yaml`, the Action opens an issue instead. Locally:
|
||||||
|
`npm run collect`.
|
||||||
|
|
||||||
|
## Best routes (the solver)
|
||||||
|
|
||||||
|
`npm run policy` (Python: `planner/build_policy.py`, from the game in `core/spec/game.yaml`) rebuilds `data/public/policy.json` and the readable `analysis/reports/POLICY.md` (about 2 minutes:
|
||||||
|
200 posterior draws for two data samples). For every colour it gives the best decision at every point under two
|
||||||
|
objectives: the chance of bonding that colour on this attempt, and the chance the account eventually ends on that
|
||||||
|
colour when you die on purpose whenever a run goes wrong. Chance events (which dragon appears, whether the shadow
|
||||||
|
shows) may depend on earlier choices; how much is learned from the data. See the top of
|
||||||
|
`core/solver.js` for the model and `docs/BOT_INTEGRATION.md` for how the bot uses it.
|
||||||
|
|
||||||
|
## Bot data
|
||||||
|
|
||||||
|
The private DragonKind bot's files are converted locally, and only the anonymised result is committed:
|
||||||
|
|
||||||
|
```
|
||||||
|
DRAGONKIND_BOT_DIR=/path/to/DragonKind DK_ACCOUNT_SALT=... python -m collection update --source bot
|
||||||
|
npm run graph
|
||||||
|
```
|
||||||
|
|
||||||
|
This writes `data/bot/scenes.json` and `data/bot/trajectories-<date>.jsonl`: scene fingerprints, short labels
|
||||||
|
(`collection/specs/bot.yaml`), choice text and outcomes, with no game prose and no account names, and adds the
|
||||||
|
bot's attempts to `runs_clean.csv` (source `bot`). The importer refuses to write anything that looks like prose.
|
||||||
|
See `docs/BOT_DATA_PROTOCOL.md` for what the bot should log.
|
||||||
|
|
||||||
|
## Running everything locally
|
||||||
|
|
||||||
|
`python -m collection refresh` does what the daily workflow does (`python -m collection rebuild` alone redoes everything built from the runs): checks every source, rebuilds the runs,
|
||||||
|
the graph, the route model and the statistics. Add `--bot <folder or zip>` to import bot runs, and
|
||||||
|
`python -m collection export-bot-kit` zips the files the bot uses (see `docs/BOT_INTEGRATION.md`).
|
||||||
|
|
||||||
|
## Updating with new form data by hand
|
||||||
|
|
||||||
|
Download the responses spreadsheet (Google Sheets → File → Download → Microsoft Excel), then:
|
||||||
|
|
||||||
|
```
|
||||||
|
python -m collection update --source reddit_spreadsheet --file reddit_spreadsheet=path/to/export.xlsx
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
Questions are matched by wording; a renamed question is listed in the report, and then `core/spec/form.yaml`
|
||||||
|
needs updating.
|
||||||
|
|
||||||
|
## Changing a coding rule
|
||||||
|
|
||||||
|
The tables (how each question is found, what each answer means, which answers count as missing) are in
|
||||||
|
`core/spec/form.yaml`; the logic that combines them is `code_row()` in `core/atlas/coding.py`. Add a case to
|
||||||
|
`tests/core/test_coding.py` for every rule you change, then run `npm test`.
|
||||||
|
|
||||||
|
## Statistics in one paragraph
|
||||||
|
|
||||||
|
Rates use 95% Wilson score intervals. Each answer is compared with the other answers to the same
|
||||||
|
question by odds ratio (Woolf CI, +0.5 Haldane correction for zero cells) and Fisher's exact test, with
|
||||||
|
Benjamini–Hochberg q-values. Because Blue- and Black-chasers report rare sightings far more often than
|
||||||
|
players who log every run, key outcomes are also modelled with ridge-penalised logistic regression
|
||||||
|
(λ = 1) that includes data source and chase goal, and route rankings use a Mantel–Haenszel odds ratio
|
||||||
|
stratified by the same factors. The page's Methods section has the details.
|
||||||
|
|
||||||
|
## Privacy and licences
|
||||||
|
|
||||||
|
Code: MIT (`LICENSE`). Data produced by this project: CC BY 4.0 (`DATA_LICENSE.md`), which also lists
|
||||||
|
third-party sources that keep their own terms. The rules every part follows (what may be published, what stays
|
||||||
|
local, how bot accounts are anonymised) are in `docs/PRIVACY.md`.
|
||||||
|
|
||||||
|
## Release checks
|
||||||
|
|
||||||
|
```
|
||||||
|
npm test # all tests
|
||||||
|
python site/qa/check_colours.py # dragon colours stay distinguishable (docs/COLOURS.md)
|
||||||
|
npm run build && python3 -m http.server 8765 -d dist &
|
||||||
|
node site/qa/crawl.js /tmp/qa # every tab on desktop and phone: text, links, buttons, errors, overflow
|
||||||
|
node site/qa/mapcheck.js /tmp/qa # every dragon's routes: off-map labels, overlaps, too-faint dragons
|
||||||
|
```
|
||||||
@@ -0,0 +1,629 @@
|
|||||||
|
/* app.js — renders the Threshing Route Atlas. Every number comes precomputed from data/stats.json
|
||||||
|
(analysis/stats/site_stats.py); this file only displays them. */
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
const $ = (s, el = document) => el.querySelector(s);
|
||||||
|
const $$ = (s, el = document) => [...el.querySelectorAll(s)];
|
||||||
|
const NS = "http://www.w3.org/2000/svg";
|
||||||
|
|
||||||
|
const state = {
|
||||||
|
stats: null, preset: "all", P: null, res: null,
|
||||||
|
target: "bond_any", widthMode: "traffic", minN: 10,
|
||||||
|
fxOutcome: "blue_meadow", fxFactor: "resolution", rtTarget: "see_Blue", rtMin: 10,
|
||||||
|
};
|
||||||
|
const META = () => state.stats.meta;
|
||||||
|
const TARGET = (t) => META().targets[t];
|
||||||
|
const MISSING = () => new Set(META().missing_values);
|
||||||
|
const isMissing = (v) => v === null || v === undefined || v === "" || MISSING().has(v);
|
||||||
|
/** A precomputed route ranking at one of the fixed thresholds: rows with at least minN runs, their q-values. */
|
||||||
|
function routesAt(target, minN) {
|
||||||
|
const R = state.P.routes[target], b = R.by_threshold[String(minN)];
|
||||||
|
const rows = R.rows.map((r, i) => ({ ...r, q: b.q[i], mh_q: b.mh_q[i] })).filter((r) => r.n >= minN);
|
||||||
|
return { target, overall: R.overall, minN, n_routes_tested: b.n_routes_tested, rows };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ formatting
|
||||||
|
const pct = (p, d = 1) => (p === null || p === undefined || isNaN(p) ? "–" : (p * 100).toFixed(p > 0 && p < 0.001 ? 2 : d) + "%");
|
||||||
|
const ci = (w, d = 1) => (w && w.n ? `${pct(w.lo, d)}–${pct(w.hi, d)}` : "–");
|
||||||
|
const fmtOR = (x) => (x === null || x === undefined || !isFinite(x) ? "–" : x >= 100 ? x.toFixed(0) : x >= 10 ? x.toFixed(1) : x.toFixed(2));
|
||||||
|
const fmtP = (p) => (p === null || p === undefined ? "–" : p < 0.0001 ? "<0.0001" : p < 0.001 ? p.toExponential(1) : p.toFixed(p < 0.01 ? 3 : 2));
|
||||||
|
const esc = (s) => String(s ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ }[c]));
|
||||||
|
const kn = (w) => (w ? `${w.k}/${w.n}` : "–");
|
||||||
|
const rateTxt = (w, d = 1) => (w && w.n ? `${pct(w.p, d)} (${kn(w)}; 95% CI ${ci(w, d)})` : "no data");
|
||||||
|
|
||||||
|
function cssVar(name) { return getComputedStyle(document.documentElement).getPropertyValue(name).trim(); }
|
||||||
|
function rgb(c) {
|
||||||
|
c = c.trim();
|
||||||
|
if (c.startsWith("#")) {
|
||||||
|
const h = c.length === 4 ? c.slice(1).split("").map((x) => x + x).join("") : c.slice(1);
|
||||||
|
return [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16));
|
||||||
|
}
|
||||||
|
const m = c.match(/\d+(\.\d+)?/g);
|
||||||
|
return m ? m.slice(0, 3).map(Number) : [128, 128, 128];
|
||||||
|
}
|
||||||
|
function mix(a, b, t) {
|
||||||
|
const A = rgb(a), B = rgb(b);
|
||||||
|
return `rgb(${A.map((v, i) => Math.round(v + (B[i] - v) * t)).join(",")})`;
|
||||||
|
}
|
||||||
|
const DRAGON_VAR = { Red: "--dr-red", Green: "--dr-green", Orange: "--dr-orange", Brown: "--dr-brown", Blue: "--dr-blue", Black: "--dr-black" };
|
||||||
|
const dragonColor = (c) => cssVar(DRAGON_VAR[c] || "--dr-any");
|
||||||
|
const targetColor = (t) => dragonColor(TARGET(t).color);
|
||||||
|
|
||||||
|
function svgEl(tag, attrs = {}, parent) {
|
||||||
|
const e = document.createElementNS(NS, tag);
|
||||||
|
for (const [k, v] of Object.entries(attrs)) if (v !== null && v !== undefined) e.setAttribute(k, v);
|
||||||
|
if (parent) parent.appendChild(e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
function toast(msg) {
|
||||||
|
const t = document.createElement("div");
|
||||||
|
t.className = "toast"; t.textContent = msg; document.body.appendChild(t);
|
||||||
|
setTimeout(() => t.remove(), 2200);
|
||||||
|
}
|
||||||
|
async function copyText(text, label) {
|
||||||
|
try { await navigator.clipboard.writeText(text); toast(`Copied ${label}`); }
|
||||||
|
catch (e) {
|
||||||
|
const ta = document.createElement("textarea");
|
||||||
|
ta.value = text; ta.style.position = "fixed"; ta.style.opacity = "0"; document.body.appendChild(ta); ta.select();
|
||||||
|
let ok = false; try { ok = document.execCommand("copy"); } catch (_) { /* ignore */ }
|
||||||
|
ta.remove(); toast(ok ? `Copied ${label}` : "Copy was blocked here. Select the text manually instead.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ tooltip
|
||||||
|
const tip = $("#tip");
|
||||||
|
function showTip(evt, html) {
|
||||||
|
tip.innerHTML = html; tip.hidden = false;
|
||||||
|
const x = evt.clientX ?? (evt.touches && evt.touches[0].clientX) ?? 0, y = evt.clientY ?? 0;
|
||||||
|
const r = tip.getBoundingClientRect();
|
||||||
|
tip.style.left = Math.min(window.innerWidth - r.width - 8, x + 14) + "px";
|
||||||
|
tip.style.top = Math.min(window.innerHeight - r.height - 8, y + 14) + "px";
|
||||||
|
}
|
||||||
|
const hideTip = () => (tip.hidden = true);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ data loading
|
||||||
|
async function loadStats() {
|
||||||
|
state.stats = await (await fetch("data/stats.json")).json();
|
||||||
|
try { state.overlap = await (await fetch("data/overlap.json")).json(); } catch { state.overlap = null; }
|
||||||
|
const sel = $("#f-preset");
|
||||||
|
sel.innerHTML = Object.entries(META().presets).map(([k, l]) => `<option value="${k}">${esc(l)}</option>`).join("");
|
||||||
|
sel.value = state.preset;
|
||||||
|
const th = META().route_thresholds;
|
||||||
|
for (const id of ["#minn", "#rt-min"]) {
|
||||||
|
$(id).innerHTML = th.map((m) => `<option value="${m}">${m}</option>`).join("");
|
||||||
|
$(id).value = String(state.minN);
|
||||||
|
}
|
||||||
|
recompute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function recompute() {
|
||||||
|
state.P = state.stats.presets[state.preset];
|
||||||
|
state.res = state.P.analyse;
|
||||||
|
renderAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ header
|
||||||
|
function renderStatus() {
|
||||||
|
const m = state.res.meta;
|
||||||
|
const src = Object.entries(m.sources).sort((a, b) => b[1] - a[1]).map(([k, v]) => `${k} ${v.toLocaleString()}`).join(" · ");
|
||||||
|
const total = state.stats.data.runs;
|
||||||
|
$("#data-status").innerHTML = `
|
||||||
|
<span><b>${state.res.n.toLocaleString()}</b> runs${state.res.n !== total ? ` of ${total.toLocaleString()}` : ""}</span>
|
||||||
|
<span>${esc(src)}</span>
|
||||||
|
<span>Form dates ${m.date_min || "?"} → ${m.date_max || "?"}</span>
|
||||||
|
<span class="pill">Snapshot of the community form${state.stats.data.exported ? `, exported ${esc(state.stats.data.exported)}` : ""}</span>
|
||||||
|
${state.preset !== "all" ? `<span class="pill warn">Showing: ${esc(state.P.label)}</span>` : ""}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ findings
|
||||||
|
function stratumRate(chance, keyPart) {
|
||||||
|
const e = Object.entries(chance.by_stratum).find(([k]) => k.startsWith(keyPart));
|
||||||
|
return e ? e[1] : null;
|
||||||
|
}
|
||||||
|
const ROUTE_FACTORS = ["direction", "first_sighting", "resolution", "company"];
|
||||||
|
const NOT_A_CHOICE = /^(Unsure|Unknown|Multiple|\(not recorded\)|Unknown\/lost count|Unsure\/unknown)/;
|
||||||
|
|
||||||
|
function buildFindings() {
|
||||||
|
const r = state.res, out = [];
|
||||||
|
const cb = r.chance.blue_meadow, cs = r.chance.shadow;
|
||||||
|
const bulkB = stratumRate(cb, "Bulk"), chaseB = stratumRate(cb, "Form: chasing Blue"), otherB = stratumRate(cb, "Form: other");
|
||||||
|
const encBlue = r.encounters.find((e) => e.context === "Blue (meadow)");
|
||||||
|
const encBlack = r.encounters.find((e) => e.context === "Black (shadow)");
|
||||||
|
|
||||||
|
if (cb.overall.n) {
|
||||||
|
const biasShown = chaseB && bulkB && chaseB.n >= 20 && bulkB.n >= 20 && chaseB.lo > bulkB.hi;
|
||||||
|
let t;
|
||||||
|
if (biasShown) {
|
||||||
|
t = `<p><b>The meadow Blue appeared in ${rateTxt(cb.overall)} of logged meadow visits, but that figure is inflated.</b> Players chasing a rare dragon report it in ${pct(chaseB.p)} of their visits. Bulk logs, which record every run, show ${rateTxt(bulkB)}. The game cannot see what you are chasing, so that gap comes from which runs get reported.</p>`;
|
||||||
|
t += `<p>A realistic expectation is nearer the bulk-log rate, about one meadow visit in ${Math.round(1 / Math.max(bulkB.p, 0.001))}, than the headline figure.${otherB ? ` Form players who were not chasing a Blue report ${pct(otherB.p)}, which still carries some selective reporting.` : ""}</p>`;
|
||||||
|
} else {
|
||||||
|
t = `<p><b>The meadow Blue appeared in ${rateTxt(cb.overall)} of logged meadow visits in the current selection.</b> Compare the data-source filter settings to see how much this depends on who logged the runs.</p>`;
|
||||||
|
}
|
||||||
|
out.push(["bias", "Reporting bias", t]);
|
||||||
|
}
|
||||||
|
const mb = r.models.blue_meadow;
|
||||||
|
if (mb) {
|
||||||
|
const sig = mb.terms.filter((t) => ROUTE_FACTORS.includes(t.factor) && t.p < 0.05 && !NOT_A_CHOICE.test(t.level));
|
||||||
|
const rk = routesAt("see_Blue", state.rtMin);
|
||||||
|
const adjSig = rk.rows.filter((x) => x.mh_q !== undefined && x.mh_q < 0.05);
|
||||||
|
let t = sig.length
|
||||||
|
? `<p><b>After adjusting for reporting bias, ${sig.length === 1 ? "one recorded choice was" : sig.length + " recorded choices were"} linked to the Blue appearing:</b> ${sig.map((s) => `${esc(labelFactor(s.factor))}: ${esc(s.level)} (OR ${fmtOR(s.or)}, 95% CI ${fmtOR(s.lo)}–${fmtOR(s.hi)}, p = ${fmtP(s.p)})`).join("; ")}.</p>`
|
||||||
|
: `<p><b>No recorded route choice changed the chance of the Blue appearing once reporting bias is held fixed.</b> Direction, first sighting, how you handled the cadet and who you entered with all have adjusted odds ratios whose 95% intervals include 1 (n = ${mb.n} meadow visits).</p>`;
|
||||||
|
t += `<p>Of ${rk.n_routes_tested} full routes with at least ${state.rtMin} meadow visits, ${adjSig.length} beat the others after adjustment and correction for multiple testing. The "precise pathways" shared on Reddit may still matter through choices the form does not record, such as the answers given inside each encounter.</p>`;
|
||||||
|
out.push(["blue", "Blue", t]);
|
||||||
|
}
|
||||||
|
if (encBlue && encBlue.overall.n) {
|
||||||
|
out.push(["blue", "Blue", `<p><b>Reaching the Blue is not enough. Only ${rateTxt(encBlue.overall)} of Blue attempts ended in a bond</b> (${pct(encBlue.intent_matched.p)} when the player wanted a Blue). The community PDF's step-by-step survival rates multiply out to about 25% for the standard answers. Expect several Blue encounters per bond, and do not treat one death as proof that an answer is wrong.</p>`]);
|
||||||
|
}
|
||||||
|
if (cs.overall.n) {
|
||||||
|
const bulkS = stratumRate(cs, "Bulk"), formS = Object.entries(cs.by_stratum).filter(([k]) => k.startsWith("Form"));
|
||||||
|
const fw = cs.form_overall, fn = fw.n;
|
||||||
|
let t = `<p><b>The tree shadow showed up in ${rateTxt(cs.overall)} of logged tree climbs.</b>${fn ? ` Form submissions: ${rateTxt(fw)}.` : ""}`;
|
||||||
|
if (bulkS && bulkS.n >= 30 && fn >= 30 && fw.lo > bulkS.hi) t += ` Bulk logs: ${rateTxt(bulkS)}. Those two cannot both be the true rate for the same game. The form figure is the one exposed to selective reporting, so the true rate is probably nearer the bulk logs, whose 95% upper bound is ${pct(bulkS.hi)} per climb.`;
|
||||||
|
t += `</p>`;
|
||||||
|
if (encBlack && encBlack.overall.n) t += `<p>Once the Black appears it is the easiest dragon to bond: ${rateTxt(encBlack.overall)}.</p>`;
|
||||||
|
out.push(["black", "Black", t]);
|
||||||
|
}
|
||||||
|
// leads: unadjusted factor rows with q < 0.05 on route-type factors, for the shadow
|
||||||
|
const leadF = ["post_path", "attempt_group", "direction", "first_sighting", "resolution", "company", "combat_first"];
|
||||||
|
const sh = r.factors.shadow.rows.filter((x) => leadF.includes(x.factor) && x.q !== undefined && x.q < 0.05 && x.or > 1 && !NOT_A_CHOICE.test(x.level));
|
||||||
|
if (sh.length) {
|
||||||
|
const ms = r.models.shadow;
|
||||||
|
let t = `<p><b>Shadow leads to test, not established:</b> ${sh.map((x) => `<i>${esc(labelFactor(x.factor))}: ${esc(x.level)}</i> had the shadow in ${rateTxt(x)} vs the rest (OR ${fmtOR(x.or)}, q = ${fmtP(x.q)})`).join("; ")}.</p>`;
|
||||||
|
const att = ms && ms.terms.find((tm) => tm.factor === "attempt" && tm.level === "First attempt");
|
||||||
|
if (att) t += `<p>The first-attempt pattern survives adjustment for data source, chase goal and direction (OR ${fmtOR(att.or)}, 95% CI ${fmtOR(att.lo)}–${fmtOR(att.hi)}). That matches a theory on Reddit that a fresh account rolls the shadow more often, but players who strike lucky on a first run may also be more likely to submit the form.</p>`;
|
||||||
|
t += `<p>The cheapest test is a bulk log that records every tree climb, including the dull ones, with these choices noted.</p>`;
|
||||||
|
out.push(["lead", "Lead", t]);
|
||||||
|
}
|
||||||
|
// common dragons
|
||||||
|
const common = r.encounters.filter((e) => ["Red (valley)", "Green (two Greens)", "Orange (meadow)", "Brown (meadow)", "Red (tree, descend quickly)"].includes(e.context) && e.intent_matched.n >= 10);
|
||||||
|
if (common.length) {
|
||||||
|
out.push(["", "Common", `<p><b>For the common colours, intent matters more than route.</b> Among players who wanted that colour: ${common.map((e) => `${esc(e.context)} ${pct(e.intent_matched.p, 0)} (${kn(e.intent_matched)})`).join(", ")}. The tree Red is the hardest bond in the game.</p>`]);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function renderFindings() {
|
||||||
|
$("#findings-list").innerHTML = buildFindings().map(([cls, tag, html], i) =>
|
||||||
|
`<div class="finding ${cls}"><span class="mark">${i + 1}</span><div><span class="tag">${esc(tag)}</span>${html}</div></div>`).join("");
|
||||||
|
}
|
||||||
|
const FACTOR_LABEL = { company: "Company", direction: "Direction", first_sighting: "First sighting", scream: "Scream choice", resolution: "Cadet encounter",
|
||||||
|
combat_first: "First combat move", post_path: "Fork in the road", hour: "After an hour", wing: "Wing", squad: "Squad",
|
||||||
|
attempt_group: "Attempt", entry: "Data source", source: "Data source", goal: "Chasing", attempt: "Attempt", period: "Date",
|
||||||
|
sighting_action: "Reaction to the first dragon", combat_second: "Second combat move", malek_intent: "Planned to seek Malek", };
|
||||||
|
const labelFactor = (f) => FACTOR_LABEL[f] || f;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ route map
|
||||||
|
// first row: bonding each dragon (all six treated alike); second row: the two rare sightings
|
||||||
|
const RARE_T = ["bond_Red", "bond_Orange", "bond_Brown", "bond_Green", "bond_Blue", "bond_Black", "bond_any"];
|
||||||
|
const OTHER_T = ["see_Blue", "see_shadow"];
|
||||||
|
function renderTargets() {
|
||||||
|
const chip = (t, featured) => {
|
||||||
|
const c = TARGET(t).color ? DRAGON_VAR[TARGET(t).color] : "--dr-any";
|
||||||
|
return `<button type="button" class="tchip${featured ? " featured" : ""}" data-t="${t}" aria-pressed="${state.target === t}" style="--c: var(${c})"><span class="sw"></span>${esc(TARGET(t).label)}</button>`;
|
||||||
|
};
|
||||||
|
$("#targets-rare").innerHTML = RARE_T.map((t) => chip(t, false)).join("");
|
||||||
|
$("#targets-other").innerHTML = OTHER_T.map((t) => chip(t, false)).join("");
|
||||||
|
$$(".tchip[data-t]").forEach((b) => b.addEventListener("click", () => { state.target = b.dataset.t; $("#best-routes").innerHTML = ""; renderTargets(); renderMap(); }));
|
||||||
|
}
|
||||||
|
const ORDER = {
|
||||||
|
company: ["Alone", "1 Squadmate", "2 Squadmates"],
|
||||||
|
direction: ["East", "Center", "West"],
|
||||||
|
first_sighting: ["Red", "Orange", "Brown", "Green"],
|
||||||
|
post_path: ["Forest", "West", "East", "(no fork)"],
|
||||||
|
hour: ["Climb the tree", "Valley centre"],
|
||||||
|
encounter: ["Tree: Red below", "Tree: two Greens", "Tree: shadow → Blue/Black", "Valley: bond the Red", "Meadow: Orange", "Meadow: Brown", "Meadow: Orange/Brown", "Meadow: Blue", "Meadow (no attempt recorded)"],
|
||||||
|
end: ["Bonded Red", "Bonded Green", "Bonded Orange", "Bonded Brown", "Bonded Blue", "Bonded Black", "Incinerated", "Died before the hour"],
|
||||||
|
};
|
||||||
|
const SHORT = {
|
||||||
|
"Help → Killed the bullies yourself": "Help · killed bullies", "Help → Squadmate's revenge": "Help · squadmate's revenge",
|
||||||
|
"Help → Left bullies to the dragons": "Help · left to dragons", "Help → DIED in combat": "Help · died in combat", "Help → Unknown": "Help · unknown",
|
||||||
|
"Ignore the scream → Tourniquet": "Ignore · tourniquet", "Ignore the scream → Left injured cadet": "Ignore · left cadet",
|
||||||
|
"Ignore the scream → Took their weapons": "Ignore · took weapons", "Investigate & leave → Left them to it": "Investigate · walked away",
|
||||||
|
"Tree: shadow → Blue/Black": "Tree: shadow (Blue→Black)", "Meadow (no attempt recorded)": "Meadow: none recorded", "Unknown → Unknown": "Unknown",
|
||||||
|
};
|
||||||
|
const short = (v) => SHORT[v] || v;
|
||||||
|
|
||||||
|
function renderMap() {
|
||||||
|
const svg = $("#map");
|
||||||
|
svg.innerHTML = "";
|
||||||
|
// the precomputed route map, with the chosen outcome's counts and intervals on every box and band
|
||||||
|
const G = state.P.map, BT = G.by_target[state.target];
|
||||||
|
const sel = { nodes: G.nodes.map((n, i) => ({ ...n, ...BT.nodes[i] })), links: G.links.map((l, i) => ({ ...l, ...BT.links[i] })) };
|
||||||
|
const base = sel;
|
||||||
|
const STAGES = META().stages;
|
||||||
|
const minN = state.minN;
|
||||||
|
const tcol = targetColor(state.target), low = cssVar("--link-low"), surface = cssVar("--raised");
|
||||||
|
|
||||||
|
const shell = $(".map-scroll");
|
||||||
|
const W = Math.max(1440, shell.clientWidth || 1440), H = 660, top = 40, bottom = 16, left = 10, right = 168, nodeW = 12;
|
||||||
|
svg.setAttribute("width", W); svg.setAttribute("height", H); svg.setAttribute("viewBox", `0 0 ${W} ${H}`);
|
||||||
|
const S = STAGES.length;
|
||||||
|
const colX = (i) => left + (i * (W - left - right - nodeW)) / (S - 1);
|
||||||
|
const cols = STAGES.map((s, i) => {
|
||||||
|
const ns = base.nodes.filter((n) => n.stage === i);
|
||||||
|
const ord = ORDER[s.key];
|
||||||
|
ns.sort((a, b) => {
|
||||||
|
const ia = ord ? ord.indexOf(a.value) : -1, ib = ord ? ord.indexOf(b.value) : -1;
|
||||||
|
if (ia !== -1 || ib !== -1) return (ia === -1 ? 99 : ia) - (ib === -1 ? 99 : ib);
|
||||||
|
return b.n - a.n;
|
||||||
|
});
|
||||||
|
return ns;
|
||||||
|
});
|
||||||
|
const pad = 7;
|
||||||
|
const maxTotal = Math.max(...cols.map((c) => c.reduce((s, n) => s + n.n, 0)));
|
||||||
|
const maxCount = Math.max(...cols.map((c) => c.length));
|
||||||
|
const scale = (H - top - bottom - pad * (maxCount - 1)) / maxTotal;
|
||||||
|
const pos = new Map();
|
||||||
|
cols.forEach((ns, i) => {
|
||||||
|
const hTot = ns.reduce((s, n) => s + Math.max(2, n.n * scale), 0) + pad * (ns.length - 1);
|
||||||
|
let y = top + (H - top - bottom - hTot) / 2;
|
||||||
|
ns.forEach((n) => { const h = Math.max(2, n.n * scale); pos.set(n.id, { x: colX(i), y, h, n }); y += h + pad; });
|
||||||
|
});
|
||||||
|
|
||||||
|
// colour scale: anchored on the route steps, not on the outcome column (where the target node is 100% by definition)
|
||||||
|
const lastStage = S - 1;
|
||||||
|
const stageOf = (id) => +id.split("|")[0];
|
||||||
|
const eligible = sel.links.filter((l) => l.n >= minN && stageOf(l.target) < lastStage);
|
||||||
|
const pmax = Math.max(0.005, ...eligible.map((l) => l.p), ...sel.nodes.filter((n) => n.n >= minN && n.stage < lastStage).map((n) => n.p));
|
||||||
|
const colorFor = (o) => (o.n < minN ? low : mix(low, tcol, Math.pow(Math.min(1, o.p / pmax), 0.75)));
|
||||||
|
|
||||||
|
// stage headers
|
||||||
|
STAGES.forEach((s, i) => {
|
||||||
|
const chance = s.chance;
|
||||||
|
const t = svgEl("text", { x: colX(i), y: 18, class: "stage-label" + (chance ? " stage-chance" : "") }, svg);
|
||||||
|
t.textContent = s.label;
|
||||||
|
if (chance) { const r = svgEl("text", { x: colX(i), y: 31, class: "stage-label stage-chance" }, svg); r.textContent = "game roll"; }
|
||||||
|
});
|
||||||
|
|
||||||
|
// links
|
||||||
|
const gLinks = svgEl("g", {}, svg);
|
||||||
|
const outOff = new Map(), inOff = new Map();
|
||||||
|
const linksSorted = sel.links.slice().sort((a, b) => pos.get(a.source).y - pos.get(b.source).y || pos.get(a.target).y - pos.get(b.target).y);
|
||||||
|
// order out-links by target y and in-links by source y for clean stacking
|
||||||
|
const byOut = {}, byIn = {};
|
||||||
|
linksSorted.forEach((l) => { (byOut[l.source] = byOut[l.source] || []).push(l); (byIn[l.target] = byIn[l.target] || []).push(l); });
|
||||||
|
Object.values(byOut).forEach((ls) => ls.sort((a, b) => pos.get(a.target).y - pos.get(b.target).y));
|
||||||
|
Object.values(byIn).forEach((ls) => ls.sort((a, b) => pos.get(a.source).y - pos.get(b.source).y));
|
||||||
|
const offOut = {}, offIn = {};
|
||||||
|
Object.entries(byOut).forEach(([id, ls]) => { let o = 0; ls.forEach((l) => { offOut[l.id] = o; o += l.n * scale; }); });
|
||||||
|
Object.entries(byIn).forEach(([id, ls]) => { let o = 0; ls.forEach((l) => { offIn[l.id] = o; o += l.n * scale; }); });
|
||||||
|
const drawOrder = state.widthMode === "prob" ? sel.links.slice().sort((a, b) => (a.n >= minN) - (b.n >= minN) || a.p - b.p) : linksSorted;
|
||||||
|
drawOrder.forEach((l) => {
|
||||||
|
const s = pos.get(l.source), t = pos.get(l.target);
|
||||||
|
if (!s || !t) return;
|
||||||
|
const x0 = s.x + nodeW, x1 = t.x, xm = (x0 + x1) / 2;
|
||||||
|
let el;
|
||||||
|
if (state.widthMode === "traffic") {
|
||||||
|
const w = Math.max(0.6, l.n * scale);
|
||||||
|
const y0 = s.y + offOut[l.id], y1 = t.y + offIn[l.id];
|
||||||
|
el = svgEl("path", {
|
||||||
|
d: `M${x0},${y0}C${xm},${y0} ${xm},${y1} ${x1},${y1}L${x1},${y1 + w}C${xm},${y1 + w} ${xm},${y0 + w} ${x0},${y0 + w}Z`,
|
||||||
|
fill: colorFor(l), "fill-opacity": l.n >= minN ? 0.62 : 0.3, class: "link",
|
||||||
|
}, gLinks);
|
||||||
|
} else {
|
||||||
|
const y0 = s.y + s.h / 2, y1 = t.y + t.h / 2;
|
||||||
|
const w = l.n >= minN ? 1.2 + 18 * (l.p / pmax) : 1;
|
||||||
|
el = svgEl("path", { d: `M${x0},${y0}C${xm},${y0} ${xm},${y1} ${x1},${y1}`, fill: "none", stroke: colorFor(l), "stroke-width": w, "stroke-opacity": l.n >= minN ? 0.8 : 0.3, "stroke-linecap": "round", class: "link" }, gLinks);
|
||||||
|
}
|
||||||
|
const sv = pos.get(l.source).n.value, tv = pos.get(l.target).n.value;
|
||||||
|
el.addEventListener("mousemove", (e) => showTip(e, `<div class="t">${esc(sv)} → ${esc(tv)}</div>${l.n} runs<br>${esc(TARGET(state.target).label)}: <b>${pct(l.p)}</b> (${kn(l)})<br>95% CI ${ci(l)}${l.n < minN ? "<br><i>Too few runs to read</i>" : ""}`));
|
||||||
|
el.addEventListener("mouseleave", hideTip);
|
||||||
|
});
|
||||||
|
|
||||||
|
// nodes
|
||||||
|
const gNodes = svgEl("g", {}, svg);
|
||||||
|
cols.forEach((ns, i) => {
|
||||||
|
let lastLabelBottom = -1e9;
|
||||||
|
ns.forEach((bn) => {
|
||||||
|
const p = pos.get(bn.id), sn = bn;
|
||||||
|
const g = svgEl("g", { class: "node", tabindex: 0, "aria-label": `${STAGES[i].label}: ${bn.value}, ${bn.n} runs` }, gNodes);
|
||||||
|
svgEl("rect", { x: p.x, y: p.y, width: nodeW, height: p.h, rx: 2, fill: colorFor(sn) }, g);
|
||||||
|
const lx = p.x + nodeW + 5, ly = p.y + p.h / 2 + 4;
|
||||||
|
if (ly - 11 > lastLabelBottom) {
|
||||||
|
const t = svgEl("text", { x: lx, y: ly, "paint-order": "stroke", stroke: surface, "stroke-width": 3, "stroke-linejoin": "round" }, g);
|
||||||
|
const lab = short(bn.value), maxC = i === S - 1 ? 30 : Math.floor((colX(1) - colX(0) - nodeW - 36) / 5.8);
|
||||||
|
t.textContent = lab.length > maxC ? lab.slice(0, maxC - 1) + "…" : lab;
|
||||||
|
const t2 = svgEl("tspan", { fill: cssVar("--muted"), dx: 4 }, t);
|
||||||
|
t2.textContent = sn.n >= minN ? pct(sn.p, 0) : `n=${sn.n}`;
|
||||||
|
lastLabelBottom = ly;
|
||||||
|
}
|
||||||
|
const html = () => `<div class="t">${esc(STAGES[i].label)}: ${esc(bn.value)}</div>${bn.n} runs<br>${esc(TARGET(state.target).label)}: <b>${pct(sn.p)}</b> (${sn.k}/${sn.n})<br>95% CI ${ci(sn)}`;
|
||||||
|
g.addEventListener("mousemove", (e) => showTip(e, html()));
|
||||||
|
g.addEventListener("focus", (e) => { const r = e.target.getBoundingClientRect(); showTip({ clientX: r.right, clientY: r.top }, html()); });
|
||||||
|
g.addEventListener("mouseleave", hideTip);
|
||||||
|
g.addEventListener("blur", hideTip);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
renderLegend(pmax, tcol, low);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderLegend(pmax, tcol, low) {
|
||||||
|
$("#legend").innerHTML = `
|
||||||
|
<span>${state.widthMode === "traffic" ? "Band width = number of runs" : "Line width = chance of the outcome"}</span>
|
||||||
|
<span style="display:inline-flex;gap:6px;align-items:center">0% <span class="ramp" style="background:linear-gradient(90deg, ${low}, ${tcol})"></span> ${pct(pmax, 0)}</span>
|
||||||
|
<span>Grey = fewer than ${state.minN} runs</span>
|
||||||
|
<span><span style="color:var(--accent)">Gold headings</span> = steps the game rolls, not you</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderBestRoutes() {
|
||||||
|
const rk = routesAt(state.target, state.minN);
|
||||||
|
const rows = rk.rows.slice(0, 8);
|
||||||
|
const sigN = rk.rows.filter((r) => r.mh_q !== undefined && r.mh_q < 0.05 && r.mh_or > 1).length;
|
||||||
|
$("#best-routes").innerHTML = `<div class="panel">
|
||||||
|
<h3>Top routes for "${esc(TARGET(state.target).label)}" <span class="small muted">routes with ≥ ${state.minN} runs, ranked by the lower end of the 95% interval</span></h3>
|
||||||
|
<p class="small">${rows.length ? `Overall rate in the comparison group: ${rateTxt(rk.overall)}. <b>${sigN} of ${rk.n_routes_tested} routes are better than the rest after adjusting for reporting bias and multiple testing.</b> ${sigN === 0 ? "Treat the ordering below as noise unless a newer export changes this." : ""}` : "No route has enough runs at this threshold. Lower the minimum."}</p>
|
||||||
|
${rows.length ? `<div class="tbl-wrap"><table><thead><tr><th>Route (choices up to the hour)</th><th class="num">Runs</th><th class="num">Rate</th><th class="num">95% CI</th><th class="num">Adj. OR</th><th class="num">Adj. q</th></tr></thead><tbody>
|
||||||
|
${rows.map((r, i) => `<tr class="${r.mh_q < 0.05 && r.mh_or > 1 ? "sig" : ""}"><td class="route-cell">${esc(r.route)}</td><td class="num">${r.n}</td><td class="num">${pct(r.p)}</td><td class="num">${ci(r)}</td><td class="num">${fmtOR(r.mh_or)}</td><td class="num">${fmtP(r.mh_q)}</td></tr>`).join("")}
|
||||||
|
</tbody></table></div>` : ""}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ small charts
|
||||||
|
// Horizontal rate bars with 95% CI whiskers.
|
||||||
|
function ciBars(el, rows, opts = {}) {
|
||||||
|
const W = 640, rowH = opts.rowH || 26, lw = opts.labelW || 190, top = 8, bottom = 26;
|
||||||
|
const H = top + bottom + rows.length * rowH;
|
||||||
|
const xmax = opts.max || Math.min(1, Math.max(0.05, ...rows.map((r) => r.hi || 0)) * 1.08);
|
||||||
|
const x = (v) => lw + (v / xmax) * (W - lw - 120);
|
||||||
|
const svg = svgEl("svg", { viewBox: `0 0 ${W} ${H}`, width: W, height: H, role: "img" });
|
||||||
|
const ticks = niceTicks(xmax);
|
||||||
|
const ga = svgEl("g", { class: "axis" }, svg);
|
||||||
|
ticks.forEach((t) => {
|
||||||
|
svgEl("line", { x1: x(t), x2: x(t), y1: top, y2: H - bottom + 4 }, ga);
|
||||||
|
const tx = svgEl("text", { x: x(t), y: H - 8, "text-anchor": "middle" }, ga); tx.textContent = pct(t, 0);
|
||||||
|
});
|
||||||
|
rows.forEach((r, i) => {
|
||||||
|
const y = top + i * rowH + rowH / 2;
|
||||||
|
const lab = svgEl("text", { x: lw - 8, y: y + 4, "text-anchor": "end" }, svg); lab.textContent = r.label;
|
||||||
|
if (r.indent) lab.setAttribute("fill", cssVar("--muted"));
|
||||||
|
if (!r.n) { const t = svgEl("text", { x: lw, y: y + 4, fill: cssVar("--faint") }, svg); t.textContent = "no runs"; return; }
|
||||||
|
const col = r.color || cssVar("--muted");
|
||||||
|
svgEl("rect", { x: lw, y: y - 7, width: Math.max(1, x(r.p) - lw), height: 14, fill: col, "fill-opacity": 0.28, rx: 2 }, svg);
|
||||||
|
svgEl("line", { x1: x(r.lo), x2: x(r.hi), y1: y, y2: y, stroke: col, "stroke-width": 2 }, svg);
|
||||||
|
svgEl("line", { x1: x(r.lo), x2: x(r.lo), y1: y - 5, y2: y + 5, stroke: col, "stroke-width": 2 }, svg);
|
||||||
|
svgEl("line", { x1: x(r.hi), x2: x(r.hi), y1: y - 5, y2: y + 5, stroke: col, "stroke-width": 2 }, svg);
|
||||||
|
svgEl("circle", { cx: x(r.p), cy: y, r: 4, fill: col }, svg);
|
||||||
|
const v = svgEl("text", { x: x(r.hi) + 6, y: y + 4, "font-family": "var(--font-data)" }, svg);
|
||||||
|
v.textContent = `${pct(r.p)} · ${r.k}/${r.n}`;
|
||||||
|
});
|
||||||
|
el.innerHTML = ""; el.appendChild(svg);
|
||||||
|
}
|
||||||
|
function niceTicks(max) {
|
||||||
|
const steps = [0.01, 0.02, 0.05, 0.1, 0.2, 0.25];
|
||||||
|
const step = steps.find((s) => max / s <= 6) || 0.25;
|
||||||
|
const out = []; for (let v = 0; v <= max + 1e-9; v += step) out.push(+v.toFixed(4)); return out;
|
||||||
|
}
|
||||||
|
// Forest plot of odds ratios on a log axis.
|
||||||
|
function forest(el, terms, opts = {}) {
|
||||||
|
const W = 640, rowH = 22, lw = opts.labelW || 290, top = 8, bottom = 28;
|
||||||
|
const H = top + bottom + Math.max(1, terms.length) * rowH;
|
||||||
|
const lo = 0.05, hi = 20;
|
||||||
|
const x = (v) => lw + ((Math.log(Math.min(hi, Math.max(lo, v))) - Math.log(lo)) / (Math.log(hi) - Math.log(lo))) * (W - lw - 60);
|
||||||
|
const svg = svgEl("svg", { viewBox: `0 0 ${W} ${H}`, width: W, height: H, role: "img" });
|
||||||
|
const ga = svgEl("g", { class: "axis" }, svg);
|
||||||
|
[0.1, 0.25, 0.5, 1, 2, 4, 10].forEach((t) => {
|
||||||
|
svgEl("line", { x1: x(t), x2: x(t), y1: top, y2: H - bottom + 4, "stroke-dasharray": t === 1 ? "" : "2 3", "stroke-width": t === 1 ? 1.5 : 1 }, ga);
|
||||||
|
const tx = svgEl("text", { x: x(t), y: H - 10, "text-anchor": "middle" }, ga); tx.textContent = t;
|
||||||
|
});
|
||||||
|
terms.forEach((t, i) => {
|
||||||
|
const y = top + i * rowH + rowH / 2;
|
||||||
|
const sig = t.p !== undefined ? t.p < 0.05 : t.q < 0.05;
|
||||||
|
const col = sig ? cssVar("--accent") : cssVar("--muted");
|
||||||
|
const lab = svgEl("text", { x: lw - 8, y: y + 4, "text-anchor": "end" }, svg);
|
||||||
|
lab.textContent = (t.label.length > 40 ? t.label.slice(0, 39) + "…" : t.label) + (t.n !== undefined ? ` (n=${t.n})` : "");
|
||||||
|
svgEl("line", { x1: x(t.lo), x2: x(t.hi), y1: y, y2: y, stroke: col, "stroke-width": 2 }, svg);
|
||||||
|
svgEl("rect", { x: x(t.or) - 4, y: y - 4, width: 8, height: 8, fill: col }, svg);
|
||||||
|
const v = svgEl("text", { x: W - 4, y: y + 4, "text-anchor": "end", "font-family": "var(--font-data)", fill: cssVar("--muted") }, svg);
|
||||||
|
v.textContent = fmtOR(t.or);
|
||||||
|
});
|
||||||
|
el.innerHTML = ""; el.appendChild(svg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ rare section
|
||||||
|
const STRATUM_ORDER = ["Bulk logs (imports)", "Form: other/blank goal", "Form: chasing Black", "Form: chasing Blue", "Form: chasing Blue or Black"];
|
||||||
|
function renderRare() {
|
||||||
|
const r = state.res;
|
||||||
|
const blueCol = dragonColor("Blue"), blackCol = dragonColor("Black");
|
||||||
|
const strataRows = (c, col) => [{ label: "All rows", ...c.overall, color: cssVar("--ink") }].concat(
|
||||||
|
STRATUM_ORDER.filter((s) => c.by_stratum[s]).map((s) => ({ label: s, ...c.by_stratum[s], color: col })),
|
||||||
|
Object.entries(c.by_attempt).filter(([k]) => !isMissing(k)).map(([k, w]) => ({ label: k, ...w, color: cssVar("--accent") })));
|
||||||
|
ciBars($("#ch-blue-strata"), strataRows(r.chance.blue_meadow, blueCol), { labelW: 180 });
|
||||||
|
ciBars($("#ch-shadow-strata"), strataRows(r.chance.shadow, blackCol), { labelW: 180 });
|
||||||
|
const termsOf = (m, skip = []) => (m ? m.terms.filter((t) => t.n >= 5 && !skip.includes(t.factor) && !isMissing(t.level)) /* the "goal not asked" stratum stays in the model as an adjustment, but is not a finding */.map((t) => ({ label: `${labelFactor(t.factor)}: ${t.level}`, or: t.or, lo: t.lo, hi: t.hi, p: t.p, n: t.n })) : []);
|
||||||
|
const mb = r.models.blue_meadow, ms = r.models.shadow;
|
||||||
|
forest($("#ch-model-blue"), termsOf(mb));
|
||||||
|
forest($("#ch-model-shadow"), termsOf(ms));
|
||||||
|
const refTxt = (m) => (m ? `Reference answers: ${Object.entries(m.refs).map(([f, v]) => `${labelFactor(f)} = ${v}`).join(", ")}. n = ${m.n}, events = ${m.events}. Gold = p < 0.05 (not corrected for the number of terms).` : "Not enough data.");
|
||||||
|
$("#model-blue-note").textContent = refTxt(mb);
|
||||||
|
$("#model-shadow-note").textContent = refTxt(ms);
|
||||||
|
renderDaily();
|
||||||
|
const enc = r.encounters.filter((e) => ["Blue (meadow)", "Blue (shadow)", "Black (shadow)"].includes(e.context));
|
||||||
|
ciBars($("#ch-rare-bond"), enc.flatMap((e) => [
|
||||||
|
{ label: e.context, ...e.overall, color: dragonColor(e.color) },
|
||||||
|
{ label: "↳ players who wanted it", ...e.intent_matched, color: dragonColor(e.color), indent: true }]), { labelW: 200, max: 1 });
|
||||||
|
renderPdfSteps();
|
||||||
|
}
|
||||||
|
function renderDaily() {
|
||||||
|
const d = state.res.daily.filter((x) => x.meadow_n + x.tree_n > 0);
|
||||||
|
const el = $("#ch-daily");
|
||||||
|
if (!d.length) { el.textContent = "No dated runs in the current filter."; return; }
|
||||||
|
const W = 640, H = 250, l = 44, rgt = 24, top = 16, mid = 125, bottom = 30;
|
||||||
|
const svg = svgEl("svg", { viewBox: `0 0 ${W} ${H}`, width: W, height: H, role: "img" });
|
||||||
|
const x = (i) => l + (d.length === 1 ? (W - l - rgt) / 2 : (i * (W - l - rgt)) / (d.length - 1));
|
||||||
|
const panels = [
|
||||||
|
{ y0: top, y1: mid - 14, w: "blue", col: dragonColor("Blue"), name: "Blue in meadow" },
|
||||||
|
{ y0: mid + 6, y1: H - bottom, w: "shadow", col: dragonColor("Black"), name: "Shadow at tree" },
|
||||||
|
];
|
||||||
|
panels.forEach((P) => {
|
||||||
|
const vals = d.map((r) => r[P.w]);
|
||||||
|
const ymax = Math.min(1, Math.max(0.05, ...vals.filter((v) => v.n >= 5).map((v) => v.hi)));
|
||||||
|
const y = (v) => P.y1 - (v / ymax) * (P.y1 - P.y0);
|
||||||
|
const ga = svgEl("g", { class: "axis" }, svg);
|
||||||
|
[0, ymax / 2, ymax].forEach((t) => { svgEl("line", { x1: l, x2: W - rgt, y1: y(t), y2: y(t) }, ga); const tx = svgEl("text", { x: l - 6, y: y(t) + 3, "text-anchor": "end" }, ga); tx.textContent = pct(t, 0); });
|
||||||
|
const nm = svgEl("text", { x: l + 4, y: P.y0 + 10, fill: P.col, "font-weight": 600 }, svg); nm.textContent = P.name;
|
||||||
|
const yc = (v) => y(Math.min(ymax, v));
|
||||||
|
vals.forEach((v, i) => {
|
||||||
|
if (v.n < 3) return;
|
||||||
|
svgEl("line", { x1: x(i), x2: x(i), y1: yc(v.lo), y2: yc(v.hi), stroke: P.col, "stroke-opacity": 0.45, "stroke-width": 1.5 }, svg);
|
||||||
|
const c = svgEl("circle", { cx: x(i), cy: yc(v.p), r: 2 + Math.sqrt(v.n) / 2.2, fill: P.col, "fill-opacity": 0.85 }, svg);
|
||||||
|
c.addEventListener("mousemove", (e) => showTip(e, `<div class="t">${d[i].date} · ${P.name}</div>${pct(v.p)} (${kn(v)})<br>95% CI ${ci(v)}`));
|
||||||
|
c.addEventListener("mouseleave", hideTip);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const ga = svgEl("g", { class: "axis" }, svg);
|
||||||
|
d.forEach((r, i) => { if (i % Math.ceil(d.length / 8) === 0 || i === d.length - 1) { const t = svgEl("text", { x: x(i), y: H - 10, "text-anchor": "middle" }, ga); t.textContent = r.date.slice(5); } });
|
||||||
|
el.innerHTML = ""; el.appendChild(svg);
|
||||||
|
}
|
||||||
|
function renderPdfSteps() {
|
||||||
|
const blue = [["Approach the Blue: “Absolutely…”", "90%"], ["Hold the Blue's glare and advance", "80%"], ["Do nothing (it seizes the other cadet)", "82%"], ["Hold glare and watch", "84%"], ["Straighten your spine", "83%"], ["Launch yourself right (boulder)", "93%"], ["“Bring down an empire”", "81%"], ["Move slowly forward, wait for an invitation", "81%"]];
|
||||||
|
const prod = [0.9, 0.8, 0.82, 0.84, 0.83, 0.93, 0.81, 0.81].reduce((a, b) => a * b, 1);
|
||||||
|
$("#pdf-steps").innerHTML = `<p class="small muted">As published in the community PDF (u/ClumsyBadger, u/Old_Regular3018). These come from hand-coded free-text answers. The underlying counts are not shown there, and many cells rest on fewer than 10 runs.</p>
|
||||||
|
<div class="tbl-wrap"><table><thead><tr><th>Meadow Blue, standard answers</th><th class="num">Survived step</th></tr></thead><tbody>${blue.map(([a, b]) => `<tr><td>${a}</td><td class="num">${b}</td></tr>`).join("")}
|
||||||
|
<tr><td><b>All eight steps (product)</b></td><td class="num"><b>${pct(prod, 0)}</b></td></tr></tbody></table></div>
|
||||||
|
<p class="small">The product, about ${pct(prod, 0)}, agrees with the form's own Blue bond rate (${rateTxt(state.res.encounters.find((e) => e.context === "Blue (meadow)").overall)}), which is a useful cross-check.</p>
|
||||||
|
<div class="tbl-wrap"><table><thead><tr><th>Black (after the shadow and the tree Blue)</th><th class="num">PDF outcome</th></tr></thead><tbody>
|
||||||
|
<tr><td>Turn to face the threat → hold its gaze</td><td class="num">66% bonded · 33% incinerated</td></tr>
|
||||||
|
<tr><td>Turn to face the threat → lower your eyes → try to mount → meet its gaze</td><td class="num">100% bonded (very few runs)</td></tr></tbody></table></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ every dragon
|
||||||
|
function renderDragons() {
|
||||||
|
const r = state.res;
|
||||||
|
const order = ["Red (valley)", "Red (tree, descend quickly)", "Green (two Greens)", "Orange (meadow)", "Brown (meadow)", "Blue (meadow)", "Blue (shadow)", "Black (shadow)"];
|
||||||
|
const rows = order.map((c) => r.encounters.find((e) => e.context === c)).filter(Boolean).flatMap((e) => [
|
||||||
|
{ label: `${e.context}`, ...e.overall, color: dragonColor(e.color) },
|
||||||
|
{ label: "↳ players who wanted it", ...e.intent_matched, color: dragonColor(e.color), indent: true }]);
|
||||||
|
const box = $("#ch-encounters");
|
||||||
|
box.innerHTML = `<h3>Bond rate once the encounter starts</h3><div class="chart" id="ch-enc-inner"></div>`;
|
||||||
|
ciBars($("#ch-enc-inner"), rows, { labelW: 220, max: 1, rowH: 22 });
|
||||||
|
const g = r.green_rescue;
|
||||||
|
const parts = [["Bonded a Green", g.bonded_green, dragonColor("Green"), "bonded_green"], ["Rescued, bonded the Orange", g.rescued_orange, dragonColor("Orange"), "rescued_orange"], ["Rescued, bonded the Brown", g.rescued_brown, dragonColor("Brown"), "rescued_brown"], ["Incinerated", g.incinerated, cssVar("--faint"), "incinerated"], ["No outcome recorded", g.no_outcome, cssVar("--line"), "no_outcome"]];
|
||||||
|
const tot = g.green_encounters || 1;
|
||||||
|
$("#green-rescue").innerHTML = `<p class="small muted">${g.green_encounters} tree runs that met the two Greens (climbing down slowly, or quickly and letting the Red pass). A wrong answer sometimes brings an Orange or Brown swooping in to bond you instead.</p>
|
||||||
|
<div style="display:flex;height:16px;border-radius:3px;overflow:hidden;border:1px solid var(--line)">${parts.map(([, n, c]) => `<span style="width:${(100 * n) / tot}%;background:${c}"></span>`).join("")}</div>
|
||||||
|
<div class="tbl-wrap"><table><tbody>${parts.map(([l, n, c, key]) => { const w = g.rates[key]; return `<tr><td><span style="display:inline-block;width:10px;height:10px;border-radius:2px;background:${c};margin-right:6px"></span>${l}</td><td class="num">${n}</td><td class="num">${pct(w.p)}</td><td class="num">${ci(w)}</td></tr>`; }).join("")}</tbody></table></div>`;
|
||||||
|
// "Unsure" / blank first sightings are missing information, not a colour: left out of the table and its totals
|
||||||
|
const cols = ["Red", "Orange", "Brown", "Green"];
|
||||||
|
const POOL = { "Alone|East": ["Red", "Orange"], "Alone|West": ["Red", "Brown", "Green"], "Alone|Center": ["Red", "Brown"], "1 Squadmate|East": ["Green", "Orange", "Red"], "1 Squadmate|West": ["Red", "Brown", "Green"], "1 Squadmate|Center": ["Red", "Brown"], "2 Squadmates|East": ["Red", "Orange"], "2 Squadmates|West": ["Green", "Brown", "Red"], "2 Squadmates|Center": ["Red", "Brown"] };
|
||||||
|
$("#tbl-first").innerHTML = `<table><thead><tr><th>Company · direction</th>${cols.map((c) => `<th class="num">${c}</th>`).join("")}<th class="num">Runs</th></tr></thead><tbody>${r.first_sighting.map((x) => ({ ...x, n: cols.reduce((t, c) => t + (x.colors[c] || 0), 0), gap: (x.colors.Unsure || 0) + (x.colors.Unknown || 0) })).filter((x) => x.n >= 3).map((x) => `<tr><td>${esc(x.key.replace("|", " · "))}</td>${cols.map((c) => { const n = x.colors[c] || 0; const off = n && POOL[x.key] && !POOL[x.key].includes(c); return `<td class="num" style="${off ? "color:var(--warn);font-weight:600" : n ? "" : "color:var(--faint)"}" title="${off ? "Outside the documented pool" : ""}">${n ? `${n}<span class="muted"> · ${pct(n / x.n, 0)}</span>` : "·"}</td>`; }).join("")}<td class="num">${x.n}${x.gap ? `<span class="muted" title="Riders who were not sure which dragon they saw, left out"> +${x.gap} unsure</span>` : ""}</td></tr>`).join("")}</tbody></table>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ route table
|
||||||
|
function renderRouteTable() {
|
||||||
|
const sel = $("#rt-target");
|
||||||
|
if (!sel.options.length) {
|
||||||
|
sel.innerHTML = Object.entries(META().targets).map(([k, t]) => `<option value="${k}">${esc(t.label)}</option>`).join("");
|
||||||
|
sel.value = state.rtTarget;
|
||||||
|
sel.addEventListener("change", () => { state.rtTarget = sel.value; renderRouteTable(); });
|
||||||
|
$("#rt-min").addEventListener("change", (e) => { state.rtMin = +e.target.value; renderRouteTable(); renderFindings(); });
|
||||||
|
}
|
||||||
|
const rk = routesAt(state.rtTarget, state.rtMin);
|
||||||
|
const sig = rk.rows.filter((x) => x.mh_q < 0.05 && x.mh_or > 1).length;
|
||||||
|
$("#rt-note").innerHTML = `${rk.n_routes_tested} routes tested · comparison group ${rateTxt(rk.overall)} · <b>${sig}</b> clearly better after adjustment`;
|
||||||
|
const bar = (w) => `<span class="cibar" aria-hidden="true"><i style="left:${w.lo * 90}px;width:${Math.max(1, (w.hi - w.lo) * 90)}px"></i><b style="left:${w.p * 90 - 1}px"></b></span>`;
|
||||||
|
$("#tbl-routes").innerHTML = rk.rows.length ? `<table><thead><tr><th>#</th><th>Route (choices up to the hour)</th><th class="num">Runs</th><th class="num">Hits</th><th class="num">Rate</th><th class="num">95% CI</th><th></th><th class="num">Crude OR</th><th class="num">q</th><th class="num">Adj. OR</th><th class="num">Adj. q</th></tr></thead><tbody>
|
||||||
|
${rk.rows.map((r, i) => `<tr class="${r.mh_q < 0.05 && r.mh_or > 1 ? "sig" : ""}${r.n < 20 ? " thin" : ""}"><td class="num">${i + 1}</td><td class="route-cell">${esc(r.route)}</td><td class="num">${r.n}</td><td class="num">${r.k}</td><td class="num">${pct(r.p)}</td><td class="num">${ci(r)}</td><td>${bar(r)}</td><td class="num">${fmtOR(r.or)}</td><td class="num">${fmtP(r.q)}</td><td class="num">${fmtOR(r.mh_or)}</td><td class="num">${fmtP(r.mh_q)}</td></tr>`).join("")}
|
||||||
|
</tbody></table>` : `<p class="small muted" style="padding:12px">No routes reach the minimum. Lower it.</p>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ factor explorer
|
||||||
|
function renderFactors() {
|
||||||
|
const so = $("#fx-outcome"), sf = $("#fx-factor");
|
||||||
|
if (!so.options.length) {
|
||||||
|
so.innerHTML = Object.entries(META().outcomes).map(([k, o]) => `<option value="${k}">${esc(o.label)}</option>`).join("");
|
||||||
|
sf.innerHTML = META().factors.map((f) => `<option value="${f}">${esc(labelFactor(f))}</option>`).join("");
|
||||||
|
so.value = state.fxOutcome; sf.value = state.fxFactor;
|
||||||
|
so.addEventListener("change", () => { state.fxOutcome = so.value; renderFactors(); });
|
||||||
|
sf.addEventListener("change", () => { state.fxFactor = sf.value; renderFactors(); });
|
||||||
|
}
|
||||||
|
const ft = state.res.factors[state.fxOutcome];
|
||||||
|
const rows = ft.rows.filter((r) => r.factor === state.fxFactor);
|
||||||
|
$("#tbl-factors").innerHTML = `<table><thead><tr><th>${esc(labelFactor(state.fxFactor))}</th><th class="num">Hits/runs</th><th class="num">Rate</th><th class="num">95% CI</th><th class="num">OR vs rest</th><th class="num">p</th><th class="num">q</th></tr></thead><tbody>
|
||||||
|
<tr><td><i>All</i></td><td class="num">${kn(ft.overall)}</td><td class="num">${pct(ft.overall.p)}</td><td class="num">${ci(ft.overall)}</td><td></td><td></td><td></td></tr>
|
||||||
|
${rows.map((r) => `<tr class="${r.q < 0.05 ? "sig" : ""}${r.or === undefined ? " thin" : ""}"><td>${esc(r.level)}</td><td class="num">${kn(r)}</td><td class="num">${pct(r.p)}</td><td class="num">${ci(r)}</td><td class="num">${r.or !== undefined ? `${fmtOR(r.or)} <span class="muted">(${fmtOR(r.or_lo)}–${fmtOR(r.or_hi)})</span>` : "too few"}</td><td class="num">${fmtP(r.fisher_p)}</td><td class="num">${r.q !== undefined ? `<span class="qbadge${r.q < 0.05 ? " s" : ""}">${fmtP(r.q)}</span>` : ""}</td></tr>`).join("")}
|
||||||
|
</tbody></table>${ft.missing && ft.missing[state.fxFactor] ? `<p class="small muted">${ft.missing[state.fxFactor].toLocaleString()} runs with no usable answer to this question ("unsure", blank, or not asked on that version of the form) are left out of these comparisons rather than treated as a choice.</p>` : ""}`;
|
||||||
|
forest($("#ch-factor"), rows.filter((r) => r.or !== undefined).map((r) => ({ label: r.level, or: r.or, lo: r.or_lo, hi: r.or_hi, q: r.q, p: undefined, n: r.n })), { labelW: 220 });
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ quality
|
||||||
|
function renderQuality() {
|
||||||
|
const r = state.res, m = r.meta;
|
||||||
|
const flags = Object.entries(m.flag_counts).sort((a, b) => b[1] - a[1]);
|
||||||
|
const outs = Object.entries(m.outcomes).sort((a, b) => b[1] - a[1]);
|
||||||
|
$("#quality-panels").innerHTML = `
|
||||||
|
<div class="panel"><h3>Who logged the runs</h3><div class="tbl-wrap"><table><thead><tr><th>Source</th><th class="num">Runs</th><th class="num">Blue in meadow</th><th class="num">Shadow at tree</th></tr></thead><tbody>
|
||||||
|
${Object.entries(m.sources).sort((a, b) => b[1] - a[1]).map(([s, n]) => { const b = sourceRate("blue_meadow", s), t = sourceRate("shadow", s); return `<tr><td>${esc(s)}</td><td class="num">${n}</td><td class="num">${pct(b.p)} <span class="muted">${kn(b)}</span></td><td class="num">${pct(t.p)} <span class="muted">${kn(t)}</span></td></tr>`; }).join("")}
|
||||||
|
</tbody></table></div><p class="small">Bulk logs come from players who recorded every run, so they are the least selective rows. Their rare-dragon rates are several times lower than the form's, which is the strongest sign of reporting bias in this data.</p></div>
|
||||||
|
<div class="panel"><h3>Rows flagged for contradictions</h3><p class="small muted">${m.n_flagged} of ${r.n} rows (${pct(m.n_flagged / r.n)}). Flagged rows stay in unless you pick "Rows without data-quality flags" above.</p><div class="tbl-wrap"><table><tbody>${flags.map(([f, n]) => `<tr><td>${esc(f)}</td><td class="num">${n}</td></tr>`).join("") || `<tr><td>None</td></tr>`}</tbody></table></div></div>
|
||||||
|
<div class="panel"><h3>How runs ended</h3><div class="tbl-wrap"><table><tbody>${outs.map(([f, n]) => `<tr><td>${esc(f)}</td><td class="num">${n}</td><td class="num">${pct(n / r.n)}</td></tr>`).join("")}</tbody></table></div><p class="small muted">"No outcome recorded" rows reached the hour but the form shows no Bonded or Incinerated. They count toward reaching a branch but not toward bond rates.</p></div>
|
||||||
|
${state.overlap && state.overlap.comparable ? `<div class="panel"><h3>The same run reported twice?</h3><p class="small">A rider may log a run in the form and post it in a megathread comment too. With no player IDs, a copy can only be measured, not proven, so nothing is removed. Of ${state.overlap.comparable} Reddit runs detailed enough to compare, ${state.overlap.matched} give the same answers as a form row sent within ${state.overlap.rule.window_days} day; chance alone (the same test a few weeks off) gives about ${state.overlap.expected_by_chance}. So about ${Math.round(state.overlap.likely_double)} of ${state.overlap.comment_runs} Reddit runs look reported twice${state.overlap.likely_double < 0.1 * state.overlap.comment_runs ? ", too few to matter" : ""}.</p></div>` : ""}
|
||||||
|
<div class="panel"><h3>Independence</h3><p class="small">The form has no player ID. One player's 50 runs count as 50 independent runs, so intervals are somewhat narrower than they should be. ${pct(Object.entries(m.sources).filter(([k]) => !["Form", "Reddit comments", "DragonKind bot", "Reported on the Atlas"].includes(k)).reduce((s, [, n]) => s + n, 0) / r.n, 0)} of rows arrived as bulk imports, each probably one player's or one group's log.</p></div>
|
||||||
|
<div class="panel"><h3>What the form does not ask</h3><p class="small">The redesigned form asks how you reacted to the first dragon (answered in ${r.factors.reach_hour.rows.filter((x) => x.factor === "sighting_action" && !["Unknown", "(not asked)"].includes(x.level)).reduce((a, x) => a + x.n, 0)} rows; most riders answer "Unsure") and how the bully fight went (${r.factors.reach_hour.rows.filter((x) => x.factor === "combat_first" && x.level !== "(not recorded)").reduce((a, x) => a + x.n, 0)} rows). It still does not record most choices inside the bonding encounters. Theories that rely on those choices cannot be confirmed or refuted here.</p></div>`;
|
||||||
|
}
|
||||||
|
const sourceRate = (outKey, source) => state.res.source_rates[outKey][source];
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ share
|
||||||
|
function redditPost() {
|
||||||
|
const r = state.res, cb = r.chance.blue_meadow, cs = r.chance.shadow;
|
||||||
|
const bulkB = stratumRate(cb, "Bulk"), chaseB = stratumRate(cb, "Form: chasing Blue"), bulkS = stratumRate(cs, "Bulk");
|
||||||
|
const encB = r.encounters.find((e) => e.context === "Blue (meadow)"), encK = r.encounters.find((e) => e.context === "Black (shadow)");
|
||||||
|
const mb = r.models.blue_meadow;
|
||||||
|
const sigRoute = mb ? mb.terms.filter((t) => ROUTE_FACTORS.includes(t.factor) && t.p < 0.05 && !NOT_A_CHOICE.test(t.level)) : [];
|
||||||
|
const rk = routesAt("see_Blue", state.rtMin);
|
||||||
|
const adjSig = rk.rows.filter((x) => x.mh_q < 0.05 && x.mh_or > 1).length;
|
||||||
|
const leads = r.factors.shadow.rows.filter((x) => ["post_path", "attempt_group"].includes(x.factor) && x.q < 0.05 && x.or > 1 && !NOT_A_CHOICE.test(x.level));
|
||||||
|
const L = [];
|
||||||
|
L.push(`# I ran the numbers on ${r.n.toLocaleString()} logged threshing runs. Here's what holds up (and what doesn't)`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`*Per the megathread rules, anything that names a specific route is behind spoiler tags.*`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`Data: the community Threshing Routes form/spreadsheet (thanks u/ClumsyBadger, u/Old_Regular3018, u/Smart_Trifle_2099 and everyone who logged runs). ${Object.entries(r.meta.sources).map(([k, v]) => `${v} ${k === "Form" ? "form submissions" : k}`).join(", ")}; form dates ${r.meta.date_min} to ${r.meta.date_max}. Every rate below has a 95% confidence interval.`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`**TL;DR**`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`* **The meadow Blue shows up a lot less than the spreadsheet suggests.** Runs logged by Blue-chasers show it ${pct(chaseB && chaseB.p)} of the time, but bulk logs (people who recorded *every* run) show ${bulkB ? `${pct(bulkB.p)} (${kn(bulkB)})` : "n/a"}. The game can't know what you're chasing, so that gap is reporting bias. Expect something closer to the bulk-log number.`);
|
||||||
|
L.push(`* **${sigRoute.length ? "Only these route choices mattered for the Blue appearing" : "No recorded route choice changed the Blue's odds"}** once you account for that bias${sigRoute.length ? `: ${sigRoute.map((s) => s.term).join("; ")}` : ""} (direction, first dragon, how you handled the cadet, company). ${adjSig} of ${rk.n_routes_tested} full routes beat the rest after correcting for multiple testing. The "precise pathways" might still matter through choices the form doesn't record (like how you react to the first dragon), but the form can't confirm them.`);
|
||||||
|
L.push(`* **Getting the Blue to show up is only half of it.** Only ${encB ? `${pct(encB.overall.p)} (${kn(encB.overall)})` : "n/a"} of Blue attempts bonded, which matches the PDF's step-by-step numbers (~25%). Dying with the "right" answer is normal.`);
|
||||||
|
L.push(`* **The tree shadow (→ Black) is rarer than the spreadsheet suggests.** All rows: ${pct(cs.overall.p)} (${kn(cs.overall)}), but bulk logs show ${bulkS ? `${kn(bulkS)} (upper 95% bound ${pct(bulkS.hi)})` : "n/a"}. ${bulkS && bulkS.n ? `Plan on roughly 1 in ${Math.round(1 / Math.max(bulkS.hi, 0.001) / 10) * 10} climbs at best.` : ""} Once you get the Black, it bonds ${encK ? `${pct(encK.overall.p)} (${kn(encK.overall)})` : "n/a"} of the time.`);
|
||||||
|
if (leads.length) L.push(`* **Leads worth testing (not proven):** >!${leads.map((x) => `${labelFactor(x.factor)} = ${x.level}: shadow in ${pct(x.p)} (${kn(x)}) vs the rest`).join("; ")}!<. If you bulk-log your tree climbs *including the boring ones*, we can settle this.`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`**How to help:** log every run in the form, including the ones where nothing rare happened. Those dull runs are what make the rates trustworthy.`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`Interactive route map, full methods, and code to reproduce every number: [Threshing Route Atlas](LINK)`);
|
||||||
|
L.push("");
|
||||||
|
L.push(`*Caveats: self-reported data, no player IDs (so runs from one person aren't independent), and the form doesn't record every in-game choice. The game's author has said no single roll is worse than 1 in 20 and that the Black is not luck, but no route guarantees a bond.*`);
|
||||||
|
return L.join("\n");
|
||||||
|
}
|
||||||
|
$("#cp-reddit").addEventListener("click", () => copyText(redditPost(), "Reddit post"));
|
||||||
|
$("#cp-json").addEventListener("click", () => copyText(JSON.stringify(state.res, null, 1), "results JSON"));
|
||||||
|
$$("button[data-src]").forEach((b) => b.addEventListener("click", async () => {
|
||||||
|
const pre = $("#srcview");
|
||||||
|
try { const t = await (await fetch(b.dataset.src)).text(); pre.textContent = t; pre.hidden = false; pre.scrollTop = 0; }
|
||||||
|
catch (e) { pre.textContent = "Could not load " + b.dataset.src; pre.hidden = false; }
|
||||||
|
}));
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ controls
|
||||||
|
$$("#width-mode button").forEach((b) => b.addEventListener("click", () => {
|
||||||
|
state.widthMode = b.dataset.v;
|
||||||
|
$$("#width-mode button").forEach((x) => x.setAttribute("aria-pressed", x === b));
|
||||||
|
renderMap();
|
||||||
|
}));
|
||||||
|
$("#minn").addEventListener("change", (e) => { state.minN = +e.target.value; renderMap(); if ($("#best-routes").innerHTML) renderBestRoutes(); });
|
||||||
|
$("#f-preset").addEventListener("change", (e) => { state.preset = e.target.value; recompute(); });
|
||||||
|
$("#btn-best").addEventListener("click", renderBestRoutes);
|
||||||
|
|
||||||
|
function renderAll() {
|
||||||
|
renderStatus(); renderFindings(); renderTargets(); renderMap(); renderRare(); renderDragons(); renderRouteTable(); renderFactors(); renderQuality();
|
||||||
|
if ($("#best-routes").innerHTML) renderBestRoutes();
|
||||||
|
if (window.AtlasUI) window.AtlasUI.render(state);
|
||||||
|
}
|
||||||
|
// re-colour when the theme changes
|
||||||
|
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
|
const rerender = () => state.res && renderAll();
|
||||||
|
mq.addEventListener && mq.addEventListener("change", rerender);
|
||||||
|
new MutationObserver(rerender).observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
|
||||||
|
let rz; window.addEventListener("resize", () => { clearTimeout(rz); rz = setTimeout(() => state.res && renderMap(), 200); });
|
||||||
|
|
||||||
|
window.ThreshAtlas = { state, redditPost };
|
||||||
|
if (window.DragonRegister) window.DragonRegister.mount({ copy: copyText, toast });
|
||||||
|
loadStats().catch((e) => { $("#data-status").innerHTML = `<span class="pill warn">The statistics (data/stats.json) could not load: ${esc(e.message)}.</span>`; console.error(e); });
|
||||||
|
})();
|
||||||
+148
@@ -0,0 +1,148 @@
|
|||||||
|
{
|
||||||
|
"schema": 1,
|
||||||
|
"by_attempt": {
|
||||||
|
"form": {
|
||||||
|
"1": [
|
||||||
|
97,
|
||||||
|
960
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
0,
|
||||||
|
299
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
0,
|
||||||
|
196
|
||||||
|
],
|
||||||
|
"4-10": [
|
||||||
|
0,
|
||||||
|
555
|
||||||
|
],
|
||||||
|
"11-30": [
|
||||||
|
0,
|
||||||
|
657
|
||||||
|
],
|
||||||
|
"31 or more": [
|
||||||
|
0,
|
||||||
|
715
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bulk logs": {
|
||||||
|
"1": [
|
||||||
|
0,
|
||||||
|
29
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
0,
|
||||||
|
21
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
0,
|
||||||
|
14
|
||||||
|
],
|
||||||
|
"4-10": [
|
||||||
|
0,
|
||||||
|
102
|
||||||
|
],
|
||||||
|
"11-30": [
|
||||||
|
0,
|
||||||
|
57
|
||||||
|
],
|
||||||
|
"31 or more": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bot": {
|
||||||
|
"1": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
0,
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
0,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"4-10": [
|
||||||
|
0,
|
||||||
|
36
|
||||||
|
],
|
||||||
|
"11-30": [
|
||||||
|
0,
|
||||||
|
137
|
||||||
|
],
|
||||||
|
"31 or more": [
|
||||||
|
0,
|
||||||
|
333
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"same_route": {
|
||||||
|
"routes": 326,
|
||||||
|
"first_shadows": 93,
|
||||||
|
"expected": 38.8,
|
||||||
|
"odds_ratio": null,
|
||||||
|
"z": 12.5
|
||||||
|
},
|
||||||
|
"form_first": [
|
||||||
|
97,
|
||||||
|
960
|
||||||
|
],
|
||||||
|
"form_later": [
|
||||||
|
0,
|
||||||
|
2422
|
||||||
|
],
|
||||||
|
"best_route": {
|
||||||
|
"route": [
|
||||||
|
"Alone",
|
||||||
|
"West",
|
||||||
|
"Assess the situation",
|
||||||
|
"Engage the smaller cadet",
|
||||||
|
"Squadmate's revenge",
|
||||||
|
"West"
|
||||||
|
],
|
||||||
|
"first": [
|
||||||
|
23,
|
||||||
|
114
|
||||||
|
],
|
||||||
|
"later": [
|
||||||
|
0,
|
||||||
|
106
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"shadow_routes": {
|
||||||
|
"runs": 97,
|
||||||
|
"routes": 47,
|
||||||
|
"off_gate": 3,
|
||||||
|
"gates_unstated": 14
|
||||||
|
},
|
||||||
|
"after_shadow": {
|
||||||
|
"reached_black": 89,
|
||||||
|
"bonded_black": 65,
|
||||||
|
"died_at_blue": 19,
|
||||||
|
"answers": {
|
||||||
|
"held its gaze": [
|
||||||
|
29,
|
||||||
|
41
|
||||||
|
],
|
||||||
|
"lowered eyes": [
|
||||||
|
0,
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"ignored the sound": [
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bot": {
|
||||||
|
"attempts": 878,
|
||||||
|
"accounts": 27,
|
||||||
|
"gated_tree": 515,
|
||||||
|
"shadows": 0,
|
||||||
|
"earliest_attempt": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,803 @@
|
|||||||
|
{
|
||||||
|
"@context": {
|
||||||
|
"@language": "en",
|
||||||
|
"@vocab": "https://schema.org/",
|
||||||
|
"citeAs": "cr:citeAs",
|
||||||
|
"column": "cr:column",
|
||||||
|
"conformsTo": "dct:conformsTo",
|
||||||
|
"cr": "http://mlcommons.org/croissant/",
|
||||||
|
"data": {
|
||||||
|
"@id": "cr:data",
|
||||||
|
"@type": "@json"
|
||||||
|
},
|
||||||
|
"dataType": {
|
||||||
|
"@id": "cr:dataType",
|
||||||
|
"@type": "@vocab"
|
||||||
|
},
|
||||||
|
"dct": "http://purl.org/dc/terms/",
|
||||||
|
"examples": {
|
||||||
|
"@id": "cr:examples",
|
||||||
|
"@type": "@json"
|
||||||
|
},
|
||||||
|
"extract": "cr:extract",
|
||||||
|
"field": "cr:field",
|
||||||
|
"fileObject": "cr:fileObject",
|
||||||
|
"fileProperty": "cr:fileProperty",
|
||||||
|
"format": "cr:format",
|
||||||
|
"includes": "cr:includes",
|
||||||
|
"isLiveDataset": "cr:isLiveDataset",
|
||||||
|
"jsonPath": "cr:jsonPath",
|
||||||
|
"key": "cr:key",
|
||||||
|
"md5": "cr:md5",
|
||||||
|
"parentField": "cr:parentField",
|
||||||
|
"path": "cr:path",
|
||||||
|
"recordSet": "cr:recordSet",
|
||||||
|
"references": "cr:references",
|
||||||
|
"regex": "cr:regex",
|
||||||
|
"repeated": "cr:repeated",
|
||||||
|
"replace": "cr:replace",
|
||||||
|
"sc": "https://schema.org/",
|
||||||
|
"separator": "cr:separator",
|
||||||
|
"source": "cr:source",
|
||||||
|
"subField": "cr:subField",
|
||||||
|
"transform": "cr:transform"
|
||||||
|
},
|
||||||
|
"@type": "sc:Dataset",
|
||||||
|
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
||||||
|
"name": "Threshing Atlas",
|
||||||
|
"description": "Community-logged runs of the Dragonkind \"threshing\" (the dragon-bonding game based on Fourth Wing), coded into one record per run: every choice, what the game rolled, and how the run ended. Also the route model built from them, the statistics shown on the Threshing Atlas page, and the route graph shared with a DragonKind bot.",
|
||||||
|
"url": "https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
|
"sameAs": "https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
|
"license": "https://creativecommons.org/licenses/by/4.0/",
|
||||||
|
"creator": {
|
||||||
|
"@type": "sc:Person",
|
||||||
|
"name": "ekcSchiano"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Dragonkind",
|
||||||
|
"Fourth Wing",
|
||||||
|
"threshing",
|
||||||
|
"decision tree",
|
||||||
|
"route planning",
|
||||||
|
"community data"
|
||||||
|
],
|
||||||
|
"citeAs": "ekcSchiano and contributors (2026). Threshing Atlas. https://git.kenschiano.net/DragonKind/threshing-atlas",
|
||||||
|
"isLiveDataset": true,
|
||||||
|
"isBasedOn": [
|
||||||
|
{
|
||||||
|
"@type": "sc:CreativeWork",
|
||||||
|
"url": "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0",
|
||||||
|
"name": "Threshing Routes form and spreadsheet (u/ClumsyBadger, linked from the r/fourthwing megathreads)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "sc:CreativeWork",
|
||||||
|
"url": "https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ",
|
||||||
|
"name": "Unofficial Dragon Register (which dragon each rider bonded)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "sc:CreativeWork",
|
||||||
|
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/",
|
||||||
|
"name": "Runs posted in the r/fourthwing Dragonkind megathreads (part 3)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "sc:CreativeWork",
|
||||||
|
"url": "https://www.reddit.com/r/fourthwing/comments/1wz5cnj/",
|
||||||
|
"name": "Runs posted in the r/fourthwing Dragonkind megathreads (part 4)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "sc:CreativeWork",
|
||||||
|
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/",
|
||||||
|
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments (part 3)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "sc:CreativeWork",
|
||||||
|
"url": "https://www.reddit.com/r/fourthwing/comments/1wz5cnj/",
|
||||||
|
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments (part 4)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"distribution": [
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "runs_clean",
|
||||||
|
"name": "runs_clean",
|
||||||
|
"description": "Every run from every source, one per row, coded into the same columns (collection/etl/runs.py; the form's rules are core/spec/form.yaml). The `source` column says where each run came from.",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/runs_clean.csv",
|
||||||
|
"encodingFormat": "text/csv",
|
||||||
|
"sha256": "24321aa853d696b4a06226e28bac5e7843759dc3393721ef020d7f5c6beadf4e",
|
||||||
|
"contentSize": "3828261 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "form_responses",
|
||||||
|
"name": "form_responses",
|
||||||
|
"description": "The community \"Threshing Routes\" form export as published (headers and rows), with email addresses in free-text answers redacted. The source of runs_clean.",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/form_responses.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "8067ac944db2833e6a1203dc6464ed208d60dea4e617ee9b28fc56f285445d2e",
|
||||||
|
"contentSize": "12786245 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "reddit_comments",
|
||||||
|
"name": "reddit_comments",
|
||||||
|
"description": "Runs described in the r/fourthwing megathread comments, read into the \"Report a run\" answers: comment id, day and answers only, no usernames or comment text.",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/reddit_comments.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "b169d157e731db23c99f2f8317a9718d31801b7d64336b3d414511ac13f32493",
|
||||||
|
"contentSize": "23174 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "overlap",
|
||||||
|
"name": "overlap",
|
||||||
|
"description": "How many Reddit comment runs may also be in the community form (the same answers within a day), against what chance alone gives (analysis/overlap/overlap.py). Measured only: no run is removed.",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/overlap.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "e7511cccf9e8379d8e892639cb38772269ac228756b984e9e0d4d8e9a583a9dd",
|
||||||
|
"contentSize": "2544 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "reports",
|
||||||
|
"name": "reports",
|
||||||
|
"description": "Runs reported through the Atlas's \"Report a run\" form (issues on its repository), answers only, no usernames.",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/reports.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "51510ed7a0b4016501fe4e0324a352842e831a48773a08b084dec6ff7dde2d14",
|
||||||
|
"contentSize": "112 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "register",
|
||||||
|
"name": "register",
|
||||||
|
"description": "The Unofficial Dragon Register (which dragon each rider bonded), without rider names.",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/register.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "40b725a39dff447025de5dda0eb6850e0929764ab53549863f2efc5d9414731b",
|
||||||
|
"contentSize": "118558 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "stats",
|
||||||
|
"name": "stats",
|
||||||
|
"description": "Every number the Atlas page shows, for six filter presets (analysis/stats/site_stats.py; what is measured is analysis/stats/measures.yaml).",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/stats.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "7431173d9b667d4914d17bbc299d994d14c3104e3e89a1eb75d690c1b21ade6a",
|
||||||
|
"contentSize": "5110214 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "policy",
|
||||||
|
"name": "policy",
|
||||||
|
"description": "The route model: the game (core/spec/game.yaml), the count tables behind every roll, and the best decision tree for every dragon colour under two goals, with posterior intervals (planner/build_policy.py).",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/policy.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "eec67140c63f028d31553be4f2310d92c9378293488aecd73a41ba1700b9e646",
|
||||||
|
"contentSize": "987412 B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:FileObject",
|
||||||
|
"@id": "graph",
|
||||||
|
"name": "graph",
|
||||||
|
"description": "The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).",
|
||||||
|
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/graph.json",
|
||||||
|
"encodingFormat": "application/json",
|
||||||
|
"sha256": "f9d1a86f84fcc10ef906af686ce624355ffd729440460288406ba97177ff05da",
|
||||||
|
"contentSize": "84575 B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"recordSet": [
|
||||||
|
{
|
||||||
|
"@type": "cr:RecordSet",
|
||||||
|
"@id": "runs",
|
||||||
|
"name": "runs",
|
||||||
|
"description": "One coded threshing run per row, from every source (data/public/runs_clean.csv).",
|
||||||
|
"key": {
|
||||||
|
"@id": "runs/run_id"
|
||||||
|
},
|
||||||
|
"field": [
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/run_id",
|
||||||
|
"name": "run_id",
|
||||||
|
"description": "Unique id of the run, stable when rows are deleted or re-sorted: sheet-<hash of the form row's answers and timestamp>, register-<hash of the register row>, thread-<result id>, comment-<Reddit comment id>, reported-<issue number> or bot-<hash>.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "run_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/source",
|
||||||
|
"name": "source",
|
||||||
|
"description": "Where the run came from. \"reddit spreadsheet\": the community Threshing Routes form and spreadsheet linked from the r/fourthwing megathreads. \"reddit thread\": a dragonkind.com result page posted in a megathread (bonded, route not recorded). \"reddit comment\": a run a rider described in a megathread comment, read automatically into the \"Report a run\" answers by the threshing-reddit scraper, which delivers them by pull request (hand corrections in collection/manual/reddit_comments.yaml). \"reported\": the Atlas's own \"Report a run\" form. \"bot\": an attempt logged by the DragonKind bot. \"register\": a bonded dragon entered in the community's Unofficial Dragon Register (outcome only, no route; the same run may also be in the spreadsheet). \"reddit pdf\": the community route PDF (a flowchart of the routes, not a log of runs, so it adds no rows today). Values: reddit spreadsheet; reddit thread; reddit comment; register; reported; bot; reddit pdf.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "source"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/entry",
|
||||||
|
"name": "entry",
|
||||||
|
"description": "For spreadsheet runs, the sheet's own row label: \"Form\" for a form submission (it has a timestamp); bulk-pasted logs keep the label they were pasted with. Bulk logs record every run of the players who kept them, so they are the least selectively reported rows. Empty for other sources. Values: Form; Data Import; BulkUpload3; Manual Upload; Historical import; Unknown import; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "entry"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/bot_mode",
|
||||||
|
"name": "bot_mode",
|
||||||
|
"description": "For bot runs, how the bot chose: \"auto_learn\" (its own rules and the route PDF), \"atlas_policy\" (the Atlas's route model), \"atlas_thompson\" (the route model, sampling routes in proportion to how likely each is best), \"explore\" (trying untested options), \"experiment\" (a randomised test), \"manual\" (a person clicked). Matters for analysis: the bot follows a strategy, so its choices are not like a player's. Empty for other sources. Values: auto_learn; atlas_policy; atlas_thompson; explore; experiment; manual.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "bot_mode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/date",
|
||||||
|
"name": "date",
|
||||||
|
"description": "Date of the run or its report (YYYY-MM-DD): the form submission, the issue, or the bot attempt. Empty for bulk-pasted rows and result pages.",
|
||||||
|
"dataType": "sc:Date",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/wing",
|
||||||
|
"name": "wing",
|
||||||
|
"description": "The rider's wing Values: First; Second; Third; Fourth; Multiple; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "wing"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/section",
|
||||||
|
"name": "section",
|
||||||
|
"description": "The rider's section within the wing (free text as answered).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "section"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/squad",
|
||||||
|
"name": "squad",
|
||||||
|
"description": "The rider's squad. Values: First; Second; Third; Don't know; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "squad"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/attempt",
|
||||||
|
"name": "attempt",
|
||||||
|
"description": "Which attempt this was for the account (1 = first). Empty if not given.",
|
||||||
|
"dataType": "sc:Integer",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "attempt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/attempt_group",
|
||||||
|
"name": "attempt_group",
|
||||||
|
"description": "First attempt or a later one (\"I've lost count\" counts as later). Values: First attempt; Later attempt; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "attempt_group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/goal",
|
||||||
|
"name": "goal",
|
||||||
|
"description": "Which dragon the rider was trying to bond (older form) or why they did the run (redesigned form). Values: Red; Green; Orange; Brown; Blue; Black; Blue or Black; Red (tree); Any (for fun); Daily run data; (not asked/blank).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "goal"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/company",
|
||||||
|
"name": "company",
|
||||||
|
"description": "Who entered the valley with the rider. Values: Alone; 1 Squadmate; 2 Squadmates; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "company"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/left_squadmates",
|
||||||
|
"name": "left_squadmates",
|
||||||
|
"description": "Whether a rider who entered with squadmates later left them. Only asked from 2026-10-27: earlier and undated squad runs are empty (unknown).",
|
||||||
|
"dataType": "sc:Boolean",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "left_squadmates"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/direction",
|
||||||
|
"name": "direction",
|
||||||
|
"description": "First direction. Values: East; West; Center; Multiple; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "direction"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/first_sighting",
|
||||||
|
"name": "first_sighting",
|
||||||
|
"description": "The first dragon that found the rider (a roll of the game). Values: Red; Brown; Green; Orange; Unsure; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "first_sighting"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/sighting_action",
|
||||||
|
"name": "sighting_action",
|
||||||
|
"description": "How the rider reacted to the first dragon (redesigned form only). Values: Hold still; Respect / face it; Retreat / run; Hide; Weapon; Meet its gaze; Protect squadmate; Approach; Stand alone; Unknown; (not asked).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "sighting_action"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/scream",
|
||||||
|
"name": "scream",
|
||||||
|
"description": "What the rider did about the scream, or that they died before it. Values: Investigate & help; Investigate & leave; Ignore the scream; DIED at first sighting; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "scream"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/resolution",
|
||||||
|
"name": "resolution",
|
||||||
|
"description": "How the cadet encounter ended. Values: Killed the bullies yourself; Squadmate's revenge; Left bullies to the dragons; Tourniquet; Left injured cadet; Took their weapons; Left them to it; DIED in combat; DIED at first sighting; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "resolution"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/combat_first",
|
||||||
|
"name": "combat_first",
|
||||||
|
"description": "The rider's first move in the bully fight. Values: Assess the situation; Even the numbers (smaller cadet); Put yourself in the middle (bigger cadet); (not recorded).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "combat_first"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/combat_second",
|
||||||
|
"name": "combat_second",
|
||||||
|
"description": "After assessing Values: Engage the smaller cadet; Daggers or not (protect squadmate); (not recorded).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "combat_second"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/post_path",
|
||||||
|
"name": "post_path",
|
||||||
|
"description": "The fork after the bully fight (only that path has one). Values: Forest; West; East; (no fork); Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "post_path"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/hour",
|
||||||
|
"name": "hour",
|
||||||
|
"description": "After an hour's walk Values: Tree; Valley; DIED before the hour; Unknown.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "hour"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/branch",
|
||||||
|
"name": "branch",
|
||||||
|
"description": "Which bonding encounter the run reached after the hour, worked out from the dragons recorded. Values: Shadow (rare); Descend quickly: Red; Descend quickly: let the Red pass; Descend slowly: two Greens; Valley Red; Passed the Red: meadow.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "branch"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/enc_Red",
|
||||||
|
"name": "enc_Red",
|
||||||
|
"description": "The rider's answer for this dragon in the bonding grid. Values: Bonded!; Incinerated; Changed my mind; Saved by another.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "enc_Red"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/enc_Green",
|
||||||
|
"name": "enc_Green",
|
||||||
|
"description": "The rider's answer for this dragon in the bonding grid. Values: Bonded!; Incinerated; Changed my mind; Saved by another.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "enc_Green"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/enc_Orange",
|
||||||
|
"name": "enc_Orange",
|
||||||
|
"description": "The rider's answer for this dragon in the bonding grid. Values: Bonded!; Incinerated; Changed my mind; Saved by another.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "enc_Orange"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/enc_Brown",
|
||||||
|
"name": "enc_Brown",
|
||||||
|
"description": "The rider's answer for this dragon in the bonding grid. Values: Bonded!; Incinerated; Changed my mind; Saved by another.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "enc_Brown"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/enc_Blue",
|
||||||
|
"name": "enc_Blue",
|
||||||
|
"description": "The rider's answer for this dragon in the bonding grid. Values: Bonded!; Incinerated; Changed my mind; Saved by another.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "enc_Blue"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/enc_Black",
|
||||||
|
"name": "enc_Black",
|
||||||
|
"description": "The rider's answer for this dragon in the bonding grid. Values: Bonded!; Incinerated; Changed my mind; Saved by another.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "enc_Black"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/outcome",
|
||||||
|
"name": "outcome",
|
||||||
|
"description": "How the run ended. Values: Bonded; Incinerated; Died before the hour; No outcome recorded; Ambiguous.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "outcome"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/outcome_color",
|
||||||
|
"name": "outcome_color",
|
||||||
|
"description": "The dragon bonded Values: Red; Green; Orange; Brown; Blue; Black.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "outcome_color"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/rescued",
|
||||||
|
"name": "rescued",
|
||||||
|
"description": "The Greens' encounter ended with an Orange or Brown swooping in and bonding the rider.",
|
||||||
|
"dataType": "sc:Boolean",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "rescued"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/saw_blue_meadow",
|
||||||
|
"name": "saw_blue_meadow",
|
||||||
|
"description": "A Blue waited in the meadow (valley runs).",
|
||||||
|
"dataType": "sc:Boolean",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "saw_blue_meadow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/saw_shadow",
|
||||||
|
"name": "saw_shadow",
|
||||||
|
"description": "The shadow appeared at the tree (tree runs).",
|
||||||
|
"dataType": "sc:Boolean",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "saw_shadow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/rare_reported",
|
||||||
|
"name": "rare_reported",
|
||||||
|
"description": "The rider's own answer to \"did you meet a rare dragon\". Values: No; Blue (valley); Shadow; Unknown; (not asked).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "rare_reported"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/malek_intent",
|
||||||
|
"name": "malek_intent",
|
||||||
|
"description": "Whether the rider would seek Malek (die on purpose) rather than bond a dragon they did not want. Values: Yes; No; Unknown; (not asked).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "malek_intent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/tail",
|
||||||
|
"name": "tail",
|
||||||
|
"description": "The tail of the dragon bonded (redesigned form). Values: Clubtail; Daggertail; Morningstartail; Scorpiontail; Swordtail.",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "tail"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/data_flags",
|
||||||
|
"name": "data_flags",
|
||||||
|
"description": "Inconsistencies found while coding the row",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "data_flags"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/death_note",
|
||||||
|
"name": "death_note",
|
||||||
|
"description": "Free-text note from riders who died (email addresses removed).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "death_note"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "cr:Field",
|
||||||
|
"@id": "runs/bond_note",
|
||||||
|
"name": "bond_note",
|
||||||
|
"description": "Free-text note from riders who bonded (email addresses removed).",
|
||||||
|
"dataType": "sc:Text",
|
||||||
|
"source": {
|
||||||
|
"fileObject": {
|
||||||
|
"@id": "runs_clean"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"column": "bond_note"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
# Data dictionary: every published file and every column of the coded runs.
|
||||||
|
#
|
||||||
|
# collection/etl/metadata.py builds data/croissant.json (Croissant, the MLCommons metadata format) from this
|
||||||
|
# file, collection/pipeline.yaml and the licences. tests/core/test_dictionary.py checks that every column of the coded runs
|
||||||
|
# is described here and that every value it takes is listed.
|
||||||
|
#
|
||||||
|
# Missing answers: "Unknown", "Unsure", "(not asked)" and the other values in core/spec/form.yaml missing_values carry
|
||||||
|
# no information about the choice; every analysis treats them, and empty cells, as missing.
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
dataset:
|
||||||
|
name: Threshing Atlas
|
||||||
|
description: >-
|
||||||
|
Community-logged runs of the Dragonkind "threshing" (the dragon-bonding game based on Fourth Wing), coded into
|
||||||
|
one record per run: every choice, what the game rolled, and how the run ended. Also the route model built from
|
||||||
|
them, the statistics shown on the Threshing Atlas page, and the route graph shared with a DragonKind bot.
|
||||||
|
# the repository, the page and every file's link come from forge.yaml
|
||||||
|
license: https://creativecommons.org/licenses/by/4.0/
|
||||||
|
code_license: MIT
|
||||||
|
creator: ekcSchiano
|
||||||
|
keywords: [Dragonkind, Fourth Wing, threshing, decision tree, route planning, community data]
|
||||||
|
citation: "ekcSchiano and contributors (2026). Threshing Atlas. {repository}"
|
||||||
|
# Third-party sources keep their own terms (DATA_LICENSE.md); the route PDF is never redistributed.
|
||||||
|
|
||||||
|
files:
|
||||||
|
runs_clean:
|
||||||
|
path: data/public/runs_clean.csv
|
||||||
|
format: text/csv
|
||||||
|
description: >-
|
||||||
|
Every run from every source, one per row, coded into the same columns (collection/etl/runs.py; the form's
|
||||||
|
rules are core/spec/form.yaml). The `source` column says where each run came from.
|
||||||
|
form_responses:
|
||||||
|
path: data/public/form_responses.json
|
||||||
|
format: application/json
|
||||||
|
description: >-
|
||||||
|
The community "Threshing Routes" form export as published (headers and rows), with email addresses in
|
||||||
|
free-text answers redacted. The source of runs_clean.
|
||||||
|
reddit_comments:
|
||||||
|
path: data/public/reddit_comments.json
|
||||||
|
format: application/json
|
||||||
|
description: >-
|
||||||
|
Runs described in the r/fourthwing megathread comments, read into the "Report a run" answers: comment id, day
|
||||||
|
and answers only, no usernames or comment text.
|
||||||
|
overlap:
|
||||||
|
path: data/public/overlap.json
|
||||||
|
format: application/json
|
||||||
|
description: >-
|
||||||
|
How many Reddit comment runs may also be in the community form (the same answers within a day), against what
|
||||||
|
chance alone gives (analysis/overlap/overlap.py). Measured only: no run is removed.
|
||||||
|
reports:
|
||||||
|
path: data/public/reports.json
|
||||||
|
format: application/json
|
||||||
|
description: Runs reported through the Atlas's "Report a run" form (issues on its repository), answers only, no usernames.
|
||||||
|
register:
|
||||||
|
path: data/public/register.json
|
||||||
|
format: application/json
|
||||||
|
description: The Unofficial Dragon Register (which dragon each rider bonded), without rider names.
|
||||||
|
stats:
|
||||||
|
path: data/public/stats.json
|
||||||
|
format: application/json
|
||||||
|
description: >-
|
||||||
|
Every number the Atlas page shows, for six filter presets (analysis/stats/site_stats.py; what is measured is
|
||||||
|
analysis/stats/measures.yaml).
|
||||||
|
policy:
|
||||||
|
path: data/public/policy.json
|
||||||
|
format: application/json
|
||||||
|
description: >-
|
||||||
|
The route model: the game (core/spec/game.yaml), the count tables behind every roll, and the best decision
|
||||||
|
tree for every dragon colour under two goals, with posterior intervals (planner/build_policy.py).
|
||||||
|
graph:
|
||||||
|
path: data/public/graph.json
|
||||||
|
format: application/json
|
||||||
|
description: The route graph over every run in runs_clean.csv, counted per source (analysis/network/build-graph.js).
|
||||||
|
|
||||||
|
# The columns of runs_clean. type: text, integer, boolean or date. values: every value the column may take
|
||||||
|
# (empty cells are always allowed and mean "does not apply" or "not recorded").
|
||||||
|
columns:
|
||||||
|
run_id: { type: text, required: true, description: "Unique id of the run, stable when rows are deleted or re-sorted: sheet-<hash of the form row's answers and timestamp>, register-<hash of the register row>, thread-<result id>, comment-<Reddit comment id>, reported-<issue number> or bot-<hash>." }
|
||||||
|
source:
|
||||||
|
type: text
|
||||||
|
required: true
|
||||||
|
description: >-
|
||||||
|
Where the run came from. "reddit spreadsheet": the community Threshing Routes form and spreadsheet linked from
|
||||||
|
the r/fourthwing megathreads. "reddit thread": a dragonkind.com result page posted in a megathread (bonded,
|
||||||
|
route not recorded). "reddit comment": a run a rider described in a megathread comment, read automatically into
|
||||||
|
the "Report a run" answers by the threshing-reddit scraper, which delivers them by pull request (hand
|
||||||
|
corrections in collection/manual/reddit_comments.yaml). "reported": the Atlas's own "Report a run" form. "bot": an attempt logged by the
|
||||||
|
DragonKind bot. "register": a bonded dragon entered in the community's Unofficial Dragon Register (outcome
|
||||||
|
only, no route; the same run may also be in the spreadsheet). "reddit pdf": the community route PDF (a
|
||||||
|
flowchart of the routes, not a log of runs, so it adds no rows today).
|
||||||
|
values: [reddit spreadsheet, reddit thread, reddit comment, register, reported, bot, reddit pdf]
|
||||||
|
entry:
|
||||||
|
type: text
|
||||||
|
description: >-
|
||||||
|
For spreadsheet runs, the sheet's own row label: "Form" for a form submission (it has a timestamp);
|
||||||
|
bulk-pasted logs keep the label they were pasted with. Bulk logs record every run of the players who kept
|
||||||
|
them, so they are the least selectively reported rows. Empty for other sources.
|
||||||
|
values: [Form, Data Import, BulkUpload3, Manual Upload, Historical import, Unknown import, Unknown]
|
||||||
|
bot_mode:
|
||||||
|
type: text
|
||||||
|
description: >-
|
||||||
|
For bot runs, how the bot chose: "auto_learn" (its own rules and the route PDF), "atlas_policy" (the Atlas's
|
||||||
|
route model), "atlas_thompson" (the route model, sampling routes in proportion to how likely each is best), "explore" (trying untested options), "experiment" (a randomised test), "manual" (a person
|
||||||
|
clicked). Matters for analysis: the bot follows a strategy, so its choices are not like a player's. Empty for
|
||||||
|
other sources.
|
||||||
|
values: [auto_learn, atlas_policy, atlas_thompson, explore, experiment, manual]
|
||||||
|
date: { type: date, description: "Date of the run or its report (YYYY-MM-DD): the form submission, the issue, or the bot attempt. Empty for bulk-pasted rows and result pages." }
|
||||||
|
wing: { type: text, description: The rider's wing, from the form., values: [First, Second, Third, Fourth, Multiple, Unknown] }
|
||||||
|
section: { type: text, description: The rider's section within the wing (free text as answered). }
|
||||||
|
squad: { type: text, description: The rider's squad., values: [First, Second, Third, "Don't know", Unknown] }
|
||||||
|
attempt: { type: integer, description: Which attempt this was for the account (1 = first). Empty if not given. }
|
||||||
|
attempt_group: { type: text, description: First attempt or a later one ("I've lost count" counts as later)., values: [First attempt, Later attempt, Unknown] }
|
||||||
|
goal:
|
||||||
|
type: text
|
||||||
|
description: Which dragon the rider was trying to bond (older form) or why they did the run (redesigned form).
|
||||||
|
values: [Red, Green, Orange, Brown, Blue, Black, Blue or Black, Red (tree), Any (for fun), Daily run data, "(not asked/blank)"]
|
||||||
|
company: { type: text, description: Who entered the valley with the rider., values: [Alone, 1 Squadmate, 2 Squadmates, Unknown] }
|
||||||
|
left_squadmates:
|
||||||
|
type: boolean
|
||||||
|
description: >-
|
||||||
|
Whether a rider who entered with squadmates later left them. Only asked from 2026-10-27: earlier and undated
|
||||||
|
squad runs are empty (unknown).
|
||||||
|
direction: { type: text, description: First direction., values: [East, West, Center, Multiple, Unknown] }
|
||||||
|
first_sighting: { type: text, description: The first dragon that found the rider (a roll of the game)., values: [Red, Brown, Green, Orange, Unsure, Unknown] }
|
||||||
|
sighting_action:
|
||||||
|
type: text
|
||||||
|
description: How the rider reacted to the first dragon (redesigned form only).
|
||||||
|
values: [Hold still, Respect / face it, Retreat / run, Hide, Weapon, Meet its gaze, Protect squadmate, Approach, Stand alone, Unknown, "(not asked)"]
|
||||||
|
scream:
|
||||||
|
type: text
|
||||||
|
description: What the rider did about the scream, or that they died before it.
|
||||||
|
values: [Investigate & help, Investigate & leave, Ignore the scream, DIED at first sighting, Unknown]
|
||||||
|
resolution:
|
||||||
|
type: text
|
||||||
|
description: How the cadet encounter ended.
|
||||||
|
values: [Killed the bullies yourself, Squadmate's revenge, Left bullies to the dragons, Tourniquet, Left injured cadet, Took their weapons, Left them to it, DIED in combat, DIED at first sighting, Unknown]
|
||||||
|
combat_first:
|
||||||
|
type: text
|
||||||
|
description: The rider's first move in the bully fight.
|
||||||
|
values: [Assess the situation, Even the numbers (smaller cadet), Put yourself in the middle (bigger cadet), "(not recorded)"]
|
||||||
|
combat_second: { type: text, description: After assessing, what the rider did about the smaller cadet's dagger., values: [Engage the smaller cadet, Daggers or not (protect squadmate), "(not recorded)"] }
|
||||||
|
post_path: { type: text, description: The fork after the bully fight (only that path has one)., values: [Forest, West, East, (no fork), Unknown] }
|
||||||
|
hour: { type: text, description: After an hour's walk, the tallest tree or the valley centre., values: [Tree, Valley, DIED before the hour, Unknown] }
|
||||||
|
branch:
|
||||||
|
type: text
|
||||||
|
description: Which bonding encounter the run reached after the hour, worked out from the dragons recorded.
|
||||||
|
values: [Shadow (rare), "Descend quickly: Red", "Descend quickly: let the Red pass", "Descend slowly: two Greens", Valley Red, "Passed the Red: meadow"]
|
||||||
|
enc_Red: &enc { type: text, description: The rider's answer for this dragon in the bonding grid., values: [Bonded!, Incinerated, Changed my mind, Saved by another] }
|
||||||
|
enc_Green: *enc
|
||||||
|
enc_Orange: *enc
|
||||||
|
enc_Brown: *enc
|
||||||
|
enc_Blue: *enc
|
||||||
|
enc_Black: *enc
|
||||||
|
outcome: { type: text, description: How the run ended., values: [Bonded, Incinerated, Died before the hour, No outcome recorded, Ambiguous] }
|
||||||
|
outcome_color: { type: text, description: The dragon bonded, or the one that incinerated the rider (the last met)., values: [Red, Green, Orange, Brown, Blue, Black] }
|
||||||
|
rescued: { type: boolean, description: The Greens' encounter ended with an Orange or Brown swooping in and bonding the rider. }
|
||||||
|
saw_blue_meadow: { type: boolean, description: A Blue waited in the meadow (valley runs). }
|
||||||
|
saw_shadow: { type: boolean, description: The shadow appeared at the tree (tree runs). }
|
||||||
|
rare_reported: { type: text, description: The rider's own answer to "did you meet a rare dragon"., values: ["No", Blue (valley), Shadow, Unknown, "(not asked)"] }
|
||||||
|
malek_intent: { type: text, description: Whether the rider would seek Malek (die on purpose) rather than bond a dragon they did not want., values: ["Yes", "No", Unknown, "(not asked)"] }
|
||||||
|
tail: { type: text, description: The tail of the dragon bonded (redesigned form)., values: [Clubtail, Daggertail, Morningstartail, Scorpiontail, Swordtail] }
|
||||||
|
data_flags: { type: text, description: Inconsistencies found while coding the row, separated by "; ". Empty when none. }
|
||||||
|
death_note: { type: text, description: Free-text note from riders who died (email addresses removed). }
|
||||||
|
bond_note: { type: text, description: Free-text note from riders who bonded (email addresses removed). }
|
||||||
@@ -0,0 +1,977 @@
|
|||||||
|
{
|
||||||
|
"schema": 2,
|
||||||
|
"seed": 20261116,
|
||||||
|
"lifecycle": {
|
||||||
|
"research_days": 3,
|
||||||
|
"retire": true,
|
||||||
|
"long_lived": {
|
||||||
|
"every": 10,
|
||||||
|
"take": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"record": [
|
||||||
|
"accountSeq",
|
||||||
|
"accountAttempt",
|
||||||
|
"accountCreatedAt",
|
||||||
|
"wing",
|
||||||
|
"section",
|
||||||
|
"squad",
|
||||||
|
"sawShadowBefore"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"shadow": [
|
||||||
|
{
|
||||||
|
"step": "the tree top",
|
||||||
|
"take": "shadow",
|
||||||
|
"never": "green|descend"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "asked to turn back",
|
||||||
|
"take": "stay the course|certain you saw",
|
||||||
|
"never": "second thought|green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "asked again",
|
||||||
|
"take": "intriguing|even if this kills",
|
||||||
|
"never": "second thought|green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "the Blue lands",
|
||||||
|
"take": "freeze and lower",
|
||||||
|
"never": "approach|run"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "another cadet arrives",
|
||||||
|
"take": "hold (completely )?still",
|
||||||
|
"never": "warn|turn while|approach"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "the Blue burns the cadet",
|
||||||
|
"take": "hold (your )?position",
|
||||||
|
"never": "interven|approach|warn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "the Blue judges",
|
||||||
|
"take": "head lowered|await.*judg",
|
||||||
|
"never": "approach|sure"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "the Blue has left",
|
||||||
|
"take": "help the .*cadet",
|
||||||
|
"never": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "the cadet's burns",
|
||||||
|
"take": "wrap|cut .*sleeve|dagger to cut",
|
||||||
|
"never": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "moving on",
|
||||||
|
"take": "head south",
|
||||||
|
"never": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "a branch snaps",
|
||||||
|
"take": "turn to face",
|
||||||
|
"never": "ignore"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "the Black",
|
||||||
|
"take": "hold (its|it's|the) gaze|lift your chin",
|
||||||
|
"never": "lower your eyes"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"screenPicks": [
|
||||||
|
{
|
||||||
|
"where": "after the shadow shows",
|
||||||
|
"use": "script",
|
||||||
|
"script": "shadow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"where": "bonding the target dragon",
|
||||||
|
"use": "thompson"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"where": "experiment mapping",
|
||||||
|
"use": "least-tried"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"experiments": [
|
||||||
|
{
|
||||||
|
"id": "fresh-replicate",
|
||||||
|
"status": "running",
|
||||||
|
"question": "On a fresh account, does one exact path always show the shadow, sometimes, or never?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 1,
|
||||||
|
"to": 1
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"exclusive": true,
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fresh-ablate",
|
||||||
|
"status": "waiting",
|
||||||
|
"note": "starts when fresh-replicate is complete",
|
||||||
|
"question": "Which choices on that path does the shadow need?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 1,
|
||||||
|
"to": 1
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"exclusive": true,
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "with one squadmate",
|
||||||
|
"change": {
|
||||||
|
"company": "1 Squadmate",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "1 Squadmate",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "with two squadmates",
|
||||||
|
"change": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree",
|
||||||
|
"leave": "Stay together"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "leave the squad",
|
||||||
|
"change": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"leave": "Leave them"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "2 Squadmates",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree",
|
||||||
|
"leave": "Leave them"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "east first",
|
||||||
|
"change": {
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "East",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "centre first",
|
||||||
|
"change": {
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "Center",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "face the first dragon",
|
||||||
|
"change": {
|
||||||
|
"react": "Respect / face it"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Respect / face it",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "charge the smaller cadet",
|
||||||
|
"change": {
|
||||||
|
"fight": "Charge the smaller cadet"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Charge the smaller cadet",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "charge the bigger cadet",
|
||||||
|
"change": {
|
||||||
|
"dagger": "Charge the bigger cadet anyway"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Charge the bigger cadet anyway",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "kill the bullies",
|
||||||
|
"change": {
|
||||||
|
"fate": "Killed the bullies yourself"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Killed the bullies yourself",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "leave the bullies",
|
||||||
|
"change": {
|
||||||
|
"fate": "Left bullies to the dragons"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Left bullies to the dragons",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fork to the forest",
|
||||||
|
"change": {
|
||||||
|
"post": "Forest"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "Forest",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fork east",
|
||||||
|
"change": {
|
||||||
|
"post": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "East",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "shadow-again",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an account that saw the shadow, and died, see it again on the same path?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": 4
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": true
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "second-attempt-same-path",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an account that missed on its first attempt miss again on the same path?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": 2
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"accounts": {
|
||||||
|
"every": 2,
|
||||||
|
"take": 1,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": false
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "veteran-repeat",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an older account open up by repeating one path?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 3,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"accounts": {
|
||||||
|
"every": 10,
|
||||||
|
"take": 1,
|
||||||
|
"offset": 0
|
||||||
|
},
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": false
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "West",
|
||||||
|
"react": "Hold still",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"fight": "Pause to assess",
|
||||||
|
"dagger": "Engage the smaller cadet",
|
||||||
|
"fate": "Squadmate's revenge",
|
||||||
|
"post": "West",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "veteran-variety",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does an older account open up by varying its choices?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 3,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "account",
|
||||||
|
"share": 1,
|
||||||
|
"accounts": {
|
||||||
|
"every": 10,
|
||||||
|
"take": 1,
|
||||||
|
"offset": 1
|
||||||
|
},
|
||||||
|
"exclusive": true,
|
||||||
|
"when": {
|
||||||
|
"sawShadowBefore": false
|
||||||
|
},
|
||||||
|
"target": "Black",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "shadow",
|
||||||
|
"rare": "yes"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "TREE_NO_SHADOW_AUTO_BURN",
|
||||||
|
"when": "no shadow at the tree"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"clearing": "Help your squadmate",
|
||||||
|
"hour": "Tree"
|
||||||
|
},
|
||||||
|
"cycle": {
|
||||||
|
"company": [
|
||||||
|
"Alone",
|
||||||
|
"1 Squadmate",
|
||||||
|
"2 Squadmates"
|
||||||
|
],
|
||||||
|
"direction": [
|
||||||
|
"West",
|
||||||
|
"East",
|
||||||
|
"Center"
|
||||||
|
],
|
||||||
|
"fight": [
|
||||||
|
"Pause to assess",
|
||||||
|
"Charge the smaller cadet",
|
||||||
|
"Charge between the bigger cadet and your squadmate"
|
||||||
|
],
|
||||||
|
"dagger": [
|
||||||
|
"Engage the smaller cadet",
|
||||||
|
"Charge the bigger cadet anyway"
|
||||||
|
],
|
||||||
|
"fate": [
|
||||||
|
"Killed the bullies yourself",
|
||||||
|
"Squadmate's revenge",
|
||||||
|
"Left bullies to the dragons"
|
||||||
|
],
|
||||||
|
"post": [
|
||||||
|
"Forest",
|
||||||
|
"West",
|
||||||
|
"East"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "meadow-blue-route",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Does anything before the meadow change how often the Blue waits there?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "attempt",
|
||||||
|
"share": 0.5,
|
||||||
|
"target": "Blue",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "meadow",
|
||||||
|
"rare": "Blue"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "MEADOW_NO_BLUE_AUTO_BURN",
|
||||||
|
"when": "no Blue in the meadow"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "scream=Investigate the scream / direction=West",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Investigate the scream / direction=East",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Investigate the scream / direction=Center",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Investigate the scream",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Keep walking / direction=West",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "West"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Keep walking / direction=East",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "East"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "scream=Keep walking / direction=Center",
|
||||||
|
"levels": {
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"fix": {
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"direction": "Center"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 70
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "mapping",
|
||||||
|
"status": "running",
|
||||||
|
"question": "What does every option on every screen lead to?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "attempt",
|
||||||
|
"share": 0.35,
|
||||||
|
"target": "Blue",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "uniform",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": null,
|
||||||
|
"burn": {
|
||||||
|
"reason": "NOT_TARGET_AUTO_BURN",
|
||||||
|
"when": "the encounter is not a Blue or a Black"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": 1000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sentinel",
|
||||||
|
"status": "running",
|
||||||
|
"question": "Have the game's odds changed?",
|
||||||
|
"attempts": {
|
||||||
|
"from": 2,
|
||||||
|
"to": null
|
||||||
|
},
|
||||||
|
"unit": "attempt",
|
||||||
|
"share": 0.15,
|
||||||
|
"target": "Blue",
|
||||||
|
"objective": "eventually",
|
||||||
|
"sampling": "best",
|
||||||
|
"seed": 20261116,
|
||||||
|
"measures": {
|
||||||
|
"roll": "meadow",
|
||||||
|
"rare": "Blue"
|
||||||
|
},
|
||||||
|
"burn": {
|
||||||
|
"reason": "MEADOW_NO_BLUE_AUTO_BURN",
|
||||||
|
"when": "no Blue in the meadow"
|
||||||
|
},
|
||||||
|
"arms": [
|
||||||
|
{
|
||||||
|
"id": "all",
|
||||||
|
"fix": {
|
||||||
|
"company": "Alone",
|
||||||
|
"direction": "Center",
|
||||||
|
"scream": "Keep walking",
|
||||||
|
"wounded": "Tourniquet",
|
||||||
|
"hour": "Valley",
|
||||||
|
"valley": "Pass the Red (meadow)"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"planned": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"progress": {
|
||||||
|
"runs": 0,
|
||||||
|
"observed": 0,
|
||||||
|
"rare": 0,
|
||||||
|
"unknownArms": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "a7b307abeaaa"
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,134 @@
|
|||||||
|
{
|
||||||
|
"schema": 1,
|
||||||
|
"rule": {
|
||||||
|
"min_answers": 4,
|
||||||
|
"window_days": 1,
|
||||||
|
"baseline_shifts_days": [
|
||||||
|
-28,
|
||||||
|
-21,
|
||||||
|
-14,
|
||||||
|
14,
|
||||||
|
21,
|
||||||
|
28
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comment_runs": 82,
|
||||||
|
"comparable": 36,
|
||||||
|
"matched": 9,
|
||||||
|
"expected_by_chance": 7.3,
|
||||||
|
"likely_double": 1.7,
|
||||||
|
"matches": [
|
||||||
|
{
|
||||||
|
"comment": "comment-pdjr7gm",
|
||||||
|
"form": [
|
||||||
|
"sheet-e42d078df15a",
|
||||||
|
"sheet-d930d7c3533d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pdq6tsw",
|
||||||
|
"form": [
|
||||||
|
"sheet-e588ea82d6f9",
|
||||||
|
"sheet-410e2db3f2df",
|
||||||
|
"sheet-af47d3ca8ef8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pe0kwol",
|
||||||
|
"form": [
|
||||||
|
"sheet-bea7c3c25e85"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pe2l6mz",
|
||||||
|
"form": [
|
||||||
|
"sheet-7a526f9f5956",
|
||||||
|
"sheet-8191a69798de",
|
||||||
|
"sheet-0d56c45763b7",
|
||||||
|
"sheet-c51873588c6d",
|
||||||
|
"sheet-b8d6d0a2ce4c",
|
||||||
|
"sheet-34e592789d1b",
|
||||||
|
"sheet-66e8fda4be49",
|
||||||
|
"sheet-1922bb0d7397",
|
||||||
|
"sheet-37f31b85732d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pe2n3j1",
|
||||||
|
"form": [
|
||||||
|
"sheet-807397c3d7e2",
|
||||||
|
"sheet-ff44440c3570"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pev3uge",
|
||||||
|
"form": [
|
||||||
|
"sheet-9c848ba4c9a9",
|
||||||
|
"sheet-65c505bb553d",
|
||||||
|
"sheet-93077866d5b5",
|
||||||
|
"sheet-f4ba657cd34c",
|
||||||
|
"sheet-2fa18d22a1eb",
|
||||||
|
"sheet-4602a99ee254",
|
||||||
|
"sheet-5320d71ea890",
|
||||||
|
"sheet-55b901b0c666",
|
||||||
|
"sheet-94b17052d8c3",
|
||||||
|
"sheet-8924c5206376",
|
||||||
|
"sheet-81124318fbca",
|
||||||
|
"sheet-1346c5ddbeb6",
|
||||||
|
"sheet-c8670abfd8b3",
|
||||||
|
"sheet-913d430db3ed",
|
||||||
|
"sheet-2fa9c70f091d",
|
||||||
|
"sheet-19e5e9069e3b",
|
||||||
|
"sheet-19ecd172b18a",
|
||||||
|
"sheet-62484835c1c0",
|
||||||
|
"sheet-86e585f7994e",
|
||||||
|
"sheet-ad2265128708",
|
||||||
|
"sheet-f65261b3b1f7",
|
||||||
|
"sheet-cead6ddb0272",
|
||||||
|
"sheet-dd7216ed25e8",
|
||||||
|
"sheet-60a2410b997e",
|
||||||
|
"sheet-93303aaac8a1",
|
||||||
|
"sheet-aac64def431c",
|
||||||
|
"sheet-a62003707841",
|
||||||
|
"sheet-76d43e939528",
|
||||||
|
"sheet-ca945bc0e4f7",
|
||||||
|
"sheet-83270750d93e",
|
||||||
|
"sheet-7cb7c22a757e",
|
||||||
|
"sheet-1598950786a0",
|
||||||
|
"sheet-0d44ea821771",
|
||||||
|
"sheet-cc3275c111d3",
|
||||||
|
"sheet-899c141a899c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pf22tpj",
|
||||||
|
"form": [
|
||||||
|
"sheet-3fdbb179c709",
|
||||||
|
"sheet-08a79a6ae907",
|
||||||
|
"sheet-73d9e41fee8d",
|
||||||
|
"sheet-172fec1dedc4",
|
||||||
|
"sheet-792cc1632e55",
|
||||||
|
"sheet-e97b3363e32f",
|
||||||
|
"sheet-d81d1b4b8c65",
|
||||||
|
"sheet-bcb8e109f973",
|
||||||
|
"sheet-8d6f20b09b5e",
|
||||||
|
"sheet-3848c3443c4e",
|
||||||
|
"sheet-ff87178ef296",
|
||||||
|
"sheet-5819e3882bec",
|
||||||
|
"sheet-aba89201ba1e"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pfhmw5d",
|
||||||
|
"form": [
|
||||||
|
"sheet-b03b79966bdb"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"comment": "comment-pgzz9hc",
|
||||||
|
"form": [
|
||||||
|
"sheet-344751923fc3"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,737 @@
|
|||||||
|
{
|
||||||
|
"_about": "The answers inside each bonding encounter, transcribed by hand from the community route PDF (see source). Data, not the flowchart: each option's answer (say), the guide's printed rate (pct), whether it is on the guide's recommended dark-tile path (best), whether the guide marks it untested or unconfirmed (unconfirmed), and what follows (then) or how it ends (end); roll marks a step the guide calls an unknown chance or decision. route_encounters: which encounters each bonding encounter of the route model shows. Edit this file when the PDF changes (the daily check opens a pull request on the bot's repo when it does).",
|
||||||
|
"version": 1,
|
||||||
|
"source": {
|
||||||
|
"title": "Threshing Options (community route PDF)",
|
||||||
|
"authors": [
|
||||||
|
"u/ClumsyBadger",
|
||||||
|
"u/Old_Regular3018",
|
||||||
|
"u/Smart_Trifle_2099"
|
||||||
|
],
|
||||||
|
"version": "2026-11-16",
|
||||||
|
"link": "https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view",
|
||||||
|
"note": "Percentages are the guide's, from documented runs; options off the recommended path often rest on fewer than three records."
|
||||||
|
},
|
||||||
|
"encounters": {
|
||||||
|
"valley-Red": {
|
||||||
|
"title": "The valley Red",
|
||||||
|
"scene": "You're moved by an instinctual feeling that this...",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Is your dragon",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "You're sure",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Continue approach",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Touch its talon",
|
||||||
|
"best": true,
|
||||||
|
"pct": "93%",
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Run to mount its foreleg",
|
||||||
|
"end": "Bonded"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Exit gracefully",
|
||||||
|
"end": "That was close (on to the meadow)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "On second thought…",
|
||||||
|
"end": "That was close (on to the meadow)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Is not your dragon, leave",
|
||||||
|
"end": "That was close (on to the meadow)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tree-Red": {
|
||||||
|
"title": "The Red below the tree",
|
||||||
|
"scene": "A red dragon prowls ten feet beneath you.",
|
||||||
|
"warning": "The guide gives a 98% chance of dying if you engage this dragon.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Jump on its back, or jump to land by its tail",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"roll": "Some unknown chance or decision roll"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hold the Red's gaze",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Jump off and hope",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Drop to your stomach",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Hang tight",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Crawl to the seat",
|
||||||
|
"pct": "2%",
|
||||||
|
"end": "Bonded"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Lower your eyes",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Wait and pursue the Green",
|
||||||
|
"end": "On to the two Greens"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tree-Greens": {
|
||||||
|
"title": "The two Greens",
|
||||||
|
"scene": "You enter a clearing with two Green dragons.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Turn to the right dragon",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Glance to the left dragon",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Don't move a muscle",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Stay still",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Decapitation isn't scary",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "You respect their nature",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded (Right Green)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "You don't know",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Greens have the best magic",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded (Left Green)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Intellect match",
|
||||||
|
"best": true,
|
||||||
|
"end": "A Brown saves you: Bonded (Brown)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Sidestep out of its mouth",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Sidestep out of its mouth",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Turn to the left dragon",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Glance to the right dragon",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Don't move a muscle",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Hold your ground",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "You always overextend",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded (Right Green)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "You lack flaws",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "You struggle with temper",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded (Left Green)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "You're always right",
|
||||||
|
"best": true,
|
||||||
|
"end": "An Orange saves you: Bonded (Orange)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Step back",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Stay neutral",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meadow-Orange": {
|
||||||
|
"title": "The meadow Orange",
|
||||||
|
"scene": "You approach the Orange dragon.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Absolutely sure, Orange",
|
||||||
|
"best": true,
|
||||||
|
"pct": "90%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Roar right back at it",
|
||||||
|
"best": true,
|
||||||
|
"pct": "69%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Flee",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Attempt to mount",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"roll": "Possibly an unknown decision or chance mechanic (20%)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hit the ground",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Run to mount its foreleg",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Look it in the eye",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Run to mount",
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Maintain eye contact",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Run at the claw",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Hold tight for balance",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Climb with strength",
|
||||||
|
"end": "Bonded"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Run, this was a mistake",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "On second thought…",
|
||||||
|
"pct": "10%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meadow-Brown": {
|
||||||
|
"title": "The meadow Brown",
|
||||||
|
"scene": "You approach the Brown dragon.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Run after the Brown",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "On second thought…",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Your heart is sure",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Shout at it to stop",
|
||||||
|
"pct": "50%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Apologise immediately",
|
||||||
|
"pct": "50%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Await judgment, or pray",
|
||||||
|
"pct": "90%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Mud fight!",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Wipe off the mud",
|
||||||
|
"pct": "90%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "The dragon speaks",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Defend the kingdom",
|
||||||
|
"end": "Death 50/50"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Defend the powerless",
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Seek revenge",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Throw mud at the dragon",
|
||||||
|
"pct": "60%",
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Find a better dragon",
|
||||||
|
"end": "Not recorded"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Indecisively chase it",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Mount the Brown's tail",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Throw your weight",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "You'll charm it",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hope for a clean death",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "It's already talking to you",
|
||||||
|
"end": "Bonded"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Wait for a better angle",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Turn to the Orange",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meadow-Blue": {
|
||||||
|
"title": "The meadow Blue",
|
||||||
|
"scene": "You approach the Blue dragon.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Change to Orange",
|
||||||
|
"pct": "?",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Change to Brown",
|
||||||
|
"pct": "?",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Absolutely, Blue Dragon",
|
||||||
|
"best": true,
|
||||||
|
"pct": "90%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Hold glare and advance",
|
||||||
|
"best": true,
|
||||||
|
"pct": "80%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Do nothing",
|
||||||
|
"best": true,
|
||||||
|
"pct": "83%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Lower your eyes",
|
||||||
|
"pct": "?",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Help the cadet",
|
||||||
|
"pct": "0%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hold glare and watch",
|
||||||
|
"best": true,
|
||||||
|
"pct": "80%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Straighten your spine",
|
||||||
|
"best": true,
|
||||||
|
"pct": "82%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Hold steady",
|
||||||
|
"pct": "0%",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Launch yourself right",
|
||||||
|
"best": true,
|
||||||
|
"pct": "85%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "You already know",
|
||||||
|
"pct": "?",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Bring down an empire",
|
||||||
|
"best": true,
|
||||||
|
"pct": "80%",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Seize the chance to mount",
|
||||||
|
"pct": "50%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Move slowly forward",
|
||||||
|
"best": true,
|
||||||
|
"pct": "80%",
|
||||||
|
"end": "Bonded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hold still",
|
||||||
|
"pct": "50%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "I want revenge",
|
||||||
|
"pct": "?",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Defend the helpless",
|
||||||
|
"pct": "?",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Speak first",
|
||||||
|
"pct": "20%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Do nothing",
|
||||||
|
"pct": "?",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Intervene and help",
|
||||||
|
"pct": "?",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Lower gaze, halt advance",
|
||||||
|
"pct": "0%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Lower gaze, advance",
|
||||||
|
"pct": "0%",
|
||||||
|
"end": "Incinerated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"shadow": {
|
||||||
|
"title": "The shadow",
|
||||||
|
"scene": "You've seen a shadow, where will it lead...",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "A green sounds good",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Stay the course",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Well this is intriguing",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Curiosity sated, retreat",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Find that Green",
|
||||||
|
"end": "On to the two Greens"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Go towards the valley",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Freeze and lower your eyes",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Warn the cadet",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hold still",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Aid the cadet",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hold position",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Approach the Blue",
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "On second thought…",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "You're sure",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Incinerated?"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Await judgement",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Help the cadet",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Use your dagger",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Head south and hope",
|
||||||
|
"best": true,
|
||||||
|
"end": "On to the Black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Take them to cold water",
|
||||||
|
"end": "Head back for the Greens, or explore other dragons"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Clean their uniform",
|
||||||
|
"end": "Head back for the Greens, or explore other dragons"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Leave to find your dragon",
|
||||||
|
"end": "Head back for the Greens, or explore other dragons"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Run towards the other cadet",
|
||||||
|
"unconfirmed": true,
|
||||||
|
"end": "Not tested"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Last chance to escape",
|
||||||
|
"end": "Head back for the Greens, or explore other dragons"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Leave while it's distracted",
|
||||||
|
"end": "Head back for the Greens, or explore other dragons"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Too big, you're out",
|
||||||
|
"end": "Head back for the Greens, or explore other dragons"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"black": {
|
||||||
|
"title": "The Black",
|
||||||
|
"scene": "A branch snaps behind you...",
|
||||||
|
"note": "Lowering your eyes has frequently ended in incineration; what follows it is unconfirmed.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"say": "Ignore it, keep walking",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Turn to face the threat",
|
||||||
|
"best": true,
|
||||||
|
"then": [
|
||||||
|
{
|
||||||
|
"say": "Lower your eyes",
|
||||||
|
"end": "Incinerated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"say": "Hold its gaze",
|
||||||
|
"best": true,
|
||||||
|
"end": "Bonded"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"route_encounters": {
|
||||||
|
"valley-Red": [
|
||||||
|
"valley-Red"
|
||||||
|
],
|
||||||
|
"tree-Red": [
|
||||||
|
"tree-Red"
|
||||||
|
],
|
||||||
|
"tree-Greens": [
|
||||||
|
"tree-Greens"
|
||||||
|
],
|
||||||
|
"meadow-Orange": [
|
||||||
|
"meadow-Orange"
|
||||||
|
],
|
||||||
|
"meadow-Brown": [
|
||||||
|
"meadow-Brown"
|
||||||
|
],
|
||||||
|
"meadow-Blue": [
|
||||||
|
"meadow-Blue"
|
||||||
|
],
|
||||||
|
"shadow-Blue": [
|
||||||
|
"shadow"
|
||||||
|
],
|
||||||
|
"shadow-Black": [
|
||||||
|
"shadow",
|
||||||
|
"black"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10846
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+2610
File diff suppressed because it is too large
Load Diff
+252
@@ -0,0 +1,252 @@
|
|||||||
|
/* dragons.js — the dragon silhouettes of the valley map (traced from the pose reference sheet) and its cadets.
|
||||||
|
* Each pose is built from simple parts (tapered tubes, a scalloped wing membrane, a head with horns, spines,
|
||||||
|
* a spaded tail), so every dragon is drawn the same way but stands differently. Drawn facing right in a
|
||||||
|
* 200 x 160 box; flip with scale(-1, 1). Works in the browser (window.DragonArt) and in Node. */
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof module === "object" && module.exports) module.exports = factory();
|
||||||
|
else root.DragonArt = factory();
|
||||||
|
})(typeof self !== "undefined" ? self : this, function () {
|
||||||
|
"use strict";
|
||||||
|
const f = (n) => Math.round(n * 10) / 10;
|
||||||
|
const lerp = (a, b, t) => a + (b - a) * t;
|
||||||
|
|
||||||
|
/** Points along a cubic Bezier given as [p0, c1, c2, p1] (each [x, y]). */
|
||||||
|
function bez(P, n = 28) {
|
||||||
|
const out = [];
|
||||||
|
for (let i = 0; i <= n; i++) {
|
||||||
|
const t = i / n, u = 1 - t;
|
||||||
|
out.push([
|
||||||
|
u * u * u * P[0][0] + 3 * u * u * t * P[1][0] + 3 * u * t * t * P[2][0] + t * t * t * P[3][0],
|
||||||
|
u * u * u * P[0][1] + 3 * u * u * t * P[1][1] + 3 * u * t * t * P[2][1] + t * t * t * P[3][1],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
/** A tube along a Bezier whose half-width goes from r0 to r1 (r can also be a function of t). */
|
||||||
|
function tube(P, r0, r1, n = 28) {
|
||||||
|
const pts = bez(P, n), L = [], R = [];
|
||||||
|
pts.forEach((p, i) => {
|
||||||
|
const a = pts[Math.max(0, i - 1)], b = pts[Math.min(pts.length - 1, i + 1)];
|
||||||
|
let dx = b[0] - a[0], dy = b[1] - a[1];
|
||||||
|
const len = Math.hypot(dx, dy) || 1;
|
||||||
|
dx /= len; dy /= len;
|
||||||
|
const t = i / n, r = typeof r0 === "function" ? r0(t) : lerp(r0, r1, t);
|
||||||
|
L.push([p[0] - dy * r, p[1] + dx * r]);
|
||||||
|
R.push([p[0] + dy * r, p[1] - dx * r]);
|
||||||
|
});
|
||||||
|
const ring = L.concat(R.reverse());
|
||||||
|
return "M" + ring.map((p) => `${f(p[0])} ${f(p[1])}`).join(" L") + " Z";
|
||||||
|
}
|
||||||
|
const poly = (pts) => "M" + pts.map((p) => `${f(p[0])} ${f(p[1])}`).join(" L") + " Z";
|
||||||
|
const ell = (cx, cy, rx, ry, rot = 0) => {
|
||||||
|
const pts = [];
|
||||||
|
for (let i = 0; i < 36; i++) {
|
||||||
|
const a = (i / 36) * Math.PI * 2, x = rx * Math.cos(a), y = ry * Math.sin(a), c = Math.cos(rot), s = Math.sin(rot);
|
||||||
|
pts.push([cx + x * c - y * s, cy + x * s + y * c]);
|
||||||
|
}
|
||||||
|
return poly(pts);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wing membrane: a leading-edge bone shoulder -> wrist -> tip, finger tips along the trailing edge, and
|
||||||
|
* scalloped membrane between them, back to the root on the body.
|
||||||
|
*/
|
||||||
|
function wing({ shoulder, wrist, tip, fingers, root, bow = 0.28, bone = 4 }) {
|
||||||
|
const d = [tube([shoulder, [lerp(shoulder[0], wrist[0], 0.4), lerp(shoulder[1], wrist[1], 0.4) - 6], [lerp(shoulder[0], wrist[0], 0.8), lerp(shoulder[1], wrist[1], 0.8)], wrist], bone, bone * 0.8),
|
||||||
|
tube([wrist, [lerp(wrist[0], tip[0], 0.3), lerp(wrist[1], tip[1], 0.3)], [lerp(wrist[0], tip[0], 0.7), lerp(wrist[1], tip[1], 0.7)], tip], bone * 0.8, 0.8)];
|
||||||
|
const edge = [tip].concat(fingers, [root]);
|
||||||
|
let m = `M${f(shoulder[0])} ${f(shoulder[1])} L${f(wrist[0])} ${f(wrist[1])} L${f(tip[0])} ${f(tip[1])}`;
|
||||||
|
for (let i = 1; i < edge.length; i++) {
|
||||||
|
const a = edge[i - 1], b = edge[i];
|
||||||
|
// scallop: control point pulled toward the wrist
|
||||||
|
const mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2;
|
||||||
|
const cx = lerp(mx, wrist[0], bow), cy = lerp(my, wrist[1], bow);
|
||||||
|
m += ` Q${f(cx)} ${f(cy)} ${f(b[0])} ${f(b[1])}`;
|
||||||
|
}
|
||||||
|
m += ` L${f(shoulder[0])} ${f(shoulder[1])} Z`;
|
||||||
|
d.push(m);
|
||||||
|
// finger bones from the wrist (thin, add texture at the edge)
|
||||||
|
fingers.forEach((p) => d.push(tube([wrist, [lerp(wrist[0], p[0], 0.33), lerp(wrist[1], p[1], 0.33)], [lerp(wrist[0], p[0], 0.66), lerp(wrist[1], p[1], 0.66)], p], 1.6, 0.6, 10)));
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Head pointing along `ang` (radians, 0 = right) from the neck end, with horns and an open or closed jaw. */
|
||||||
|
function head({ at, ang = 0, size = 1, open = 0, horns = 2 }) {
|
||||||
|
const c = Math.cos(ang), s = Math.sin(ang);
|
||||||
|
const T = (x, y) => [at[0] + (x * c - y * s) * size, at[1] + (x * s + y * c) * size];
|
||||||
|
const d = [];
|
||||||
|
// skull and upper snout
|
||||||
|
d.push(poly([T(-8, 2), T(-6, -9), T(4, -12), T(14, -8), T(26, -5), T(31, -2), T(30, 1), T(18, 2 + open * 0.3), T(8, 6)]));
|
||||||
|
// jaw (drops when open)
|
||||||
|
d.push(poly([T(-6, 3), T(10, 4), T(28, 3 + open), T(26, 6 + open), T(12, 10 + open * 0.4), T(-4, 9)]));
|
||||||
|
// horns sweeping back
|
||||||
|
for (let i = 0; i < horns; i++) {
|
||||||
|
const y0 = -9 + i * 4, len = 18 - i * 6;
|
||||||
|
d.push(tube([T(2 - i * 3, y0), T(-6 - i * 2, y0 - 6), T(-14 - i * 3, y0 - 8 - i), T(-12 - len * 0.6 - i * 3, y0 - 14 + i * 3)], 2.6 * size - i * 0.4, 0.4, 10));
|
||||||
|
}
|
||||||
|
// brow spike and cheek frill
|
||||||
|
d.push(poly([T(-4, 4), T(-14, 8), T(-5, 8)]));
|
||||||
|
return { d, eye: T(8, -5), eyeR: 1.9 * size };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Small triangular spines along a list of points (pointing away from `side` normal). */
|
||||||
|
function spines(pts, size, side = -1, every = 2) {
|
||||||
|
const d = [];
|
||||||
|
for (let i = 1; i < pts.length - 1; i += every) {
|
||||||
|
const a = pts[i - 1], b = pts[i + 1], p = pts[i];
|
||||||
|
let dx = b[0] - a[0], dy = b[1] - a[1];
|
||||||
|
const len = Math.hypot(dx, dy) || 1;
|
||||||
|
dx /= len; dy /= len;
|
||||||
|
const nx = -dy * side, ny = dx * side, k = typeof size === "function" ? size(i / pts.length) : size;
|
||||||
|
d.push(poly([[p[0] - dx * k * 0.6, p[1] - dy * k * 0.6], [p[0] + nx * k * 1.5 - dx * k * 0.5, p[1] + ny * k * 1.5 - dy * k * 0.5], [p[0] + dx * k * 0.6, p[1] + dy * k * 0.6]]));
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Tail as a tapering tube ending in a spade. */
|
||||||
|
function tail(P, r0) {
|
||||||
|
const d = [tube(P, (t) => Math.max(0.9, r0 * (1 - t) ** 1.1), null, 36)];
|
||||||
|
const pts = bez(P, 36), a = pts[pts.length - 3], b = pts[pts.length - 1];
|
||||||
|
let dx = b[0] - a[0], dy = b[1] - a[1];
|
||||||
|
const len = Math.hypot(dx, dy) || 1;
|
||||||
|
dx /= len; dy /= len;
|
||||||
|
const nx = -dy, ny = dx, k = Math.max(4, r0 * 0.9);
|
||||||
|
d.push(poly([[b[0] - dx * k * 0.6, b[1] - dy * k * 0.6], [b[0] + nx * k, b[1] + ny * k], [b[0] + dx * k * 1.6, b[1] + dy * k * 1.6], [b[0] - nx * k, b[1] - ny * k]]));
|
||||||
|
return { d, pts };
|
||||||
|
}
|
||||||
|
/** Leg: hip -> knee -> foot with three claws. */
|
||||||
|
function leg(hip, knee, foot, r, toe = 1) {
|
||||||
|
const d = [tube([hip, [lerp(hip[0], knee[0], 0.6), lerp(hip[1], knee[1], 0.6)], knee, [lerp(knee[0], foot[0], 0.5), lerp(knee[1], foot[1], 0.5)]], r, r * 0.6, 14),
|
||||||
|
tube([[lerp(knee[0], foot[0], 0.4), lerp(knee[1], foot[1], 0.4)], [lerp(knee[0], foot[0], 0.6), lerp(knee[1], foot[1], 0.6)], [lerp(knee[0], foot[0], 0.85), lerp(knee[1], foot[1], 0.85)], foot], r * 0.6, r * 0.45, 10)];
|
||||||
|
for (let i = -1; i <= 1; i++) d.push(poly([[foot[0] - 2, foot[1] - 2], [foot[0] + toe * (6 + i * 1.5), foot[1] + 1 + i * 2.2], [foot[0] + 1, foot[1] + 2.5]]));
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- poses ---------- */
|
||||||
|
|
||||||
|
/* Six silhouettes traced from the project's pose reference sheet (all facing right, in the 200 x 160 box;
|
||||||
|
* flying and diving poses centred, the others standing on the bottom edge), each with the sheet's interior lines
|
||||||
|
* (wing ribs, folds, the rock's edges) drawn over the colour, for depth; gaps the sheet leaves open (between the
|
||||||
|
* perched dragon's legs and the rock, under the sleeping one's wing) are holes. Names keep the old
|
||||||
|
* pose keys: coiled is the diving dragon, resting the sleeping one, sitting the one perched on a rock. */
|
||||||
|
const TRACED = {
|
||||||
|
"flying": {
|
||||||
|
"body": "M6.0 55.5 L6.0 56.9 L6.7 56.9 L7.4 55.5 L10.0 53.1 L14.0 51.5 L16.8 51.0 L22.3 51.3 L28.4 52.7 L31.2 54.1 L32.9 55.7 L34.0 59.5 L33.8 62.3 L31.0 68.0 L30.7 69.9 L31.4 69.9 L32.9 67.7 L36.2 65.4 L41.1 63.7 L48.2 63.7 L56.2 65.9 L60.9 68.7 L63.2 71.0 L64.7 74.1 L64.4 76.5 L63.5 78.8 L61.6 81.2 L61.6 81.9 L62.5 81.9 L65.6 79.5 L68.7 77.9 L73.6 76.5 L77.9 76.5 L80.9 77.4 L83.7 79.3 L84.0 80.7 L84.7 80.7 L87.0 79.1 L89.9 78.4 L94.3 78.4 L96.2 79.1 L95.8 80.2 L93.2 82.6 L89.2 83.3 L89.2 83.8 L89.9 84.2 L89.4 84.7 L84.5 85.4 L84.5 85.9 L84.9 85.9 L85.4 86.4 L80.9 87.3 L80.7 88.0 L81.9 88.2 L81.4 88.7 L78.1 89.0 L77.1 89.4 L76.9 90.4 L73.8 90.6 L73.8 91.8 L68.7 92.0 L68.7 92.7 L69.6 93.0 L69.4 93.4 L66.1 93.4 L65.8 94.1 L62.3 93.9 L62.1 95.1 L58.8 94.8 L58.5 96.0 L55.2 95.5 L54.8 96.5 L51.0 96.5 L50.8 97.4 L45.8 97.4 L45.3 97.7 L45.8 98.6 L40.4 99.8 L39.5 101.0 L35.0 102.6 L34.5 103.1 L35.0 104.0 L32.4 106.2 L30.0 110.6 L30.0 113.5 L31.2 117.5 L31.0 120.1 L31.9 120.1 L32.6 118.4 L33.8 112.5 L34.3 112.3 L34.7 112.7 L35.7 112.7 L35.2 110.6 L35.2 108.0 L35.7 107.1 L38.0 105.0 L41.6 103.1 L46.3 101.7 L52.6 100.5 L62.5 99.6 L70.1 98.4 L77.9 96.5 L84.5 94.4 L84.7 94.6 L82.8 96.3 L81.6 96.5 L80.7 98.4 L80.7 99.3 L81.6 100.5 L83.5 100.7 L86.1 99.3 L92.5 92.7 L93.6 92.3 L97.4 92.0 L100.9 90.1 L100.9 91.1 L96.2 94.1 L94.3 94.1 L91.0 98.4 L88.9 100.0 L88.0 100.0 L87.5 100.5 L87.5 102.9 L88.5 103.6 L90.6 103.6 L93.2 101.7 L96.5 97.4 L99.1 96.5 L102.8 96.3 L105.2 95.3 L108.2 92.5 L109.4 90.6 L109.9 89.0 L110.6 88.2 L113.7 87.3 L117.7 84.7 L122.4 85.4 L124.5 86.1 L126.9 87.5 L128.3 89.9 L127.1 93.4 L128.3 93.2 L130.6 91.1 L134.9 88.5 L139.6 86.6 L144.5 86.4 L147.6 87.3 L149.5 88.5 L152.3 91.5 L153.5 94.8 L153.5 97.4 L153.9 97.4 L156.5 92.7 L159.4 90.1 L162.0 88.7 L167.4 87.3 L173.5 87.5 L182.9 90.4 L186.9 92.5 L189.1 94.1 L191.6 97.2 L192.6 99.3 L192.6 101.9 L193.1 101.9 L193.8 100.7 L193.8 97.2 L190.9 90.6 L188.6 86.8 L183.2 80.2 L181.0 78.1 L169.7 72.5 L163.8 70.3 L158.4 68.9 L158.0 68.2 L159.1 67.0 L161.0 66.3 L160.8 65.6 L158.2 65.9 L156.3 66.8 L153.7 69.2 L150.4 71.3 L141.7 74.8 L136.5 75.3 L132.0 76.5 L122.6 76.2 L122.4 75.8 L124.7 73.4 L126.9 72.0 L129.2 71.0 L130.6 71.0 L130.9 71.8 L131.8 72.0 L135.1 71.5 L135.8 72.2 L136.5 72.2 L137.0 71.0 L138.2 71.0 L139.3 71.5 L139.6 72.2 L140.8 72.2 L141.9 71.3 L142.2 69.4 L141.2 68.0 L139.1 67.5 L137.5 65.9 L136.3 65.4 L134.6 64.0 L127.3 61.2 L124.7 59.5 L123.8 59.5 L123.8 60.0 L127.1 64.2 L126.9 64.7 L124.7 64.2 L124.7 65.4 L121.0 65.2 L118.8 65.6 L118.8 66.1 L121.2 66.1 L121.4 66.6 L121.0 67.0 L118.1 67.0 L115.8 67.7 L115.8 68.2 L117.4 68.2 L117.7 68.7 L117.2 69.2 L113.2 69.4 L113.0 70.3 L111.3 70.6 L111.1 71.0 L106.4 69.2 L98.4 64.9 L95.8 64.0 L93.9 62.3 L92.5 59.5 L91.3 55.5 L90.8 49.8 L89.4 47.5 L88.0 46.1 L85.9 44.9 L85.2 44.9 L85.2 45.6 L87.3 47.7 L88.0 49.4 L87.7 50.6 L74.6 45.8 L63.2 42.8 L58.1 40.9 L55.9 39.7 L53.1 39.7 L52.9 40.2 L43.9 40.9 L32.2 42.8 L18.3 46.8 L9.3 51.3 L7.2 53.4 Z",
|
||||||
|
"lines": "M37.8 102.4 L36.9 102.4 L35.9 102.9 L35.4 104.5 L35.9 104.5 L37.6 103.3 Z M40.2 101.2 L42.5 100.7 L42.5 100.3 L40.9 100.3 L40.2 100.7 Z M46.3 99.3 L48.9 98.8 L48.9 98.1 L46.5 97.9 Z M193.1 97.7 L193.1 100.3 L193.5 100.3 L193.5 97.7 Z M81.6 97.7 L81.6 98.8 L82.3 98.8 L83.0 98.4 L83.0 97.9 Z M51.5 97.4 L51.5 97.9 L53.4 97.9 L53.4 97.2 L52.9 97.0 L51.9 97.0 Z M55.5 97.2 L57.1 97.0 L57.1 96.3 L55.7 96.0 Z M59.2 96.5 L60.9 96.3 L60.9 95.5 L59.5 95.3 Z M62.8 94.4 L62.8 95.8 L64.7 95.3 L64.7 94.8 Z M88.0 92.5 L84.7 93.4 L84.7 93.9 L85.6 94.1 L85.2 94.4 L85.2 95.1 L86.6 94.6 L88.0 93.2 Z M70.1 92.5 L70.1 93.7 L71.0 93.7 L71.7 93.2 L71.7 92.7 L71.3 92.5 Z M74.6 91.1 L74.6 92.3 L76.2 91.8 L76.2 91.1 Z M80.0 89.4 L77.9 89.7 L77.6 90.8 L80.0 90.1 Z M102.6 88.7 L101.6 88.7 L100.9 89.2 L100.9 89.7 L101.6 89.9 L101.6 90.8 L102.1 90.8 Z M82.3 89.0 L83.7 88.5 L84.0 87.8 L82.6 87.5 Z M85.9 85.7 L85.9 87.1 L87.5 86.4 L87.5 85.7 Z M90.3 83.8 L90.3 84.9 L91.8 84.5 L91.8 83.8 Z M110.8 71.5 L110.8 72.0 L111.5 72.2 L113.2 72.0 L113.0 71.0 L111.8 71.0 L111.5 71.5 Z M130.9 70.1 L131.3 71.3 L132.7 71.0 L132.7 70.6 Z M113.7 71.0 L115.1 71.3 L116.3 70.6 L116.3 69.9 L114.6 69.6 L114.6 70.1 L115.1 70.3 L113.7 70.6 Z M118.1 67.7 L118.1 69.2 L118.8 69.2 L119.6 68.7 L119.3 68.0 Z M121.9 65.6 L121.9 67.0 L123.8 66.8 L123.8 66.1 Z M125.9 61.4 L125.9 61.9 L127.8 63.7 L127.1 65.6 L125.7 64.9 L125.4 66.1 L127.1 66.1 L127.3 65.6 L129.4 65.9 L129.7 64.9 L130.4 65.4 L132.7 65.6 L132.5 64.5 L131.3 63.5 L127.3 61.6 Z M128.7 63.5 L129.2 63.3 L131.1 64.5 L130.6 64.7 Z M53.6 39.7 L53.6 40.7 L55.5 40.4 L55.2 39.7 Z"
|
||||||
|
},
|
||||||
|
"prowling": {
|
||||||
|
"body": "M193.7 72.8 L191.0 69.2 L189.0 69.8 L187.0 68.8 L185.3 66.8 L182.0 64.5 L180.0 64.5 L174.7 61.5 L170.7 57.5 L170.0 57.8 L170.0 58.8 L173.0 63.2 L172.7 64.2 L168.0 62.2 L164.7 59.8 L163.1 57.5 L162.1 57.5 L162.1 59.5 L163.4 61.8 L167.7 66.2 L166.7 66.8 L159.7 66.8 L159.7 67.8 L162.1 68.2 L162.4 68.8 L157.1 70.1 L155.4 71.1 L155.4 72.1 L158.7 71.8 L159.1 72.5 L155.1 74.8 L152.7 77.1 L153.1 78.1 L156.1 76.8 L156.4 77.1 L153.4 81.5 L152.7 84.8 L153.7 84.8 L155.7 82.5 L156.4 82.8 L155.4 85.1 L155.1 89.4 L156.1 89.8 L157.4 87.5 L158.1 87.8 L157.7 91.8 L157.1 92.1 L151.1 89.4 L150.1 89.4 L150.1 90.1 L149.4 90.4 L145.1 88.8 L144.1 89.1 L144.1 89.8 L144.8 90.1 L144.4 90.8 L136.1 86.5 L131.8 81.8 L130.1 78.1 L130.1 75.5 L132.4 71.1 L135.1 68.5 L137.8 69.2 L139.8 70.8 L139.8 71.5 L140.8 71.5 L140.8 69.2 L138.1 66.5 L124.8 61.2 L117.1 59.5 L113.1 59.5 L113.5 60.5 L116.8 61.2 L117.5 61.8 L95.5 62.2 L82.9 64.2 L74.2 66.8 L62.6 71.5 L53.2 76.1 L42.6 82.8 L29.3 93.1 L22.3 100.1 L19.0 104.4 L18.0 108.4 L19.0 108.4 L20.6 106.1 L24.6 102.4 L31.3 98.1 L39.6 94.4 L49.6 91.8 L53.2 91.8 L54.2 93.1 L54.2 94.4 L52.6 98.8 L47.6 105.8 L46.3 109.1 L47.3 109.1 L52.6 104.4 L58.2 101.1 L64.9 98.4 L70.2 97.4 L77.9 97.8 L83.9 100.1 L87.5 103.8 L89.5 108.7 L89.2 114.7 L90.2 114.7 L91.8 111.4 L95.2 108.1 L98.2 106.1 L101.5 104.8 L108.2 104.1 L113.1 105.4 L113.8 106.8 L109.5 108.4 L109.2 109.7 L107.5 109.7 L105.2 110.7 L105.2 111.4 L107.2 111.4 L107.2 112.4 L100.2 114.1 L99.8 115.1 L101.8 115.7 L101.2 116.4 L94.8 117.7 L94.5 118.7 L96.5 118.7 L96.5 119.7 L89.2 120.4 L89.5 121.4 L91.2 122.1 L90.5 122.7 L83.9 121.7 L83.5 122.7 L85.2 124.1 L84.9 124.4 L83.2 124.4 L78.2 122.7 L78.2 123.7 L79.2 124.7 L78.5 125.4 L74.5 123.1 L73.5 123.1 L74.2 125.1 L72.9 125.4 L69.2 122.7 L67.9 122.7 L68.9 124.7 L68.2 125.4 L63.9 122.4 L62.9 122.4 L62.9 124.7 L57.9 121.4 L57.2 121.4 L57.2 122.4 L57.9 123.1 L56.6 123.4 L51.6 120.1 L50.3 120.1 L50.6 121.7 L49.9 122.1 L43.6 119.4 L41.9 119.4 L41.9 121.1 L36.9 119.7 L33.3 119.7 L34.0 121.1 L33.6 121.4 L28.0 121.1 L27.6 122.4 L22.0 122.7 L22.0 124.1 L21.3 124.7 L19.0 124.7 L14.7 126.4 L14.7 127.4 L15.3 127.7 L15.0 128.4 L11.0 130.0 L6.0 134.4 L6.0 135.7 L8.3 134.4 L8.7 134.7 L7.0 137.7 L6.7 142.7 L7.7 143.0 L9.0 147.3 L12.0 151.0 L13.7 151.3 L13.0 149.7 L14.0 149.3 L19.3 153.7 L21.3 153.7 L21.6 152.7 L24.0 153.7 L27.0 153.7 L27.6 151.7 L29.6 151.3 L35.9 148.3 L38.9 146.0 L38.9 145.0 L36.9 145.3 L32.0 147.7 L27.6 148.7 L24.3 148.7 L24.0 148.0 L25.0 146.3 L21.6 147.0 L17.6 146.7 L15.6 145.7 L14.0 144.0 L13.0 142.0 L13.0 139.0 L14.7 136.0 L19.3 132.0 L25.6 129.0 L34.9 127.0 L43.3 127.0 L52.3 128.7 L67.6 132.7 L81.5 133.4 L89.2 132.4 L94.2 131.0 L105.2 127.0 L116.5 122.1 L116.5 124.1 L114.1 124.4 L109.8 128.0 L105.8 129.4 L102.2 140.0 L101.2 141.4 L100.2 141.4 L98.5 142.7 L97.8 144.0 L98.2 145.7 L99.8 144.7 L102.2 144.7 L103.5 145.7 L107.2 145.7 L109.2 145.0 L112.1 145.7 L112.5 144.7 L113.5 144.7 L114.8 146.3 L115.8 146.3 L116.1 144.0 L115.1 142.0 L113.5 140.4 L109.2 140.0 L108.5 139.4 L109.5 136.4 L111.5 134.0 L123.1 131.4 L125.1 130.4 L128.8 126.7 L129.1 127.0 L128.1 128.7 L123.5 132.7 L123.8 135.4 L129.8 141.7 L128.1 143.4 L127.8 145.3 L129.8 145.0 L134.4 146.0 L139.1 145.7 L139.8 146.3 L141.8 145.7 L142.4 147.3 L143.4 147.3 L143.8 144.0 L140.8 141.0 L137.4 141.0 L135.4 140.0 L132.1 136.0 L131.8 134.4 L138.1 130.7 L140.1 128.7 L143.4 122.1 L147.7 122.1 L148.1 122.7 L147.4 124.1 L148.4 125.1 L148.1 127.0 L153.4 135.7 L155.1 140.4 L154.7 143.0 L151.7 145.7 L151.4 148.0 L156.7 147.0 L159.4 148.3 L162.7 148.0 L164.1 149.0 L164.1 149.7 L165.4 149.7 L165.7 147.0 L167.4 147.0 L168.4 148.3 L169.4 148.3 L169.7 146.7 L169.0 144.7 L167.7 143.0 L166.4 142.4 L162.4 142.0 L160.7 140.0 L159.7 137.7 L157.7 125.1 L161.4 121.7 L161.7 124.4 L160.7 126.4 L160.7 127.7 L161.7 128.0 L161.7 130.0 L162.7 130.7 L163.7 132.7 L170.0 140.7 L171.4 143.7 L171.0 147.3 L174.4 146.7 L175.0 147.3 L178.7 147.3 L179.7 148.3 L180.7 148.3 L181.4 147.0 L183.0 147.7 L183.0 147.0 L183.7 146.7 L184.4 148.0 L185.3 148.0 L185.3 145.3 L183.4 142.7 L182.0 142.0 L178.0 142.0 L175.4 139.7 L172.7 134.7 L169.7 125.4 L171.0 122.1 L174.0 117.4 L174.4 113.7 L175.0 113.1 L176.0 113.1 L178.4 108.7 L178.7 105.4 L179.0 105.1 L179.7 106.4 L180.7 106.4 L181.0 101.4 L179.7 99.1 L180.0 98.4 L181.0 98.4 L181.0 96.8 L179.0 93.8 L179.0 91.8 L176.7 89.4 L176.7 87.8 L173.4 84.8 L174.0 84.1 L174.0 83.1 L173.0 82.1 L173.0 78.1 L174.0 77.5 L174.7 79.1 L176.7 79.5 L179.7 78.1 L182.7 77.8 L185.3 78.5 L188.0 80.1 L189.0 80.1 L189.3 80.8 L190.7 80.8 L191.3 77.1 L193.0 77.1 L193.7 76.5 Z",
|
||||||
|
"lines": "M24.0 151.3 L24.0 152.0 L24.6 152.3 L24.6 153.3 L26.3 153.3 L26.6 151.3 Z M19.3 151.0 L19.0 152.0 L20.0 152.7 L20.0 153.7 L20.6 153.7 L21.0 151.3 Z M21.0 148.3 L21.0 149.0 L21.6 149.3 L23.3 149.3 L23.3 147.7 L22.0 147.7 Z M11.3 146.7 L11.7 149.3 L12.3 149.3 L12.7 148.7 L14.0 148.7 L14.0 148.0 Z M8.7 139.0 L8.0 139.0 L7.3 140.4 L7.3 142.0 L8.7 142.0 L9.0 140.0 Z M11.7 132.0 L10.7 132.0 L8.7 133.0 L8.7 133.7 L9.7 134.0 L9.3 135.0 L10.0 135.0 L11.7 133.0 Z M19.0 126.4 L16.3 126.7 L16.0 128.4 L18.3 127.7 Z M79.9 124.4 L79.9 126.0 L81.5 126.0 L81.5 125.4 L80.5 124.4 Z M63.9 124.1 L63.9 125.7 L65.2 126.0 L65.6 125.7 L65.2 124.4 Z M85.9 123.4 L85.9 125.1 L87.5 124.7 L86.9 123.4 Z M57.6 124.1 L57.6 124.7 L58.9 125.1 L59.9 124.7 L59.2 123.4 Z M22.6 125.1 L25.3 124.4 L25.3 123.7 L23.0 123.4 Z M28.6 121.7 L28.6 123.4 L31.0 123.1 L31.0 122.1 Z M132.1 121.4 L131.4 121.4 L128.1 125.4 L128.1 126.0 L129.4 125.7 L129.8 126.7 L130.8 126.4 L130.8 124.4 L132.1 122.4 Z M91.8 121.4 L91.8 123.1 L93.5 122.4 L93.5 121.4 Z M51.3 121.4 L51.3 123.1 L52.9 123.4 L52.9 122.4 L52.3 121.4 Z M42.9 120.4 L42.9 122.1 L44.9 122.1 L44.6 120.7 Z M34.6 120.4 L34.6 122.1 L37.3 122.1 L37.3 121.1 L35.9 120.4 Z M97.5 118.4 L97.5 120.1 L99.2 119.4 L99.2 118.4 Z M153.7 115.1 L153.1 115.1 L152.1 116.1 L150.4 119.7 L148.7 121.1 L148.7 123.1 L149.4 123.1 L150.4 122.1 L152.4 117.7 L153.7 116.1 Z M102.5 114.4 L102.5 116.4 L103.5 116.4 L104.8 115.4 L104.8 114.7 L104.2 114.4 Z M108.2 110.7 L108.2 112.4 L109.8 112.1 L109.8 111.1 Z M176.0 110.1 L175.0 110.1 L174.4 112.4 L175.4 112.4 Z M114.1 108.4 L112.8 108.1 L111.5 108.7 L110.8 109.7 L110.1 109.7 L110.1 110.4 L113.1 110.1 L114.1 109.1 Z M176.7 106.1 L176.7 108.7 L177.4 108.7 L177.7 106.1 Z M177.7 101.8 L178.0 104.4 L180.0 104.4 L179.7 102.8 L178.7 101.8 Z M136.1 100.1 L132.1 100.1 L124.8 101.4 L123.1 103.1 L119.8 103.4 L119.1 104.8 L115.5 105.8 L114.5 105.4 L114.5 107.7 L115.5 108.1 L118.1 107.4 L118.5 106.4 L120.8 106.1 L122.8 105.1 L123.5 103.8 L127.8 103.4 L129.1 102.8 L128.8 101.8 L129.1 101.4 L133.1 101.8 L134.4 101.1 L136.1 101.1 Z M177.7 96.1 L178.4 98.8 L179.0 98.8 L179.0 98.1 L180.0 97.8 L180.0 97.1 L178.7 96.1 Z M176.0 91.1 L176.0 92.1 L177.7 94.1 L178.4 94.1 L178.4 92.8 L177.4 91.4 Z M149.7 91.1 L149.7 91.8 L152.7 93.4 L153.7 93.1 L153.7 92.4 L152.1 90.8 L151.4 90.8 L151.1 91.4 Z M145.8 90.1 L146.1 91.1 L145.1 91.4 L145.1 92.1 L147.4 93.1 L149.1 93.1 L149.1 92.4 L146.8 90.1 Z M154.7 92.1 L154.7 92.8 L157.1 94.4 L158.1 94.4 L158.7 93.8 L160.4 95.1 L161.1 95.1 L161.7 94.1 L161.7 92.1 L160.7 91.4 L160.4 89.4 L159.4 89.4 L158.4 90.4 L158.4 91.4 L159.4 91.1 L160.1 92.4 L159.4 93.1 L158.1 92.8 L157.7 93.4 Z M173.7 87.1 L173.7 88.1 L175.4 89.8 L176.0 89.8 L176.0 88.8 L174.7 87.1 Z M171.4 79.5 L171.4 81.8 L172.4 82.1 L172.0 79.5 Z M174.4 76.1 L175.4 78.5 L176.7 78.5 L177.4 77.8 L177.4 77.1 L176.4 77.1 L175.7 76.1 Z M184.0 73.8 L184.7 75.1 L188.3 76.8 L189.3 76.8 L190.0 77.5 L190.7 77.5 L191.0 76.1 L192.0 76.1 L191.7 75.1 L190.0 75.1 L189.0 74.5 L186.0 73.8 Z M192.7 73.5 L192.7 75.8 L193.7 75.8 L193.7 73.5 Z M161.1 71.1 L159.7 71.1 L159.7 73.1 L161.1 72.5 Z M163.1 67.8 L163.1 70.1 L165.4 69.5 L165.4 68.5 Z M128.8 67.8 L127.1 67.8 L120.8 70.8 L111.8 77.8 L104.2 86.1 L99.2 93.1 L97.8 96.4 L98.5 96.4 L105.5 86.5 L114.5 77.1 L121.5 71.8 L125.8 69.5 L128.8 68.5 Z M127.5 65.8 L121.1 66.2 L112.8 67.8 L101.8 71.1 L95.2 73.8 L87.2 77.8 L79.5 82.5 L68.2 90.8 L67.6 92.1 L68.2 92.1 L82.9 81.8 L94.5 75.5 L108.5 70.1 L119.5 67.5 L127.5 66.5 Z M180.0 65.2 L180.0 65.8 L181.0 66.5 L182.7 66.8 L182.7 66.2 L181.4 65.2 Z M166.7 67.5 L166.7 68.2 L167.7 68.5 L169.4 68.2 L169.7 67.5 L172.7 68.2 L172.7 67.2 L169.0 65.2 L168.4 65.2 L168.7 67.2 Z M173.7 63.2 L174.0 64.2 L173.7 65.5 L176.7 66.2 L176.7 65.2 L174.7 63.2 Z M118.1 60.8 L118.5 61.8 L118.1 63.2 L124.5 63.8 L124.5 62.8 L119.5 60.8 Z"
|
||||||
|
},
|
||||||
|
"roaring": {
|
||||||
|
"body": "M8.5 59.6 L6.0 63.9 L6.0 66.1 L7.1 66.1 L8.5 63.6 L14.9 57.5 L24.6 51.8 L27.4 51.1 L32.8 51.4 L36.4 53.2 L38.5 55.4 L40.7 60.4 L40.7 66.4 L38.2 76.1 L36.0 81.4 L34.6 90.4 L36.0 90.4 L36.4 88.2 L38.9 83.9 L46.7 76.1 L56.0 69.7 L62.8 66.8 L66.4 67.1 L68.2 68.9 L68.5 70.4 L68.2 73.9 L63.9 85.0 L63.2 88.6 L64.3 88.6 L67.5 84.7 L71.4 82.2 L75.0 81.1 L79.3 81.8 L83.6 85.4 L85.0 87.9 L86.8 94.0 L87.1 100.4 L88.2 100.0 L90.0 96.1 L93.6 92.2 L96.4 90.0 L101.1 87.9 L106.1 86.8 L111.1 87.5 L112.9 88.6 L113.2 91.5 L120.7 87.9 L121.4 88.2 L120.4 89.7 L117.2 90.7 L116.1 92.5 L111.1 94.3 L108.9 95.7 L108.9 96.5 L112.5 96.5 L106.4 99.7 L106.4 100.7 L108.9 101.1 L103.6 104.3 L103.6 105.4 L105.4 105.0 L105.7 106.1 L102.1 108.3 L100.7 110.0 L100.7 111.1 L102.5 110.8 L102.9 111.5 L97.1 114.3 L97.1 115.0 L98.9 115.4 L98.6 116.1 L92.1 117.2 L92.1 118.3 L93.9 119.0 L92.9 120.0 L86.4 119.0 L86.1 120.0 L87.8 121.5 L86.4 121.8 L81.8 119.3 L80.3 119.3 L80.3 120.4 L81.4 121.5 L81.1 122.2 L75.0 117.9 L73.9 117.9 L75.3 120.4 L75.0 121.1 L67.1 116.8 L66.0 117.2 L66.0 117.9 L66.8 118.3 L66.4 119.0 L61.4 117.2 L55.3 117.2 L55.0 118.6 L49.6 119.0 L43.5 120.8 L36.4 125.0 L33.2 129.3 L33.2 130.4 L33.9 130.8 L32.8 134.3 L33.5 140.4 L34.6 140.4 L35.0 139.0 L37.1 143.3 L41.0 147.6 L44.2 149.7 L48.5 151.5 L50.7 151.5 L51.0 150.1 L54.6 150.4 L58.9 149.7 L60.7 149.0 L60.7 147.9 L53.9 147.9 L50.0 146.9 L47.8 145.4 L48.5 144.7 L48.2 143.3 L42.8 141.8 L40.0 139.0 L38.5 135.1 L38.9 132.2 L41.4 128.3 L46.7 125.0 L54.6 123.6 L59.6 124.0 L67.5 126.1 L80.0 131.1 L86.1 132.2 L90.3 132.2 L96.4 131.1 L101.8 129.3 L113.9 121.8 L117.2 124.3 L117.2 125.8 L115.4 129.3 L112.5 132.6 L112.5 135.1 L118.2 140.4 L118.6 141.8 L117.9 144.3 L121.8 144.3 L123.6 146.5 L122.9 149.0 L123.2 150.8 L124.7 150.8 L127.5 149.4 L131.1 150.4 L134.3 149.7 L135.7 151.1 L136.1 153.6 L137.5 153.6 L138.2 151.9 L138.2 148.3 L139.3 148.3 L141.1 151.1 L142.2 151.1 L142.5 150.4 L142.2 147.2 L140.4 144.7 L136.8 142.9 L131.8 143.3 L129.0 142.2 L122.9 136.5 L121.4 134.0 L128.2 127.9 L130.0 123.6 L131.1 123.3 L133.6 120.4 L140.0 115.0 L140.7 113.3 L140.7 110.8 L138.2 105.0 L144.7 101.1 L146.1 101.8 L147.2 104.7 L148.3 105.7 L152.2 105.7 L158.6 104.0 L162.2 103.6 L165.4 106.1 L165.4 109.3 L164.3 110.0 L164.7 111.5 L167.2 111.5 L169.0 109.7 L169.7 109.7 L170.8 111.8 L170.1 114.7 L171.8 114.7 L172.9 114.0 L174.3 111.1 L175.1 111.8 L175.1 114.7 L175.8 114.7 L177.6 112.5 L177.6 110.0 L176.8 107.9 L174.7 105.4 L165.8 99.0 L154.7 97.2 L154.3 96.5 L158.3 91.8 L160.4 91.8 L162.9 92.9 L166.1 92.5 L169.7 89.0 L173.6 82.5 L176.5 79.3 L181.8 77.5 L184.3 77.5 L185.8 79.7 L185.1 81.8 L187.2 81.8 L188.3 81.1 L189.4 78.9 L190.4 79.7 L190.4 81.1 L191.9 81.1 L192.6 79.3 L192.2 77.2 L190.1 74.3 L190.8 73.9 L192.6 75.7 L193.6 75.7 L193.6 73.2 L191.9 71.1 L190.1 70.4 L184.0 70.0 L178.6 72.9 L172.6 74.3 L168.3 78.9 L163.3 82.2 L161.8 81.4 L161.8 77.2 L160.0 71.8 L153.3 63.2 L152.9 58.2 L154.0 57.5 L154.3 54.3 L156.1 53.9 L157.2 51.8 L159.7 49.6 L160.8 50.0 L160.4 52.1 L161.1 52.1 L162.9 50.3 L164.7 50.7 L166.5 50.0 L169.0 50.0 L173.3 51.4 L175.1 52.9 L175.1 53.9 L175.8 54.3 L179.0 53.9 L180.4 52.1 L180.1 50.0 L179.3 48.9 L177.6 48.9 L177.2 47.5 L175.8 47.5 L173.6 45.7 L173.3 42.5 L175.1 41.1 L179.3 40.3 L181.1 40.7 L181.5 39.6 L182.6 39.6 L183.3 38.9 L183.3 36.1 L181.8 34.6 L177.9 33.9 L174.7 35.0 L171.8 35.0 L170.8 34.3 L166.8 33.9 L162.2 31.0 L161.1 31.0 L161.5 32.8 L162.9 34.3 L162.5 35.0 L158.6 33.2 L155.8 30.3 L154.7 30.3 L154.7 31.4 L156.1 33.6 L155.8 34.3 L151.5 34.3 L148.6 35.7 L148.6 37.5 L144.7 37.8 L140.7 39.3 L140.4 40.3 L146.8 40.3 L146.1 41.1 L138.6 43.2 L135.4 45.3 L135.4 46.4 L139.0 45.3 L140.7 45.7 L134.7 49.3 L131.8 52.1 L131.8 52.9 L133.2 52.9 L136.5 51.1 L136.8 51.4 L132.2 56.8 L130.7 59.6 L130.7 60.7 L131.8 60.7 L134.0 58.2 L134.7 58.6 L131.8 63.9 L131.8 66.1 L132.5 66.1 L134.0 64.3 L134.7 64.6 L134.3 67.9 L133.2 68.2 L127.9 66.1 L126.8 66.1 L126.8 67.5 L125.7 67.9 L121.4 65.4 L113.2 57.9 L116.1 47.8 L122.2 36.1 L122.5 30.7 L121.1 27.1 L116.1 21.8 L115.4 21.8 L115.4 23.5 L118.6 28.2 L118.6 30.0 L108.9 25.0 L97.5 21.4 L90.7 18.5 L85.7 18.9 L85.7 20.0 L90.7 21.4 L91.1 22.1 L90.3 22.8 L77.1 24.3 L64.6 26.4 L56.4 28.5 L44.6 32.8 L36.4 37.1 L23.2 45.7 L14.6 52.9 Z M149.0 37.1 L149.7 36.4 L153.6 36.4 L156.1 37.5 L152.2 37.8 Z",
|
||||||
|
"lines": "M46.4 148.3 L46.4 149.0 L47.5 150.1 L50.0 150.8 L50.0 149.0 Z M45.0 144.3 L45.0 145.1 L46.0 146.1 L47.1 146.1 L47.1 144.3 Z M34.6 134.7 L33.9 136.5 L33.9 138.3 L35.7 138.3 L35.7 135.8 L35.3 134.7 Z M37.1 127.2 L36.0 127.2 L34.6 128.6 L34.6 131.1 L35.3 131.1 Z M88.6 120.8 L88.6 122.5 L90.3 122.2 L89.6 120.8 Z M76.1 120.4 L76.1 122.2 L77.5 122.5 L77.1 120.8 Z M67.5 118.3 L67.5 120.0 L70.0 120.8 L70.0 119.7 L68.9 118.6 Z M94.6 117.9 L94.6 120.0 L95.7 120.0 L97.1 119.0 L97.1 118.3 Z M56.0 118.6 L56.0 119.3 L61.0 119.3 L61.0 118.6 L59.6 117.9 L57.8 117.9 L57.5 118.6 Z M101.4 114.3 L99.6 114.3 L99.6 116.1 L100.4 116.1 L101.4 115.0 Z M131.5 112.2 L130.7 112.2 L130.0 113.3 L129.3 122.5 L130.4 122.5 L131.1 121.5 Z M106.1 107.9 L102.9 109.0 L103.6 111.5 L105.0 110.8 L106.1 109.0 Z M108.6 104.0 L107.9 103.6 L106.4 104.0 L106.4 104.7 L107.1 105.0 L106.4 106.5 L107.1 106.5 L108.6 105.0 Z M111.8 99.3 L109.3 99.3 L109.7 101.8 L110.4 101.8 L111.8 100.4 Z M144.7 96.8 L145.0 98.6 L144.7 100.4 L146.5 100.4 L146.1 98.2 L145.4 96.8 Z M115.4 95.0 L113.2 95.0 L113.6 96.1 L113.2 97.2 L113.9 97.2 L115.4 95.7 Z M119.7 91.1 L117.9 91.5 L117.2 92.9 L118.9 92.5 Z M125.7 86.1 L121.8 86.4 L122.2 89.0 L123.2 89.0 L125.7 86.8 Z M127.5 67.1 L127.2 69.3 L130.7 69.7 L130.7 68.9 L129.3 67.5 Z M136.1 65.7 L135.0 67.1 L135.0 68.2 L136.1 67.9 L136.5 68.6 L133.6 68.9 L133.6 69.7 L135.0 69.7 L137.5 70.7 L136.8 65.7 Z M136.1 61.8 L134.7 61.8 L133.6 62.9 L133.6 63.6 L135.7 63.6 Z M151.5 59.3 L151.5 61.4 L151.8 62.1 L152.5 62.1 L152.2 59.3 Z M135.4 56.1 L134.3 56.8 L134.3 57.5 L135.0 57.5 L135.4 58.6 L136.1 58.6 L136.5 56.1 Z M152.9 55.4 L151.8 55.4 L151.5 57.9 L152.9 57.1 Z M156.5 50.7 L155.8 50.7 L154.0 52.5 L154.0 53.2 L155.8 52.9 Z M139.3 49.6 L137.5 49.6 L137.5 51.8 L138.2 51.8 L139.3 50.7 Z M160.0 48.2 L160.0 48.9 L161.5 49.3 L162.5 48.9 L162.9 49.6 L165.0 49.6 L165.0 48.6 L162.9 48.9 L162.5 47.8 Z M144.3 43.6 L140.7 43.9 L140.7 44.6 L141.5 45.0 L141.5 46.1 L142.5 46.1 L144.3 44.6 Z M147.5 39.3 L147.9 40.3 L147.5 41.4 L151.1 40.7 L150.8 39.6 Z M182.2 37.8 L180.8 37.8 L180.4 38.9 L179.0 38.6 L178.6 39.6 L180.4 39.6 L180.8 38.9 L181.8 38.9 Z M105.7 37.8 L103.9 38.2 L100.0 40.3 L90.3 47.1 L80.7 56.4 L77.1 60.7 L76.8 62.1 L77.5 62.1 L81.1 57.9 L90.3 48.9 L95.7 44.6 L105.7 38.6 Z M156.8 36.4 L156.8 38.6 L159.7 38.2 L159.3 37.1 Z M163.6 33.9 L163.6 36.4 L165.4 36.4 L165.8 35.0 Z M156.8 34.3 L157.2 35.3 L159.3 35.3 L159.3 34.6 L158.3 33.9 Z M86.8 18.5 L86.8 19.3 L90.0 19.6 L90.0 18.9 L89.3 18.5 Z"
|
||||||
|
},
|
||||||
|
"sitting": {
|
||||||
|
"body": "M6.0 119.8 L6.0 131.0 L6.6 132.2 L7.5 132.2 L7.5 127.4 L9.0 121.7 L11.4 116.5 L14.8 111.4 L18.7 106.5 L25.3 100.2 L32.0 95.4 L35.9 93.5 L38.3 93.5 L41.1 96.0 L42.3 99.3 L42.3 102.6 L41.1 107.2 L41.1 109.9 L41.7 109.9 L45.0 102.6 L47.7 99.0 L51.9 94.8 L56.5 91.4 L64.9 87.2 L70.7 85.7 L74.3 85.7 L77.6 86.6 L80.7 88.1 L83.7 91.1 L85.5 94.5 L86.7 99.9 L86.4 105.0 L87.3 105.0 L89.4 98.4 L93.4 92.6 L95.8 90.5 L99.7 88.4 L103.6 87.5 L106.3 87.5 L111.8 89.6 L113.9 91.7 L114.5 94.2 L115.1 94.8 L112.1 96.6 L107.3 96.6 L107.0 97.5 L108.2 97.8 L108.2 98.7 L103.6 99.6 L103.6 100.5 L105.1 100.8 L104.5 101.7 L100.0 102.9 L99.7 104.1 L101.8 104.4 L100.9 105.3 L97.3 106.8 L97.3 107.8 L98.8 108.1 L98.5 108.7 L94.9 110.2 L94.9 111.1 L96.1 111.1 L96.4 111.7 L92.7 113.5 L92.7 114.4 L94.0 114.4 L94.3 115.0 L93.0 115.9 L90.0 116.8 L90.0 117.7 L91.2 117.7 L91.5 118.3 L90.6 119.2 L86.7 120.8 L86.7 121.4 L87.9 122.0 L86.7 123.5 L84.6 123.5 L83.1 124.1 L83.1 124.7 L84.6 125.3 L84.3 125.9 L82.5 126.8 L78.5 126.8 L78.5 127.7 L80.1 128.6 L79.1 129.5 L74.9 129.2 L74.6 130.4 L75.8 131.0 L75.2 131.9 L70.1 131.6 L70.1 132.5 L71.3 133.4 L71.0 134.1 L69.2 134.4 L65.2 133.7 L65.2 134.7 L66.1 135.3 L65.5 136.2 L60.4 135.6 L61.3 137.1 L61.0 137.7 L56.8 136.5 L56.5 137.4 L57.1 138.3 L56.2 138.6 L52.2 137.1 L51.9 138.0 L52.5 138.9 L51.6 139.2 L48.3 137.4 L47.4 137.4 L47.7 138.9 L47.1 139.2 L44.1 136.8 L43.2 136.8 L43.2 137.7 L42.6 138.0 L41.4 136.8 L40.5 134.7 L39.9 134.7 L39.5 135.6 L38.9 135.3 L38.6 134.1 L39.2 133.1 L39.2 131.6 L38.3 131.6 L38.0 131.0 L38.6 129.5 L39.2 129.2 L39.2 128.3 L42.3 125.6 L47.7 123.5 L53.2 123.5 L57.4 124.7 L60.1 126.2 L61.0 126.2 L61.0 125.3 L58.0 122.6 L53.8 121.4 L53.5 120.5 L52.5 120.1 L47.1 120.1 L45.6 120.8 L43.8 120.5 L38.6 122.6 L37.7 123.8 L36.8 123.8 L35.0 125.9 L34.1 128.9 L33.5 129.5 L32.3 129.2 L32.3 132.2 L33.2 134.4 L32.0 134.4 L31.7 135.3 L32.9 137.4 L36.8 141.3 L43.2 144.0 L47.1 144.6 L56.2 144.6 L61.0 144.0 L72.5 140.7 L82.5 136.2 L90.0 131.6 L102.7 122.6 L103.0 124.4 L101.5 128.3 L97.9 131.0 L96.1 134.4 L94.6 135.6 L92.4 135.6 L90.0 136.8 L88.2 138.6 L85.5 143.1 L81.6 144.3 L77.6 149.2 L74.3 151.3 L74.3 152.2 L76.4 152.2 L89.1 149.8 L90.3 150.4 L93.7 150.4 L95.5 149.5 L103.0 147.7 L106.6 147.7 L108.8 148.3 L113.6 147.7 L116.6 148.3 L120.6 147.4 L126.0 147.4 L129.9 146.7 L131.1 145.5 L134.2 144.3 L136.3 144.3 L140.8 146.4 L141.4 147.7 L145.0 148.9 L160.5 148.9 L164.4 149.5 L169.8 151.3 L171.0 151.3 L171.9 150.1 L173.7 149.8 L180.1 151.3 L181.0 152.2 L188.0 152.5 L190.7 153.7 L193.7 153.7 L193.7 152.5 L191.3 150.7 L190.4 148.9 L188.9 147.4 L186.7 146.4 L184.6 143.1 L183.4 142.2 L182.5 137.4 L181.6 135.9 L179.2 134.1 L175.6 132.8 L173.4 130.1 L171.6 128.9 L170.7 125.3 L166.8 121.1 L165.0 120.8 L164.1 119.8 L160.5 113.2 L154.1 107.8 L152.0 107.8 L150.8 107.2 L147.8 103.2 L145.9 99.6 L145.6 97.8 L149.0 94.2 L150.5 90.2 L151.7 89.9 L151.4 85.1 L152.3 84.8 L152.3 83.3 L151.4 80.9 L152.0 79.3 L149.6 75.7 L150.2 74.5 L147.5 71.2 L148.1 70.0 L146.5 68.2 L147.2 67.6 L147.2 66.6 L146.2 64.5 L147.5 64.2 L147.2 63.0 L148.1 62.7 L148.1 61.2 L148.7 60.6 L152.6 60.6 L153.8 59.7 L158.6 60.9 L159.2 62.1 L160.1 62.1 L161.4 60.6 L161.1 58.5 L159.5 58.2 L158.6 57.0 L156.8 56.4 L156.5 55.5 L159.8 54.9 L162.6 55.8 L162.9 55.2 L162.9 52.7 L162.0 51.5 L160.8 50.9 L157.4 50.9 L148.1 47.0 L147.2 47.0 L148.1 48.5 L147.8 49.1 L142.9 47.9 L142.3 47.9 L142.0 48.5 L140.5 48.5 L134.5 46.1 L134.5 47.3 L135.4 48.2 L140.5 51.2 L140.2 52.7 L134.5 53.0 L134.5 54.0 L137.5 54.3 L137.8 54.9 L132.9 57.0 L132.3 58.2 L135.1 58.2 L129.9 62.4 L129.9 63.0 L131.1 63.0 L132.6 62.1 L133.2 62.4 L133.2 63.0 L130.8 65.7 L130.2 67.6 L132.0 67.0 L132.3 67.3 L131.1 70.6 L131.1 72.1 L132.0 72.4 L132.9 70.9 L133.5 71.2 L132.6 73.6 L132.6 75.1 L133.9 75.4 L134.2 76.3 L135.1 76.6 L134.8 77.2 L131.7 76.0 L127.8 75.4 L121.8 73.6 L115.7 70.6 L113.0 68.2 L112.7 64.2 L113.6 60.0 L116.0 53.0 L118.4 48.5 L119.3 47.9 L120.9 48.2 L122.4 49.4 L123.0 51.2 L123.9 51.2 L124.2 50.0 L123.6 47.6 L121.8 45.8 L117.2 44.6 L116.6 44.0 L108.8 44.0 L108.2 44.6 L88.8 47.0 L79.1 48.8 L67.7 52.1 L55.9 57.6 L47.1 63.0 L39.5 68.8 L34.4 73.3 L23.8 84.5 L17.5 92.9 L13.6 99.6 L8.7 110.2 L6.9 116.2 L6.6 119.2 Z M117.5 113.8 L117.8 115.3 L116.0 118.0 L116.0 118.9 L117.2 119.8 L117.2 121.4 L114.8 122.3 L112.1 125.6 L111.5 128.3 L109.7 130.7 L107.9 131.0 L106.6 130.1 L105.7 130.1 L105.7 126.8 L110.0 118.0 L113.9 114.7 L115.7 113.8 Z M130.5 106.5 L132.3 109.3 L132.6 111.1 L133.2 111.1 L133.9 112.0 L134.2 115.3 L132.0 115.9 L130.5 114.7 L129.0 114.7 L126.0 115.9 L123.3 115.9 L123.0 114.4 L127.8 110.2 L129.0 106.8 Z M138.7 100.8 L140.2 100.8 L146.5 107.8 L146.5 109.0 L145.3 110.5 L140.8 112.9 L137.8 112.9 L137.2 112.3 L135.1 106.5 L135.1 103.8 Z",
|
||||||
|
"lines": "M191.3 152.8 L191.3 153.4 L191.9 153.7 L193.7 153.7 L193.7 153.1 Z M61.9 136.5 L61.9 138.0 L63.1 138.0 L63.4 137.1 Z M66.8 135.0 L66.8 136.5 L68.3 135.9 L68.0 135.0 Z M33.8 134.4 L33.8 135.0 L32.9 135.3 L32.9 135.9 L33.5 136.8 L35.3 137.1 L34.4 134.4 Z M34.4 130.1 L33.8 130.1 L33.2 131.0 L33.5 132.5 L34.1 132.5 Z M40.5 122.9 L39.2 123.2 L38.3 124.4 L37.7 124.4 L36.8 125.6 L36.2 125.6 L35.9 127.4 L36.5 127.4 L38.0 125.3 L40.5 123.5 Z M45.0 121.4 L43.5 121.4 L42.0 122.0 L42.0 122.9 L45.0 122.0 Z M88.5 120.8 L88.8 121.7 L88.5 122.6 L90.3 121.7 L90.3 120.8 Z M50.4 120.8 L50.4 121.7 L52.8 121.7 L52.8 121.1 Z M6.3 120.5 L6.0 129.2 L6.3 130.4 L6.9 130.4 L6.6 129.2 L6.9 120.5 Z M104.5 115.9 L103.9 115.9 L102.7 118.0 L103.0 120.8 L102.4 122.0 L103.9 122.0 L103.9 117.7 L104.5 116.8 Z M98.5 110.2 L97.0 110.2 L97.0 112.3 L97.9 112.0 L98.5 111.1 Z M100.9 106.8 L99.4 106.8 L99.4 108.7 L100.0 108.7 Z M129.6 86.0 L128.4 86.0 L122.4 89.6 L116.0 92.6 L115.4 93.2 L115.4 93.9 L116.3 94.2 L115.7 94.5 L115.7 95.4 L116.9 95.1 L121.5 91.4 L129.6 86.6 Z M149.6 78.4 L150.2 80.6 L150.8 80.6 L150.8 78.7 Z M147.5 73.3 L147.5 74.2 L148.1 75.1 L149.0 75.4 L148.4 73.3 Z M134.2 72.4 L133.5 73.3 L133.5 74.2 L134.2 74.2 L135.1 75.1 L135.1 75.7 L135.7 75.7 L135.1 72.7 Z M145.0 65.4 L145.0 67.6 L145.3 68.2 L145.9 68.2 L145.9 66.0 L145.6 65.4 Z M134.2 65.1 L132.0 65.7 L132.0 66.3 L132.9 66.6 L132.9 67.9 L133.5 67.9 Z M103.6 63.3 L102.7 63.3 L99.7 66.6 L94.6 74.2 L91.2 82.7 L89.7 89.6 L90.3 89.6 L92.4 83.0 L96.7 74.2 L100.9 67.3 L103.6 63.9 Z M133.5 60.9 L133.9 63.0 L134.5 63.0 L135.1 60.9 Z M72.8 60.9 L71.6 61.2 L68.6 63.3 L62.8 68.2 L55.0 76.6 L48.9 86.0 L45.3 94.2 L44.7 97.2 L45.3 97.2 L47.1 92.3 L49.8 86.9 L56.5 76.9 L64.9 67.9 L72.2 62.1 Z M148.4 59.4 L148.4 60.0 L149.6 59.7 L151.4 60.0 L151.4 59.1 L150.2 59.4 L149.9 58.8 L149.3 58.8 Z M137.2 57.0 L135.7 57.0 L135.7 58.8 L136.3 58.8 L137.2 57.9 Z M138.4 54.0 L138.4 55.5 L139.3 55.5 L139.9 54.3 Z M141.1 50.3 L141.1 53.4 L142.3 53.4 L142.9 52.1 L145.3 52.1 L145.0 51.2 Z M148.7 48.2 L148.7 50.0 L150.2 50.3 L150.2 49.1 L149.3 48.2 Z M109.4 44.3 L109.4 45.2 L112.7 44.6 L116.0 44.9 L116.0 44.0 Z"
|
||||||
|
},
|
||||||
|
"resting": {
|
||||||
|
"body": "M193.7 139.7 L185.5 129.8 L178.3 127.8 L180.7 125.1 L182.4 120.3 L181.4 119.9 L180.0 122.0 L179.4 121.6 L180.7 118.2 L181.1 112.1 L179.0 102.9 L178.0 102.9 L178.0 112.1 L177.3 115.2 L176.6 115.9 L176.3 109.0 L174.9 108.7 L173.9 103.6 L171.5 98.8 L170.2 98.5 L171.5 104.3 L171.2 105.0 L168.8 102.9 L168.1 99.5 L166.4 96.4 L165.1 96.4 L165.7 98.5 L165.4 100.2 L162.7 96.4 L160.3 94.4 L159.6 94.4 L159.9 96.4 L159.3 96.8 L155.5 93.0 L154.2 93.0 L154.5 94.4 L153.1 94.7 L149.4 92.4 L148.0 92.4 L148.4 93.7 L147.0 94.1 L143.3 92.4 L140.9 92.0 L141.6 93.4 L141.2 94.4 L130.3 94.7 L130.3 95.8 L131.7 96.1 L132.4 96.8 L128.3 98.5 L124.9 98.5 L124.5 100.2 L123.5 98.5 L123.5 95.1 L124.9 91.7 L128.9 86.9 L133.4 84.2 L137.8 82.8 L142.9 83.2 L150.1 85.9 L153.5 88.9 L154.5 88.9 L154.5 87.9 L153.5 85.9 L150.7 83.2 L144.6 79.8 L139.5 77.7 L129.6 75.3 L128.9 74.6 L117.4 74.6 L116.7 75.3 L91.1 79.1 L75.1 82.8 L61.9 87.6 L43.5 97.1 L27.5 108.7 L16.6 119.6 L12.5 124.7 L6.0 135.9 L6.0 146.8 L9.4 153.7 L10.8 153.7 L9.4 149.2 L9.4 146.2 L11.1 140.7 L14.5 135.3 L19.3 130.5 L21.7 129.1 L24.1 128.8 L25.1 130.5 L25.1 135.9 L25.8 137.7 L26.8 137.7 L27.1 133.9 L31.2 126.4 L36.3 121.3 L41.4 118.6 L44.5 118.6 L45.8 120.3 L45.8 121.6 L40.7 124.0 L40.4 125.4 L41.1 125.4 L41.4 126.1 L40.1 126.4 L40.1 127.1 L37.7 129.1 L37.7 130.2 L38.4 130.2 L38.7 130.8 L37.7 132.5 L37.3 134.6 L38.4 134.9 L39.7 134.2 L43.8 139.7 L46.2 141.4 L51.3 143.4 L54.0 143.1 L53.7 141.4 L51.6 139.4 L52.3 138.7 L58.4 142.1 L63.9 144.1 L73.4 146.2 L82.3 147.2 L99.0 146.8 L120.4 144.1 L134.4 144.5 L141.6 145.8 L148.0 147.9 L152.8 150.6 L155.5 153.7 L156.2 152.6 L155.5 148.6 L152.4 145.1 L147.0 142.1 L146.3 140.7 L142.2 139.4 L138.5 139.0 L138.1 138.0 L139.8 137.3 L142.9 137.3 L147.0 139.0 L149.0 139.0 L149.4 138.3 L154.5 137.7 L155.2 138.3 L155.2 139.7 L157.6 141.1 L159.6 140.0 L167.1 140.4 L174.2 142.4 L179.7 141.7 L182.8 142.1 L184.8 141.1 L187.5 142.1 L187.9 141.4 L189.6 141.4 L192.3 142.8 L193.7 142.8 Z M80.2 131.5 L86.7 130.8 L101.4 130.8 L121.5 132.2 L125.9 133.6 L130.7 133.6 L131.0 136.6 L130.3 137.3 L126.6 137.3 L126.2 135.9 L118.7 136.3 L118.4 134.9 L114.0 135.9 L111.2 135.9 L110.9 134.6 L105.1 136.3 L103.4 136.3 L103.1 134.9 L102.0 134.9 L98.0 136.6 L96.3 136.6 L95.6 134.9 L91.5 136.6 L89.4 136.6 L89.4 134.6 L83.7 135.6 L83.3 133.9 L80.2 133.6 Z M150.1 108.0 L153.1 108.0 L157.6 109.4 L162.0 113.1 L163.3 115.5 L162.7 118.9 L161.0 118.9 L158.9 116.2 L160.3 121.0 L158.9 121.3 L159.6 125.1 L158.6 126.4 L157.2 126.4 L151.8 122.7 L150.1 120.6 L150.7 117.2 L149.7 114.8 L150.1 112.8 L149.0 111.4 L149.0 108.7 Z",
|
||||||
|
"lines": "M141.9 140.4 L142.2 141.4 L146.0 142.4 L145.6 141.4 Z M6.3 136.6 L6.0 144.8 L6.3 146.2 L7.0 146.2 L7.0 142.4 L6.7 142.1 L7.0 136.6 Z M131.7 138.3 L137.5 139.4 L137.5 138.0 L135.4 137.7 L138.8 137.0 L139.2 135.9 L136.8 136.6 L135.4 135.9 L133.4 136.3 L132.7 135.3 L132.0 135.3 Z M132.7 137.3 L133.0 137.0 L135.4 137.3 L135.1 137.7 Z M41.1 128.8 L39.4 128.8 L39.4 131.2 L40.7 130.5 Z M74.1 128.5 L74.1 129.5 L75.1 130.5 L75.1 131.5 L76.2 132.2 L77.9 132.2 L78.2 133.6 L79.6 133.9 L79.6 131.2 Z M127.9 124.4 L127.9 125.1 L128.9 126.1 L136.1 128.8 L136.8 129.5 L132.4 131.5 L131.7 132.2 L131.7 134.2 L132.4 134.2 L133.4 132.9 L136.1 130.8 L137.1 130.8 L139.2 129.8 L140.9 129.8 L141.9 130.5 L146.3 130.8 L150.1 132.5 L153.1 135.6 L153.8 137.0 L155.5 137.0 L155.9 134.2 L157.6 131.5 L157.6 130.5 L158.9 127.8 L158.9 127.1 L157.2 127.1 L155.9 129.8 L148.7 130.5 L146.0 129.5 L139.2 128.8 Z M151.1 131.2 L154.5 130.8 L156.5 131.2 L155.2 132.9 L154.2 135.3 L153.5 133.9 L150.7 131.5 Z M43.8 124.4 L42.1 124.4 L42.1 126.8 L42.8 126.8 L43.8 125.4 Z M180.4 122.7 L179.0 123.3 L178.7 121.6 L178.0 121.6 L177.7 122.7 L175.9 124.4 L174.9 124.4 L174.2 125.1 L173.2 127.4 L169.5 130.5 L168.5 132.2 L168.5 132.9 L169.5 133.2 L168.8 133.9 L165.1 135.6 L163.0 135.9 L160.3 138.0 L159.6 139.4 L160.6 139.4 L164.7 136.6 L166.8 136.3 L170.8 134.2 L173.9 131.5 L177.0 130.2 L177.7 129.1 L177.7 127.4 L175.9 128.1 L175.3 129.5 L174.2 129.8 L169.8 133.2 L169.1 132.9 L170.8 130.8 L172.2 130.2 L174.2 128.1 L175.3 126.1 L178.3 125.4 L180.4 123.3 Z M149.7 121.6 L148.7 122.0 L147.7 124.4 L148.4 124.4 L149.7 123.0 Z M174.9 109.7 L174.2 109.7 L174.2 111.8 L173.2 113.5 L172.2 117.2 L170.5 119.9 L170.5 121.0 L171.9 120.3 L174.2 114.8 L174.9 115.9 L174.6 116.9 L175.3 117.2 L174.2 120.6 L175.3 120.6 L177.7 117.2 L177.7 116.5 L175.6 116.2 L175.6 114.2 L174.9 114.2 L174.6 114.8 L174.2 114.5 L174.2 113.5 L175.6 111.4 L175.6 110.4 Z M126.2 110.4 L124.2 109.0 L119.1 107.3 L110.9 107.0 L104.4 108.7 L101.4 110.1 L99.0 111.8 L97.6 110.4 L94.2 109.0 L88.4 109.0 L80.9 110.7 L69.7 114.8 L69.3 113.1 L68.7 112.4 L65.3 112.4 L60.2 114.5 L54.0 118.9 L48.6 125.1 L46.2 129.1 L45.8 127.8 L46.9 122.7 L45.8 123.0 L44.1 132.2 L44.5 134.6 L45.5 134.6 L45.8 132.5 L48.6 127.4 L52.0 123.0 L56.1 118.9 L59.8 116.2 L65.9 113.5 L68.0 113.5 L68.7 114.5 L68.7 115.9 L73.1 114.8 L75.1 115.5 L81.6 115.9 L88.1 117.9 L94.2 121.3 L97.6 124.0 L102.4 129.1 L103.7 129.5 L103.7 128.8 L99.0 123.3 L92.5 118.6 L86.4 115.9 L82.3 114.8 L75.5 114.5 L75.1 114.2 L83.0 111.4 L89.8 110.1 L94.6 110.4 L96.3 111.1 L98.3 112.8 L99.3 112.8 L105.1 109.7 L111.9 108.0 L116.7 108.0 L122.5 109.4 L125.5 111.1 L126.2 111.1 Z M168.8 104.3 L169.1 105.6 L170.2 106.0 L171.2 108.7 L170.5 113.1 L168.5 116.5 L168.5 117.2 L169.5 117.2 L171.9 112.4 L172.5 106.3 L172.2 105.6 L171.2 106.0 L170.2 105.6 L169.5 104.3 Z M125.5 99.2 L125.5 100.9 L125.2 101.2 L123.8 100.9 L123.8 101.6 L125.5 103.3 L126.6 103.3 L126.6 102.6 L125.2 101.2 L127.6 100.5 L127.9 99.5 Z M160.6 96.4 L160.6 97.1 L159.6 97.5 L159.6 98.1 L160.6 98.8 L162.0 98.8 L161.3 96.4 Z M153.8 95.4 L153.8 96.1 L156.2 96.4 L155.9 94.7 L155.2 94.7 L154.8 95.4 Z M149.0 93.4 L149.0 95.4 L150.4 95.4 L150.7 94.4 L149.7 93.4 Z M142.2 93.4 L142.2 95.1 L143.9 95.1 L143.9 94.1 Z M123.2 83.5 L119.8 84.9 L112.3 90.7 L105.8 98.1 L103.4 101.9 L102.7 103.9 L104.1 103.3 L106.1 99.8 L110.9 94.1 L117.4 87.9 L123.2 84.2 Z M86.0 83.5 L78.9 85.5 L71.1 88.9 L64.6 92.4 L56.1 97.8 L47.9 104.3 L38.7 113.5 L35.3 117.6 L34.9 118.9 L35.6 118.9 L47.6 106.7 L57.8 98.5 L69.3 91.3 L77.9 87.2 L86.0 84.2 Z M109.5 81.1 L102.7 82.5 L91.8 86.2 L80.9 91.3 L76.5 94.1 L69.3 99.2 L61.9 106.0 L55.7 113.1 L52.0 118.6 L52.0 119.3 L53.3 118.6 L59.8 110.4 L67.6 102.6 L78.5 94.4 L88.8 88.9 L98.0 85.2 L109.5 81.8 Z M118.1 75.0 L118.1 75.7 L121.8 75.7 L122.1 75.3 L128.3 75.7 L128.3 75.0 L127.2 74.6 Z"
|
||||||
|
},
|
||||||
|
"coiled": {
|
||||||
|
"body": "M193.8 52.4 L191.4 49.8 L189.5 48.6 L181.6 45.3 L171.4 42.4 L168.8 41.2 L167.1 41.0 L166.6 40.5 L158.5 40.5 L158.1 41.0 L149.3 41.4 L125.9 41.7 L124.0 42.2 L116.7 45.7 L112.4 45.7 L111.2 46.2 L111.4 46.9 L113.3 47.2 L113.8 48.1 L109.8 50.7 L96.0 56.9 L95.5 57.4 L95.5 59.5 L93.8 58.6 L93.8 59.5 L93.3 59.8 L89.8 56.4 L89.1 56.4 L89.1 57.2 L89.8 58.1 L89.5 58.3 L87.1 56.9 L86.4 56.9 L86.2 57.9 L84.5 56.7 L83.1 56.4 L83.1 57.9 L79.3 57.9 L78.8 59.3 L76.2 59.5 L76.0 60.5 L68.3 60.2 L64.1 58.6 L57.2 57.4 L54.5 55.7 L51.7 56.0 L51.7 56.7 L52.2 56.7 L52.4 57.2 L51.7 57.9 L49.5 58.6 L48.1 58.6 L46.5 57.4 L44.3 56.9 L42.2 56.9 L41.9 57.4 L41.2 56.9 L39.3 56.9 L39.3 57.6 L42.6 58.1 L44.3 59.1 L36.0 62.2 L29.1 65.5 L23.8 69.1 L16.9 75.0 L12.4 79.5 L7.4 86.7 L6.0 90.0 L6.0 94.3 L7.0 94.8 L7.4 91.9 L9.1 88.8 L12.4 85.7 L16.7 83.3 L19.1 83.3 L21.5 85.0 L22.2 86.4 L22.2 87.6 L21.5 89.0 L21.5 90.9 L21.9 90.9 L24.3 87.4 L30.3 81.9 L35.5 78.6 L41.7 75.7 L46.5 74.3 L48.8 74.3 L49.5 75.7 L50.3 76.0 L52.4 73.3 L54.8 71.7 L59.5 69.1 L63.6 67.6 L66.7 67.1 L71.9 67.1 L79.8 68.1 L80.0 68.3 L79.3 68.8 L79.5 69.8 L79.1 70.2 L76.7 70.7 L76.7 71.9 L74.1 72.1 L73.8 73.3 L71.4 73.3 L71.0 73.8 L71.0 74.8 L69.1 75.0 L69.1 75.5 L69.8 75.7 L69.3 76.4 L66.2 76.7 L66.0 77.6 L66.7 77.9 L66.2 78.3 L62.2 79.5 L61.9 80.7 L59.1 81.7 L59.1 82.9 L58.6 83.3 L56.2 84.3 L56.2 85.2 L53.1 87.1 L53.4 88.3 L49.5 92.1 L49.3 93.6 L47.2 96.7 L47.2 98.1 L46.0 101.4 L46.5 102.4 L46.0 104.3 L46.0 108.3 L46.5 110.7 L47.9 114.0 L49.1 115.7 L53.6 119.3 L54.5 119.3 L54.5 118.6 L52.6 116.4 L50.7 113.3 L49.8 110.7 L50.0 109.3 L50.7 110.0 L51.7 110.0 L49.5 104.0 L49.8 100.9 L51.7 96.2 L54.5 92.4 L61.2 86.2 L67.9 82.4 L76.7 78.8 L77.4 79.0 L76.7 80.7 L75.3 82.4 L74.8 83.6 L73.6 84.3 L73.6 85.2 L74.3 85.7 L76.4 85.7 L77.2 85.2 L84.1 77.1 L84.5 77.4 L85.7 79.8 L87.6 79.8 L89.3 78.8 L92.6 74.8 L92.9 77.6 L95.7 81.7 L96.2 83.8 L96.7 84.0 L96.7 85.2 L97.9 86.9 L99.5 87.6 L100.5 87.4 L101.2 86.7 L101.4 84.5 L100.2 82.4 L100.5 81.7 L103.3 82.4 L103.8 82.9 L104.0 84.8 L102.4 87.4 L102.4 88.8 L101.9 89.3 L102.1 90.5 L104.3 90.5 L106.2 89.3 L106.9 87.6 L108.3 79.8 L108.8 79.3 L110.7 79.5 L114.0 81.2 L117.1 84.0 L116.9 84.5 L115.9 84.3 L115.7 85.2 L118.1 86.7 L117.6 87.4 L117.1 87.4 L117.4 88.1 L119.8 88.8 L122.1 90.2 L126.2 94.0 L127.1 94.0 L126.7 92.4 L127.4 92.1 L130.7 95.7 L131.2 95.7 L132.4 94.3 L132.4 91.9 L131.4 90.5 L130.9 87.6 L130.2 86.2 L129.5 85.9 L128.3 84.5 L127.1 81.2 L125.5 79.3 L123.8 76.0 L122.8 75.7 L123.3 78.1 L122.8 78.3 L119.8 71.9 L119.0 71.9 L119.0 73.1 L119.8 74.8 L119.5 75.2 L115.9 69.5 L115.2 69.5 L115.2 70.7 L115.7 71.4 L115.2 71.7 L111.4 66.9 L110.5 66.9 L110.0 66.2 L111.2 63.1 L114.0 59.8 L116.7 58.3 L127.4 54.3 L130.7 54.3 L137.6 56.4 L140.0 58.3 L140.7 58.3 L141.4 56.9 L143.3 56.4 L158.3 56.2 L162.1 57.6 L164.3 59.5 L164.7 59.5 L165.0 58.8 L164.3 57.4 L162.1 55.3 L159.5 53.6 L158.3 52.4 L158.1 51.2 L159.0 50.0 L160.7 49.3 L168.5 48.1 L178.1 47.9 L182.1 48.3 L189.0 50.5 L190.9 51.4 L193.0 53.3 L193.8 53.3 Z",
|
||||||
|
"lines": "M47.6 99.5 L47.2 99.5 L46.7 101.7 L47.4 101.4 Z M49.3 95.2 L48.4 95.7 L47.6 97.1 L47.6 97.8 L48.4 97.6 Z M51.5 91.7 L51.0 91.7 L50.0 92.6 L50.0 93.3 L50.5 93.3 L51.5 92.4 Z M125.5 90.5 L125.7 91.7 L127.4 91.7 L127.4 91.2 L126.7 90.7 Z M6.7 90.5 L6.2 90.5 L6.0 90.9 L6.0 93.8 L6.5 93.8 L6.7 93.1 L6.5 92.4 Z M55.5 86.9 L54.5 86.9 L53.8 88.6 L55.0 88.1 Z M118.6 86.4 L118.6 87.6 L119.8 87.6 L119.8 86.9 L119.3 86.4 Z M58.1 84.3 L57.6 84.3 L56.7 85.2 L56.7 85.7 L57.4 85.7 L58.1 85.0 Z M117.6 83.8 L117.8 84.8 L117.4 85.0 L117.4 85.5 L119.0 85.7 L119.0 85.0 L118.1 83.8 Z M61.4 81.7 L59.5 82.1 L59.5 83.3 L61.2 82.6 Z M64.8 79.5 L64.1 79.5 L62.6 80.5 L62.6 81.2 L64.3 80.5 Z M122.6 78.8 L122.6 79.5 L124.3 81.4 L125.0 81.4 L124.3 78.8 L123.3 79.0 Z M97.6 77.9 L97.6 78.8 L99.3 82.4 L99.8 82.4 L99.8 81.4 L100.5 81.2 L100.5 80.7 L99.0 79.8 L98.8 79.3 L99.0 78.8 L102.1 80.0 L104.5 80.0 L107.1 79.5 L108.1 79.0 L108.1 78.6 L106.9 78.6 L103.1 79.3 L100.2 78.6 L100.0 78.3 L100.2 77.6 Z M119.0 75.7 L119.0 76.4 L120.0 77.6 L120.7 77.6 L120.5 75.7 Z M81.9 74.3 L81.2 74.3 L78.8 76.9 L77.2 77.9 L77.2 78.3 L77.6 78.3 L77.9 79.0 L79.3 78.3 L81.9 74.8 Z M95.2 73.8 L93.3 74.8 L93.3 76.0 L93.8 76.0 L95.2 74.5 Z M74.1 74.3 L71.9 73.8 L71.9 74.3 L72.4 74.5 L71.7 74.8 L71.4 75.7 L70.3 75.5 L70.3 76.7 L71.2 76.4 L71.7 75.5 L72.9 75.5 L73.8 75.0 Z M74.5 72.6 L74.5 73.8 L75.7 73.8 L76.4 73.3 L76.2 72.6 Z M115.0 72.1 L115.0 72.6 L116.7 74.3 L117.1 74.3 L116.7 72.1 Z M77.4 72.4 L79.1 71.7 L79.1 71.2 L77.6 71.0 Z M80.0 70.5 L81.4 69.8 L81.2 69.1 L81.4 68.8 L83.6 68.8 L83.6 68.3 L80.5 67.6 Z M110.2 67.4 L110.7 69.3 L111.9 70.5 L113.1 71.0 L112.6 69.3 L111.7 68.6 L111.7 68.1 L110.9 67.4 Z M105.2 65.0 L105.2 65.7 L106.2 66.2 L107.9 68.1 L109.8 69.1 L109.8 68.3 L108.8 66.9 L109.5 66.7 L109.5 66.0 L109.0 66.0 L108.8 66.9 L107.6 66.4 L106.7 65.5 Z M65.0 63.3 L62.4 63.3 L55.5 64.5 L46.7 67.6 L46.5 68.3 L55.0 65.5 L60.7 64.3 L65.0 63.8 Z M93.3 60.2 L93.3 60.7 L94.3 61.4 L95.0 61.4 L95.2 61.0 L96.9 62.9 L100.2 64.8 L101.2 64.8 L101.4 64.3 L102.1 65.0 L102.9 65.0 L102.9 64.3 L101.4 62.9 L100.0 62.2 L99.5 62.2 L99.3 63.1 L97.1 61.2 L96.7 60.0 Z M79.5 58.6 L79.5 60.0 L80.5 60.0 L80.7 59.3 L80.0 58.6 Z M89.3 58.8 L89.3 59.3 L90.5 60.0 L91.4 60.0 L90.7 58.3 L90.2 58.3 L90.0 58.8 Z M81.2 58.6 L81.4 59.3 L82.9 59.5 L82.9 58.8 L82.4 58.3 Z M86.4 58.3 L86.7 59.1 L88.3 59.3 L87.9 58.1 L86.9 57.9 Z M83.8 57.4 L84.1 58.1 L83.3 58.3 L83.3 58.8 L85.5 59.3 L85.5 58.6 L84.3 57.4 Z M159.0 40.7 L159.0 41.4 L166.2 41.2 L166.2 40.7 L165.4 40.5 Z"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const POSES = Object.fromEntries(Object.entries(TRACED).map(([k, p]) => [k, () => ({ d: [p.body], lines: p.lines, eye: [0, 0], eyeR: 0 })]));
|
||||||
|
|
||||||
|
const cache = {};
|
||||||
|
/** SVG markup for one dragon: <g> with the silhouette in `fill`, its interior lines in `ink` (lineOpacity; lines:
|
||||||
|
* false leaves them out) and, with `outline`, a hairline of that colour round the edge that stays 1px at any size.
|
||||||
|
* `dark: true` draws it like the reference sheet: a near-black body with light lines and outline. */
|
||||||
|
function svg(pose, { fill = "#2a2230", eyeFill = "#f6e6c4", flip = false, lines = true, ink = "#1b0811", lineOpacity = 0.38,
|
||||||
|
outline = null, outlineWidth = 1, outlineOpacity = 0.7, dark = false } = {}) {
|
||||||
|
if (!cache[pose]) cache[pose] = POSES[pose]();
|
||||||
|
const p = cache[pose];
|
||||||
|
if (dark) {
|
||||||
|
fill = "#16111b"; ink = "#e9e0f5"; lineOpacity = 0.6; outline = outline || "#d9cdee"; outlineOpacity = 0.85;
|
||||||
|
}
|
||||||
|
const tf = flip ? ' transform="translate(200 0) scale(-1 1)"' : "";
|
||||||
|
const edge = outline ? ` stroke="${outline}" stroke-opacity="${outlineOpacity}" stroke-width="${outlineWidth}" stroke-linejoin="round" vector-effect="non-scaling-stroke"` : "";
|
||||||
|
const body = `<g fill="${fill}" fill-rule="evenodd"${edge}>${p.d.map((d) => `<path d="${d}"/>`).join("")}</g>`;
|
||||||
|
const inner = lines && p.lines ? `<path d="${p.lines}" fill="${ink}" fill-opacity="${lineOpacity}" stroke="none"/>` : "";
|
||||||
|
const eye = p.eyeR ? `<circle cx="${f(p.eye[0])}" cy="${f(p.eye[1])}" r="${p.eyeR}" fill="${eyeFill}"/>` : "";
|
||||||
|
return `<g${tf}>${body}${inner}${eye}</g>`;
|
||||||
|
}
|
||||||
|
/* ---------- cadets and the thorn bush (same building blocks, 100 x 140 box, feet near y = 132) ---------- */
|
||||||
|
|
||||||
|
const line = (a, b, r0, r1 = r0) => tube([a, [lerp(a[0], b[0], 0.33), lerp(a[1], b[1], 0.33)], [lerp(a[0], b[0], 0.66), lerp(a[1], b[1], 0.66)], b], r0, r1, 8);
|
||||||
|
/** A cadet from joint positions; `cloak` adds a short flying cape, weapons are drawn from the hands. */
|
||||||
|
function cadet(j, { cloak = true, sword = null, dagger = null, size = 1 } = {}) {
|
||||||
|
const d = [];
|
||||||
|
if (cloak) d.push(poly([j.neck, [j.neck[0] - 4, j.neck[1] + 2], [j.hip[0] - 14 * (j.face || 1), j.hip[1] + 16], [j.hip[0] - 2 * (j.face || 1), j.hip[1] + 8], [j.neck[0] + 3, j.neck[1] + 4]]));
|
||||||
|
d.push(line(j.neck, j.hip, 7.5 * size, 6.5 * size)); // torso
|
||||||
|
d.push(line(j.hip, j.lKnee, 4.6 * size, 4 * size), line(j.lKnee, j.lFoot, 3.8 * size, 3 * size));
|
||||||
|
d.push(line(j.hip, j.rKnee, 4.6 * size, 4 * size), line(j.rKnee, j.rFoot, 3.8 * size, 3 * size));
|
||||||
|
d.push(poly([[j.lFoot[0] - 3, j.lFoot[1] - 2], [j.lFoot[0] + 7 * (j.face || 1), j.lFoot[1] - 1], [j.lFoot[0] + 7 * (j.face || 1), j.lFoot[1] + 2], [j.lFoot[0] - 3, j.lFoot[1] + 2]]));
|
||||||
|
d.push(poly([[j.rFoot[0] - 3, j.rFoot[1] - 2], [j.rFoot[0] + 7 * (j.face || 1), j.rFoot[1] - 1], [j.rFoot[0] + 7 * (j.face || 1), j.rFoot[1] + 2], [j.rFoot[0] - 3, j.rFoot[1] + 2]]));
|
||||||
|
const sh = [j.neck[0], j.neck[1] + 3];
|
||||||
|
d.push(line(sh, j.lElbow, 3.4 * size, 3), line(j.lElbow, j.lHand, 3, 2.4));
|
||||||
|
d.push(line(sh, j.rElbow, 3.4 * size, 3), line(j.rElbow, j.rHand, 3, 2.4));
|
||||||
|
d.push(ell(j.head[0], j.head[1], 7.2 * size, 8 * size, 0)); // head
|
||||||
|
d.push(ell(j.head[0] - 2 * (j.face || 1), j.head[1] - 3, 7 * size, 5 * size, 0)); // hair
|
||||||
|
d.push(line([(j.neck[0] + j.head[0]) / 2, (j.neck[1] + j.head[1]) / 2 + 2], j.neck, 3.2, 3.6)); // neck
|
||||||
|
const blade = (hand, ang, len, w) => {
|
||||||
|
const tip = [hand[0] + Math.cos(ang) * len, hand[1] + Math.sin(ang) * len];
|
||||||
|
const nx = -Math.sin(ang), ny = Math.cos(ang);
|
||||||
|
return [poly([[hand[0] + nx * w, hand[1] + ny * w], [tip[0] + nx * w * 0.4, tip[1] + ny * w * 0.4], [tip[0] + Math.cos(ang) * 4, tip[1] + Math.sin(ang) * 4], [tip[0] - nx * w * 0.4, tip[1] - ny * w * 0.4], [hand[0] - nx * w, hand[1] - ny * w]]),
|
||||||
|
line([hand[0] + nx * 6, hand[1] + ny * 6], [hand[0] - nx * 6, hand[1] - ny * 6], 1.4)];
|
||||||
|
};
|
||||||
|
if (sword) d.push(...blade(j[sword.hand], sword.ang, sword.len || 44, 1.9));
|
||||||
|
if (dagger) d.push(...blade(j[dagger.hand], dagger.ang, dagger.len || 16, 1.6));
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
const FIGURES = {
|
||||||
|
// your squadmate, braced, sword raised high
|
||||||
|
defender: () => cadet({ face: 1, head: [42, 30], neck: [44, 42], hip: [46, 84], lKnee: [36, 106], lFoot: [28, 130], rKnee: [58, 104], rFoot: [64, 130],
|
||||||
|
lElbow: [56, 50], lHand: [62, 34], rElbow: [56, 56], rHand: [62, 38] }, { sword: { hand: "lHand", ang: -1.15, len: 46 } }),
|
||||||
|
// the bigger bully, lunging with a sword
|
||||||
|
lunging: () => cadet({ face: -1, head: [56, 34], neck: [54, 46], hip: [58, 86], lKnee: [42, 104], lFoot: [30, 130], rKnee: [70, 108], rFoot: [82, 130],
|
||||||
|
lElbow: [40, 56], lHand: [26, 60], rElbow: [44, 60], rHand: [30, 64] }, { sword: { hand: "lHand", ang: Math.PI + 0.12, len: 42 }, size: 1.12 }),
|
||||||
|
// the smaller bully, dagger raised to throw
|
||||||
|
throwing: () => cadet({ face: -1, head: [50, 46], neck: [50, 57], hip: [52, 92], lKnee: [42, 110], lFoot: [36, 130], rKnee: [62, 110], rFoot: [68, 130],
|
||||||
|
lElbow: [40, 66], lHand: [36, 80], rElbow: [64, 52], rHand: [70, 38] }, { dagger: { hand: "rHand", ang: -0.9 }, size: 0.88 }),
|
||||||
|
// the wounded cadet, lying on the ground, a belt tied above the knee
|
||||||
|
lying: () => {
|
||||||
|
const d = cadet({ face: 1, head: [16, 118], neck: [26, 120], hip: [62, 122], lKnee: [80, 116], lFoot: [96, 126], rKnee: [80, 126], rFoot: [84, 128],
|
||||||
|
lElbow: [34, 108], lHand: [40, 96], rElbow: [38, 128], rHand: [52, 130] }, { cloak: false });
|
||||||
|
d.push(poly([[2, 132], [98, 132], [96, 136], [4, 136]])); // the ground line
|
||||||
|
return d;
|
||||||
|
},
|
||||||
|
// a thorn bush: arching branches with thorns and a few leaves
|
||||||
|
thorns: () => {
|
||||||
|
const d = [], R = (() => { let s = 7; return () => ((s = (s * 1103515245 + 12345) % 2147483648) / 2147483648); })();
|
||||||
|
// a low mound of leaves, then arching thorny canes
|
||||||
|
[[22, 128, 18, 9], [50, 124, 24, 12], [78, 128, 18, 9], [36, 118, 14, 8], [64, 118, 14, 8]].forEach(([x, y, rx, ry]) => d.push(ell(x, y, rx, ry, 0)));
|
||||||
|
for (let k = 0; k < 11; k++) {
|
||||||
|
const a = Math.PI * (0.08 + 0.84 * (k / 10)) + (R() - 0.5) * 0.2, len = 50 + R() * 34;
|
||||||
|
const sx = 50 + (R() - 0.5) * 24, sy = 124;
|
||||||
|
const ex = sx - Math.cos(a) * len, ey = sy - Math.sin(a) * len * 0.95;
|
||||||
|
const b = [[sx, sy], [sx - Math.cos(a) * len * 0.35, sy - Math.sin(a) * len * 0.75], [ex + Math.cos(a) * 6, ey - 10], [ex, ey + 4]];
|
||||||
|
d.push(tube(b, 2.6, 0.8, 18));
|
||||||
|
bez(b, 12).slice(2, -1).forEach((p, i) => {
|
||||||
|
const side = i % 2 ? 1 : -1, l = 3.5 + R() * 3;
|
||||||
|
d.push(poly([[p[0] - 1.2, p[1]], [p[0] + side * l, p[1] - l * 0.7], [p[0] + 1.2, p[1]]]));
|
||||||
|
if (i % 3 === 1) d.push(ell(p[0] - side * 5, p[1] - 1, 4.2, 2.2, side * 0.6));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const fcache = {};
|
||||||
|
/** SVG markup for a figure (cadets, the thorn bush) in one ink colour. */
|
||||||
|
function figure(name, { fill = "#3b2416", flip = false } = {}) {
|
||||||
|
if (!fcache[name]) fcache[name] = FIGURES[name]();
|
||||||
|
const tf = flip ? ' transform="translate(100 0) scale(-1 1)"' : "";
|
||||||
|
return `<g${tf}><g fill="${fill}">${fcache[name].map((d) => `<path d="${d}"/>`).join("")}</g></g>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { svg, figure, poses: Object.keys(POSES), figures: Object.keys(FIGURES) };
|
||||||
|
});
|
||||||
+1029
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,245 @@
|
|||||||
|
/*
|
||||||
|
* graph.js: the route graph shared by every data source.
|
||||||
|
*
|
||||||
|
* Two levels:
|
||||||
|
* 1. Scene graph (bot data): nodes are exact game scenes (fingerprints), edges are (scene, option) -> next scene
|
||||||
|
* or a terminal (BURNED, BONDED:<colour>). Chance shows up as one option leading to several scenes,
|
||||||
|
* e.g. "head toward the centre" -> a Red OR a Brown first sighting.
|
||||||
|
* 2. Decision-variable graph (all sources): the coarse variables the community form asks about
|
||||||
|
* (company, direction, first sighting, ...). trajectoryVariables() maps a bot trajectory onto it with CROSSWALK
|
||||||
|
* (written from collection/specs/bot.yaml; the Python importer uses the same file), for the bot's advisor.
|
||||||
|
*
|
||||||
|
* Trajectories keep the full ordered history of each attempt, so history-dependent (non-Markov) models can be fitted
|
||||||
|
* later without changing the data format.
|
||||||
|
*
|
||||||
|
* UMD: window.ThreshGraph in the browser, module.exports in Node. No dependencies.
|
||||||
|
*/
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof module === "object" && module.exports) module.exports = factory();
|
||||||
|
else root.ThreshGraph = factory();
|
||||||
|
})(typeof self !== "undefined" ? self : this, function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const norm = (t) => String(t || "").toLowerCase()
|
||||||
|
.replace(/[‘’‛`']/g, "'").replace(/[–—-]/g, " ")
|
||||||
|
.replace(/[^a-z0-9'\s]/g, " ").replace(/\s+/g, " ").trim();
|
||||||
|
const cap = (s) => (s ? s[0].toUpperCase() + s.slice(1).toLowerCase() : s);
|
||||||
|
|
||||||
|
/* ---------- Beta posterior and credible interval ---------- */
|
||||||
|
|
||||||
|
function logGamma(x) {
|
||||||
|
const c = [76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5];
|
||||||
|
let y = x, tmp = x + 5.5, ser = 1.000000000190015;
|
||||||
|
tmp -= (x + 0.5) * Math.log(tmp);
|
||||||
|
for (const v of c) ser += v / ++y;
|
||||||
|
return -tmp + Math.log(2.5066282746310005 * ser / x);
|
||||||
|
}
|
||||||
|
function betacf(a, b, x) {
|
||||||
|
const MAXIT = 300, EPS = 3e-14, FPMIN = 1e-300;
|
||||||
|
let qab = a + b, qap = a + 1, qam = a - 1, c = 1, d = 1 - qab * x / qap;
|
||||||
|
if (Math.abs(d) < FPMIN) d = FPMIN;
|
||||||
|
d = 1 / d; let h = d;
|
||||||
|
for (let m = 1; m <= MAXIT; m++) {
|
||||||
|
const m2 = 2 * m;
|
||||||
|
let aa = m * (b - m) * x / ((qam + m2) * (a + m2));
|
||||||
|
d = 1 + aa * d; if (Math.abs(d) < FPMIN) d = FPMIN;
|
||||||
|
c = 1 + aa / c; if (Math.abs(c) < FPMIN) c = FPMIN;
|
||||||
|
d = 1 / d; h *= d * c;
|
||||||
|
aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2));
|
||||||
|
d = 1 + aa * d; if (Math.abs(d) < FPMIN) d = FPMIN;
|
||||||
|
c = 1 + aa / c; if (Math.abs(c) < FPMIN) c = FPMIN;
|
||||||
|
d = 1 / d; const del = d * c; h *= del;
|
||||||
|
if (Math.abs(del - 1) < EPS) break;
|
||||||
|
}
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
/** Regularised incomplete beta I_x(a, b). */
|
||||||
|
function ibeta(x, a, b) {
|
||||||
|
if (x <= 0) return 0;
|
||||||
|
if (x >= 1) return 1;
|
||||||
|
const bt = Math.exp(logGamma(a + b) - logGamma(a) - logGamma(b) + a * Math.log(x) + b * Math.log(1 - x));
|
||||||
|
return x < (a + 1) / (a + b + 2) ? bt * betacf(a, b, x) / a : 1 - bt * betacf(b, a, 1 - x) / b;
|
||||||
|
}
|
||||||
|
function betaQuantile(p, a, b) {
|
||||||
|
let lo = 0, hi = 1;
|
||||||
|
for (let i = 0; i < 80; i++) {
|
||||||
|
const mid = (lo + hi) / 2;
|
||||||
|
if (ibeta(mid, a, b) < p) lo = mid; else hi = mid;
|
||||||
|
}
|
||||||
|
return (lo + hi) / 2;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Posterior for a proportion with k successes in n trials under a Beta(a0, b0) prior
|
||||||
|
* (default Jeffreys, a0 = b0 = 0.5). Returns the mean and the equal-tailed 95% credible interval.
|
||||||
|
*/
|
||||||
|
function betaPosterior(k, n, a0 = 0.5, b0 = 0.5) {
|
||||||
|
const a = a0 + k, b = b0 + n - k;
|
||||||
|
return { k, n, mean: a / (a + b), lo: betaQuantile(0.025, a, b), hi: betaQuantile(0.975, a, b) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Crosswalk: bot option text -> community form variables ---------- */
|
||||||
|
|
||||||
|
// BEGIN CROSSWALK: written by `python -m collection build` from collection/specs/bot.yaml (edit that file)
|
||||||
|
const CROSSWALK = [
|
||||||
|
[/^enter the valley alone/, "company", "Alone"],
|
||||||
|
[/^enter the valley with one of your squadmates/, "company", "1 Squadmate"],
|
||||||
|
[/^enter the valley with two of your squadmates/, "company", "2 Squadmates"],
|
||||||
|
[/^leave your squadmates?$/, "left_squadmates", true],
|
||||||
|
[/^head east toward the roar/, "direction", "East"],
|
||||||
|
[/^head west toward the scent/, "direction", "West"],
|
||||||
|
[/^head toward the center of the forest/, "direction", "Center"],
|
||||||
|
[/^go east with your squad|^convince them to head east/, "direction", "East"],
|
||||||
|
[/^go west with your squad|^convince them to head west/, "direction", "West"],
|
||||||
|
[/^keep walking the cadets are just as dangerous/, "scream", "Ignore the scream"],
|
||||||
|
[/^run and hope/, "sighting_action", "Retreat / run"],
|
||||||
|
[/hold still|hold your ground/, "sighting_action", "Hold still"],
|
||||||
|
[/lower your eyes in respect|lower your eyes and turn to face it/, "sighting_action", "Respect / face it"],
|
||||||
|
[/meeting its gaze/, "sighting_action", "Meet its gaze"],
|
||||||
|
[/^hide behind a tree|^duck behind a boulder/, "sighting_action", "Hide"],
|
||||||
|
[/^approach with confidence|^approach from the left/, "sighting_action", "Approach"],
|
||||||
|
[/^investigate the scream/, "scream_investigate", true],
|
||||||
|
[/^help your squadmate/, "scream", "Investigate & help"],
|
||||||
|
[/^play it safe and leave them/, "scream", "Investigate & leave"],
|
||||||
|
[/^pause to assess the situation/, "combat_first", "Assess the situation"],
|
||||||
|
[/^charge the other cadet/, "combat_first", "Even the numbers (smaller cadet)"],
|
||||||
|
[/^unsheathe your weapon and charge between/, "combat_first", "Put yourself in the middle (bigger cadet)"],
|
||||||
|
[/^engage the smaller cadet/, "combat_second", "Engage the smaller cadet"],
|
||||||
|
[/^daggers or not/, "combat_second", "Daggers or not (protect squadmate)"],
|
||||||
|
[/^end the lives of the bullies/, "resolution", "Killed the bullies yourself"],
|
||||||
|
[/^allow your squadmate to exact/, "resolution", "Squadmate's revenge"],
|
||||||
|
[/^leave the bullies alive/, "resolution", "Left bullies to the dragons"],
|
||||||
|
[/tourniquet/, "resolution", "Tourniquet"],
|
||||||
|
[/leave (them|him|her) to die|^keep going clearly they've been found lacking/, "resolution", "Left injured cadet"],
|
||||||
|
[/take (their|his|her|the cadet's) weapons?/, "resolution", "Took their weapons"],
|
||||||
|
[/^walk toward the east/, "post_path", "East"],
|
||||||
|
[/^walk toward the west/, "post_path", "West"],
|
||||||
|
[/^walk farther into the forest/, "post_path", "Forest"],
|
||||||
|
[/^continue toward the center of the valley/, "hour", "Valley"],
|
||||||
|
[/^find the tallest tree/, "hour", "Tree"],
|
||||||
|
[/^there's no way this is your dragon/, "branch", "Passed the Red: meadow"],
|
||||||
|
[/^this is your dragon and it's time to start bonding/, "branch", "Valley Red"],
|
||||||
|
[/^descend quickly/, "branch", "Descend quickly: Red"],
|
||||||
|
[/^climb down slowly to pursue the green/, "branch", "Descend slowly: two Greens"],
|
||||||
|
[/^reds are too hot tempered/, "red", "Let it pass (two Greens)"],
|
||||||
|
[/^jump (now|in a few seconds)/, "red", "Jump onto the Red"]
|
||||||
|
];
|
||||||
|
// END CROSSWALK
|
||||||
|
|
||||||
|
/** Map one bot trajectory onto the form's decision variables. Unmapped choices are listed, not guessed. */
|
||||||
|
/**
|
||||||
|
* The steps that were actually played. The bot logs a pick it then overrode (its own rules against the atlas's
|
||||||
|
* advice) as a step whose `to` is not where the run went, followed by the pick it made on the same screen. Those
|
||||||
|
* superseded picks are dropped. A step without `to` (a run in progress) is kept unless the next step is on the
|
||||||
|
* same screen.
|
||||||
|
*/
|
||||||
|
function playedSteps(steps) {
|
||||||
|
return (steps || []).filter((s, i) => !(i + 1 < steps.length && steps[i + 1].scene != null && steps[i + 1].scene === s.scene && s.to !== steps[i + 1].scene));
|
||||||
|
}
|
||||||
|
|
||||||
|
function trajectoryVariables(traj) {
|
||||||
|
const vars = {}, unmapped = [];
|
||||||
|
for (const s of playedSteps(traj.steps)) {
|
||||||
|
const t = norm(s.optionText);
|
||||||
|
const hit = CROSSWALK.find(([re]) => re.test(t));
|
||||||
|
if (hit) { if (!(hit[1] in vars)) vars[hit[1]] = hit[2]; }
|
||||||
|
else unmapped.push(s.optionText);
|
||||||
|
// first sighting = the first tinted scene after the direction choice
|
||||||
|
if (vars.direction && !vars.first_sighting && s.tint) vars.first_sighting = cap(s.tint);
|
||||||
|
}
|
||||||
|
const o = traj.outcome || {};
|
||||||
|
vars.outcome = o.type === "BONDED" ? "Bonded" : o.type === "BURNED" ? "Incinerated" : "No outcome recorded";
|
||||||
|
vars.outcome_color = o.type === "BONDED" && o.colour ? cap(o.colour) : null;
|
||||||
|
return { vars, unmapped };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A coded community-form run (engine.codeRow output) in the same shape. */
|
||||||
|
function formRunVariables(run) {
|
||||||
|
const keep = ["company", "left_squadmates", "direction", "first_sighting", "sighting_action", "scream", "combat_first", "combat_second", "resolution", "post_path", "hour", "branch", "outcome", "outcome_color"];
|
||||||
|
const vars = {};
|
||||||
|
for (const k of keep) vars[k] = run[k] == null ? null : run[k];
|
||||||
|
return vars;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Decision-variable graph (all sources) ---------- */
|
||||||
|
|
||||||
|
const VAR_STAGES = ["company", "direction", "first_sighting", "scream", "resolution", "post_path", "hour", "branch"];
|
||||||
|
// "(no fork)" is a real state (that path has no fork), but it is not a choice node, so it is skipped too
|
||||||
|
const MISSING = new Set([null, undefined, "", "Unknown", "Unsure", "Unsure/unknown", "Multiple", "(no fork)", "(not recorded)", "(not asked)", "(not asked/blank)", "Unknown/lost count"]);
|
||||||
|
|
||||||
|
function endLabel(v) {
|
||||||
|
if (v.outcome === "Bonded") return v.outcome_color ? `Bonded ${v.outcome_color}` : "Bonded (colour unknown)";
|
||||||
|
if (v.outcome === "Incinerated" || v.outcome === "Died before the hour") return "Incinerated";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* records: [{ source, vars }]. Returns nodes keyed "stage=value" and edges between consecutive KNOWN stages,
|
||||||
|
* each with total and per-source counts, plus P(next | this) with a Beta credible interval.
|
||||||
|
*/
|
||||||
|
function buildVariableGraph(records, stages = VAR_STAGES) {
|
||||||
|
const nodes = {}, edges = {};
|
||||||
|
const bump = (obj, key, src, init) => {
|
||||||
|
const x = obj[key] || (obj[key] = Object.assign({ n: 0, bySource: {} }, init));
|
||||||
|
x.n++; x.bySource[src] = (x.bySource[src] || 0) + 1;
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
for (const { source, vars } of records) {
|
||||||
|
const path = [];
|
||||||
|
for (const st of stages) if (!MISSING.has(vars[st])) path.push(`${st}=${vars[st]}`);
|
||||||
|
const end = endLabel(vars);
|
||||||
|
if (end) path.push(`end=${end}`);
|
||||||
|
path.forEach((id, i) => {
|
||||||
|
const [stage, value] = id.split("=");
|
||||||
|
bump(nodes, id, source, { stage, value });
|
||||||
|
if (i) bump(edges, `${path[i - 1]}>${id}`, source, { from: path[i - 1], to: id });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const out = {};
|
||||||
|
for (const e of Object.values(edges)) (out[e.from] = out[e.from] || []).push(e);
|
||||||
|
for (const [from, list] of Object.entries(out)) {
|
||||||
|
const tot = list.reduce((s, e) => s + e.n, 0);
|
||||||
|
for (const e of list) e.p = betaPosterior(e.n, tot);
|
||||||
|
nodes[from].out = tot;
|
||||||
|
}
|
||||||
|
return { stages: stages.concat("end"), nodes, edges: Object.values(edges) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Scene graph (bot) ---------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* scenes: catalogue { id: { stage, tint, label, options: [{ id, text }] } }; trajs: bot trajectories.
|
||||||
|
* For every scene option: how often it was taken, where it led, P(incinerated) and P(survived) with
|
||||||
|
* credible intervals. Options never taken are kept and marked untested.
|
||||||
|
*/
|
||||||
|
function buildSceneGraph(scenes, trajs) {
|
||||||
|
const g = {};
|
||||||
|
for (const [id, s] of Object.entries(scenes)) {
|
||||||
|
g[id] = { id, stage: s.stage, tint: s.tint, label: s.label, visits: 0, options: {} };
|
||||||
|
for (const o of s.options) g[id].options[o.id] = { id: o.id, text: o.text, n: 0, to: {}, bySource: {}, intentionalBurns: 0 };
|
||||||
|
}
|
||||||
|
for (const t of trajs) {
|
||||||
|
for (const s of playedSteps(t.steps)) {
|
||||||
|
const node = g[s.scene] || (g[s.scene] = { id: s.scene, stage: s.stage, tint: s.tint, label: s.stage, visits: 0, options: {} });
|
||||||
|
node.visits++;
|
||||||
|
const o = node.options[s.option] || (node.options[s.option] = { id: s.option, text: s.optionText, n: 0, to: {}, bySource: {}, intentionalBurns: 0 });
|
||||||
|
o.n++;
|
||||||
|
o.bySource[t.source] = (o.bySource[t.source] || 0) + 1;
|
||||||
|
const to = s.to || "UNKNOWN";
|
||||||
|
o.to[to] = (o.to[to] || 0) + 1;
|
||||||
|
if (to === "BURNED" && t.outcome && t.outcome.intentional) o.intentionalBurns++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const node of Object.values(g)) {
|
||||||
|
for (const o of Object.values(node.options)) {
|
||||||
|
const burns = o.to.BURNED || 0;
|
||||||
|
const known = o.n - (o.to.UNKNOWN || 0);
|
||||||
|
o.untested = o.n === 0;
|
||||||
|
o.pBurn = known ? betaPosterior(burns, known) : null;
|
||||||
|
o.chance = Object.keys(o.to).filter((k) => k !== "BURNED" && k !== "UNKNOWN").length > 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { betaPosterior, betaQuantile, ibeta, CROSSWALK, trajectoryVariables, playedSteps, formRunVariables, VAR_STAGES, buildVariableGraph, buildSceneGraph, norm };
|
||||||
|
});
|
||||||
+759
@@ -0,0 +1,759 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Threshing Route Atlas</title>
|
||||||
|
<meta name="claude:viewport-fit-sides" content="cover">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Marcellus&family=Josefin+Sans:wght@400;600&family=Alegreya+Sans:ital,wght@0,400;0,500;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap">
|
||||||
|
<style>
|
||||||
|
/* Layout: a field atlas — one wide route chart flanked by narrow reading columns; numbers set in mono, dragons carry their own colours. */
|
||||||
|
/* Layout: a dusk-lit field atlas — arched, deco-framed panels on deep plum; gold line work; each dragon tints its own frame; deaths turn steel and ember. Single dark world by design. */
|
||||||
|
:root {
|
||||||
|
color-scheme: dark;
|
||||||
|
--bg: #170911; --surface: #210f19; --raised: #2a1420; --ink: #f6e8d6; --muted: #cba890; --faint: #8e7069; --line: #4b2a36;
|
||||||
|
--accent: #e8b483; --accent-ink: #1d0a12; --good: #8fc98a; --warn: #f0a55a; --bad: #ef6b6b;
|
||||||
|
--dr-red: #e8435e; --dr-green: #3fc0a8; --dr-orange: #ff9533; --dr-brown: #d1a47a; --dr-blue: #7ea6ff; --dr-black: #e0d8ea; /* checked for colour-blind separation (see docs/COLOURS.md) */ --dr-any: #e0a9c6;
|
||||||
|
--link-low: #4f2f3c; --death: #9fb6c3; --ember: #e3692f; --death-bg: #1b0811; --frame: var(--accent);
|
||||||
|
--font-display: "Marcellus", "Iowan Old Style", Georgia, serif;
|
||||||
|
--font-crest: "Marcellus", "Iowan Old Style", Georgia, serif;
|
||||||
|
--font-label: "Josefin Sans", "Gill Sans", "Trebuchet MS", sans-serif;
|
||||||
|
--font-body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
|
||||||
|
--font-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
|
||||||
|
--hero-bg: #1a0912; --hero-bg2: #3a1526; --hero-ink: #f6e8d6; --hero-muted: #d2b096; --hero-line: #6b4148;
|
||||||
|
--map-ground: #2a1420; --map-ground2: #34192a; --map-forest: #4b2b3b; --map-forest2: #3b2030; --map-rock: #5e3d4a; --map-water: #6f90a5; --map-path: #e8b483; --map-label: #f6e8d6; --map-halo: #1c0a13;
|
||||||
|
--step--1: 0.84rem; --step-0: 1rem; --step-1: 1.18rem; --step-2: 1.6rem; --step-3: 2.3rem; --radius: 10px;
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: var(--step-0); line-height: 1.55; }
|
||||||
|
.wrap { max-width: 1260px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0; }
|
||||||
|
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; line-height: 1.15; text-wrap: balance; margin: 0; }
|
||||||
|
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
|
||||||
|
h2 { font-size: var(--step-2); }
|
||||||
|
h3 { font-size: var(--step-1); font-family: var(--font-body); font-weight: 600; }
|
||||||
|
p { margin: 0; max-width: 68ch; }
|
||||||
|
a { color: var(--accent); }
|
||||||
|
code, .num, .mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
|
||||||
|
.eyebrow { font-family: var(--font-data); font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
|
||||||
|
.muted { color: var(--muted); }
|
||||||
|
.small { font-size: var(--step--1); }
|
||||||
|
|
||||||
|
header.top { border-bottom: 1px solid var(--line); background: var(--surface); }
|
||||||
|
header.top .wrap { display: grid; gap: 14px; padding-block: 28px 22px; }
|
||||||
|
.title-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
|
||||||
|
.lede { color: var(--muted); max-width: 72ch; }
|
||||||
|
.data-status { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: var(--step--1); color: var(--muted); align-items: center; }
|
||||||
|
.data-status b { color: var(--ink); font-weight: 600; }
|
||||||
|
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--raised); font-size: var(--step--1); white-space: nowrap; }
|
||||||
|
.data-status .pill { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
|
||||||
|
.data-status > span { min-width: 0; overflow-wrap: anywhere; }
|
||||||
|
.pill.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); color: var(--warn); }
|
||||||
|
|
||||||
|
nav.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--step--1); }
|
||||||
|
nav.toc a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; }
|
||||||
|
nav.toc a:hover, nav.toc a:focus-visible { color: var(--ink); border-bottom-color: var(--accent); }
|
||||||
|
|
||||||
|
main { display: grid; gap: 44px; padding-block: 30px 60px; }
|
||||||
|
section { display: grid; gap: 16px; scroll-margin-top: 16px; }
|
||||||
|
.section-head { display: grid; gap: 6px; }
|
||||||
|
|
||||||
|
/* controls */
|
||||||
|
.controls { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: end; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
|
||||||
|
.ctl { display: grid; gap: 4px; min-width: 0; }
|
||||||
|
.ctl label, .ctl .lbl { font-size: var(--step--1); color: var(--muted); }
|
||||||
|
select, input[type="number"], button, .filebtn, .btnlike { font: inherit; font-size: var(--step--1); color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px; }
|
||||||
|
input[type="number"] { width: 5.5em; }
|
||||||
|
button, .filebtn, .btnlike { cursor: pointer; }
|
||||||
|
.btnlike { display: inline-block; text-decoration: none; }
|
||||||
|
button:hover, .filebtn:hover { border-color: var(--accent); }
|
||||||
|
button:focus-visible, select:focus-visible, input:focus-visible, .filebtn:focus-within, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||||
|
button.primary, a.btnlike.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
|
||||||
|
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
|
||||||
|
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
|
||||||
|
.seg button:last-child { border-right: 0; }
|
||||||
|
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
|
||||||
|
.check { display: inline-flex; gap: 6px; align-items: center; font-size: var(--step--1); }
|
||||||
|
|
||||||
|
.targets { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||||
|
.tchip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--raised); font-size: var(--step--1); cursor: pointer; }
|
||||||
|
.tchip .sw { width: 11px; height: 11px; border-radius: 50%; background: var(--c, var(--faint)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent); }
|
||||||
|
.tchip[aria-pressed="true"] { border-color: var(--c, var(--ink)); box-shadow: inset 0 0 0 1px var(--c, var(--ink)); font-weight: 600; }
|
||||||
|
.tchip.featured { padding: 7px 14px; font-size: var(--step-0); }
|
||||||
|
.target-group { display: grid; gap: 6px; }
|
||||||
|
|
||||||
|
/* map */
|
||||||
|
.map-shell { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); overflow: hidden; }
|
||||||
|
.map-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
|
||||||
|
.cond-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
|
||||||
|
.cchip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 4px 2px 9px; border: 1px solid var(--accent); color: var(--ink); border-radius: 999px; font-size: var(--step--1); background: color-mix(in srgb, var(--accent) 10%, var(--raised)); }
|
||||||
|
.cchip button { border: 0; background: transparent; padding: 0 6px; line-height: 1; font-size: 1rem; color: var(--muted); }
|
||||||
|
.map-scroll { overflow-x: auto; }
|
||||||
|
#map { display: block; }
|
||||||
|
#map text { font-family: var(--font-body); font-size: 11px; fill: var(--ink); }
|
||||||
|
#map .stage-label { font-family: var(--font-data); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--muted); }
|
||||||
|
#map .stage-chance { fill: var(--accent); }
|
||||||
|
#map .node rect { stroke: color-mix(in srgb, var(--ink) 40%, transparent); stroke-width: 0.6; cursor: pointer; }
|
||||||
|
#map .node.sel rect { stroke: var(--accent); stroke-width: 2.4; }
|
||||||
|
#map .node.dim { opacity: 0.35; }
|
||||||
|
#map .link { mix-blend-mode: normal; }
|
||||||
|
#map .link:hover { opacity: 1 !important; }
|
||||||
|
#map .node:focus-visible rect { stroke: var(--accent); stroke-width: 3; }
|
||||||
|
.map-foot { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; padding: 14px; border-top: 1px solid var(--line); background: var(--surface); }
|
||||||
|
@media (max-width: 820px) { .map-foot { grid-template-columns: minmax(0, 1fr); } }
|
||||||
|
.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.ramp { width: 150px; height: 10px; border-radius: 3px; border: 1px solid var(--line); }
|
||||||
|
.sel-summary { display: grid; gap: 6px; font-size: var(--step--1); }
|
||||||
|
.sel-summary .big { font-family: var(--font-data); font-size: var(--step-2); color: var(--ink); }
|
||||||
|
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--raised); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: var(--step--1); box-shadow: 0 6px 20px rgba(0,0,0,0.18); max-width: 300px; }
|
||||||
|
#tip .t { font-weight: 600; }
|
||||||
|
|
||||||
|
/* cards & grids */
|
||||||
|
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; }
|
||||||
|
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 18px; }
|
||||||
|
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; min-width: 0; align-content: start; }
|
||||||
|
.panel h3 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
|
||||||
|
.chart { width: 100%; overflow-x: auto; }
|
||||||
|
.chart svg { display: block; width: 100%; max-width: 760px; min-width: 540px; height: auto; }
|
||||||
|
.chart svg text { font-family: var(--font-body); font-size: 11px; fill: var(--ink); }
|
||||||
|
.chart svg .axis text { fill: var(--muted); font-family: var(--font-data); font-size: 10px; }
|
||||||
|
.chart svg .axis line, .chart svg .grid line { stroke: var(--line); }
|
||||||
|
|
||||||
|
.findings { display: grid; gap: 12px; counter-reset: f; }
|
||||||
|
.finding { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
|
||||||
|
.finding .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-data); font-size: 11px; color: var(--accent-ink); background: var(--muted); }
|
||||||
|
.finding.blue .mark { background: var(--dr-blue); color: #fff; }
|
||||||
|
.finding.black .mark { background: var(--dr-black); color: var(--bg); }
|
||||||
|
.finding.bias .mark { background: var(--warn); color: #fff; }
|
||||||
|
.finding.lead .mark { background: var(--accent); }
|
||||||
|
.finding p + p { margin-top: 4px; }
|
||||||
|
.finding .tag { font-family: var(--font-data); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
|
||||||
|
|
||||||
|
/* tables */
|
||||||
|
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
|
||||||
|
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
|
||||||
|
th, td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
|
||||||
|
th { font-weight: 600; color: var(--muted); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
|
||||||
|
th[data-sort] { cursor: pointer; }
|
||||||
|
th[data-sort]:hover { color: var(--ink); }
|
||||||
|
td.num, th.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||||
|
tr.sig td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
|
||||||
|
tr.thin td { color: var(--faint); }
|
||||||
|
.route-cell { min-width: 280px; }
|
||||||
|
.cibar { display: inline-block; position: relative; width: 90px; height: 10px; vertical-align: middle; }
|
||||||
|
.cibar i { position: absolute; top: 4px; height: 2px; background: var(--muted); }
|
||||||
|
.cibar b { position: absolute; top: 1px; width: 2px; height: 8px; background: var(--ink); }
|
||||||
|
.qbadge { font-family: var(--font-data); font-size: 10.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); }
|
||||||
|
.qbadge.s { border-color: var(--accent); color: var(--accent); }
|
||||||
|
|
||||||
|
.method { display: grid; gap: 14px; }
|
||||||
|
.method p, .method li { max-width: 74ch; }
|
||||||
|
.method ul, .method ol { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
|
||||||
|
.formula { font-family: var(--font-data); font-size: var(--step--1); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 4px; overflow-x: auto; white-space: pre; }
|
||||||
|
details.fold { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
|
||||||
|
details.fold > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
|
||||||
|
details.fold > div { padding: 0 14px 14px; display: grid; gap: 10px; }
|
||||||
|
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||||
|
#srcview { white-space: pre; overflow: auto; max-height: 420px; font-family: var(--font-data); font-size: 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 10px; }
|
||||||
|
.toast { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; font-size: var(--step--1); z-index: 60; }
|
||||||
|
.loading { padding: 40px 0; color: var(--muted); }
|
||||||
|
footer { border-top: 1px solid var(--line); padding-block: 22px 40px; color: var(--muted); font-size: var(--step--1); }
|
||||||
|
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
|
||||||
|
|
||||||
|
/* ---------- hero, tabs, overview, valley map, gallery ---------- */
|
||||||
|
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--hero-bg); }
|
||||||
|
.hero { background: radial-gradient(120% 140% at 70% 0%, var(--hero-bg2), var(--hero-bg) 60%); color: var(--hero-ink); position: relative; overflow: hidden; }
|
||||||
|
.hero .wrap { position: relative; z-index: 1; display: grid; gap: 14px; padding-block: 34px 0; }
|
||||||
|
.hero-art { position: absolute; inset: auto 0 0 0; height: 100%; width: 100%; z-index: 0; pointer-events: none; }
|
||||||
|
.hero h1 { font-family: var(--font-crest); font-weight: 700; font-size: clamp(1.9rem, 4.6vw, 3.1rem); letter-spacing: 0.04em; color: var(--hero-ink); }
|
||||||
|
.hero .kicker { font-family: var(--font-data); font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase; color: var(--hero-muted); }
|
||||||
|
.hero .tagline { color: var(--hero-muted); max-width: 60ch; font-size: var(--step-1); }
|
||||||
|
.hero .unofficial { display: inline-block; font-size: var(--step--1); color: var(--hero-muted); border: 1px solid var(--hero-line); border-radius: 999px; padding: 2px 10px; width: fit-content; }
|
||||||
|
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-top: 18px; scrollbar-width: none; }
|
||||||
|
.tabs::-webkit-scrollbar { display: none; }
|
||||||
|
.tab { font-family: var(--font-crest); font-weight: 700; letter-spacing: 0.06em; font-size: 0.9rem; color: var(--hero-muted); background: transparent; border: 0; border-radius: 8px 8px 0 0; padding: 12px 16px 11px; white-space: nowrap; cursor: pointer; border-top: 2px solid transparent; }
|
||||||
|
.tab:hover { color: var(--hero-ink); }
|
||||||
|
.tab[aria-selected="true"] { background: var(--bg); color: var(--ink); border-top-color: var(--accent); }
|
||||||
|
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||||
|
.tabpanel { display: grid; gap: 44px; }
|
||||||
|
.tabpanel > section, .tabpanel > section > * { min-width: 0; }
|
||||||
|
select { max-width: 100%; }
|
||||||
|
.tabpanel[hidden] { display: none !important; }
|
||||||
|
section h2 { font-family: var(--font-crest); letter-spacing: 0.03em; }
|
||||||
|
|
||||||
|
.odds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
|
||||||
|
.odd { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; align-content: start; position: relative; overflow: hidden; }
|
||||||
|
.odd .big { font-family: var(--font-crest); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--c, var(--ink)); }
|
||||||
|
.odd .what { font-weight: 600; }
|
||||||
|
.odd .how { font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.odd-low { border-style: dashed; }
|
||||||
|
.odd-low .big { opacity: 0.85; }
|
||||||
|
.odd svg { display: block; width: 100%; max-width: 220px; height: auto; }
|
||||||
|
.odd::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--line)); }
|
||||||
|
.combo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
|
||||||
|
.combo .odd { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; }
|
||||||
|
|
||||||
|
.journey { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 0; counter-reset: st; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
|
||||||
|
.stop { padding: 14px; display: grid; gap: 6px; align-content: start; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
|
||||||
|
.stop .n { font-family: var(--font-crest); font-weight: 700; color: var(--accent); font-size: 1.3rem; }
|
||||||
|
.stop .t { font-weight: 600; }
|
||||||
|
.stop .d { font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.stop .verdict { font-size: var(--step--1); border-top: 1px dashed var(--line); padding-top: 6px; }
|
||||||
|
.stop.roll .n::after { content: " · roll"; font-family: var(--font-data); font-size: 10px; letter-spacing: 0.1em; color: var(--muted); }
|
||||||
|
.truths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
|
||||||
|
.truth { padding: 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
|
||||||
|
.truth h3 { font-family: var(--font-crest); font-size: 1.05rem; letter-spacing: 0.02em; }
|
||||||
|
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
|
||||||
|
.cta button { font-size: var(--step-0); padding: 9px 16px; }
|
||||||
|
.lore { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; color: var(--muted); font-size: var(--step--1); max-width: 70ch; }
|
||||||
|
|
||||||
|
.valley-shell { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--map-ground); }
|
||||||
|
.valley-wrap { overflow-x: auto; }
|
||||||
|
#valley { display: block; width: 100%; min-width: 820px; height: auto; background: #d9b07a; }
|
||||||
|
#valley .loc { cursor: pointer; }
|
||||||
|
#valley .loc:focus-visible circle.ring { stroke: var(--accent); stroke-width: 4; }
|
||||||
|
#valley text { font-family: var(--font-body); }
|
||||||
|
#valley .place { font-family: var(--font-crest); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; fill: var(--map-label); paint-order: stroke; stroke: var(--map-halo); stroke-width: 4px; stroke-linejoin: round; }
|
||||||
|
#valley .sub { font-size: 12px; fill: var(--map-label); opacity: 0.85; paint-order: stroke; stroke: var(--map-halo); stroke-width: 3px; }
|
||||||
|
#valley .trail { fill: none; stroke-linecap: round; }
|
||||||
|
#valley .flow { fill: none; stroke-linecap: round; stroke-dasharray: 2 14; animation: march 1.6s linear infinite; }
|
||||||
|
@keyframes march { to { stroke-dashoffset: -32; } }
|
||||||
|
@media (prefers-reduced-motion: reduce) { #valley .flow { animation: none; } }
|
||||||
|
.valley-foot { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; padding: 14px; border-top: 1px solid var(--line); background: var(--surface); }
|
||||||
|
@media (max-width: 820px) { .valley-foot { grid-template-columns: minmax(0, 1fr); } }
|
||||||
|
.loc-card { display: grid; gap: 6px; font-size: var(--step--1); }
|
||||||
|
.loc-card h3 { font-family: var(--font-crest); font-size: 1.1rem; }
|
||||||
|
.bars { display: grid; gap: 4px; }
|
||||||
|
.bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 96px; gap: 8px; align-items: center; font-size: var(--step--1); }
|
||||||
|
.bar i { display: block; height: 10px; border-radius: 3px; background: var(--c, var(--muted)); min-width: 2px; }
|
||||||
|
.bar span:last-child { text-align: right; font-family: var(--font-data); white-space: nowrap; }
|
||||||
|
|
||||||
|
.gallery { display: grid; gap: 22px; }
|
||||||
|
.gal-group { display: grid; gap: 10px; }
|
||||||
|
.gal-group h3 { font-family: var(--font-crest); display: flex; gap: 10px; align-items: center; font-size: 1.15rem; }
|
||||||
|
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr)); gap: 10px; }
|
||||||
|
.dcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 6px; justify-items: center; text-align: center; position: relative; }
|
||||||
|
.dcard svg { width: 64px; height: 64px; }
|
||||||
|
.dcard .nm { font-family: var(--font-crest); font-weight: 700; font-size: 1rem; letter-spacing: 0.03em; overflow-wrap: anywhere; }
|
||||||
|
.dcard .meta { font-size: 12px; color: var(--muted); line-height: 1.35; }
|
||||||
|
.dcard .age { position: absolute; top: 34px; right: 16px; font-family: var(--font-data); font-size: 11px; color: var(--muted); }
|
||||||
|
.viewtoggle { display: inline-flex; }
|
||||||
|
|
||||||
|
/* ---------- dusk & gold theme layer ---------- */
|
||||||
|
body { background: radial-gradient(140% 90% at 50% -10%, #2b0f1f 0%, var(--bg) 55%) fixed, var(--bg); }
|
||||||
|
.eyebrow, .kicker, .lbl, .tab, .tchip, button, .filebtn, th, .stage-label { font-family: var(--font-label); letter-spacing: 0.12em; text-transform: uppercase; }
|
||||||
|
.eyebrow { font-size: 0.72rem; color: var(--accent); }
|
||||||
|
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; }
|
||||||
|
h2 { font-size: var(--step-2); letter-spacing: 0.04em; }
|
||||||
|
.panel h3, .truth h3, .gal-group h3, .loc-card h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.03em; }
|
||||||
|
button, .filebtn, .btnlike { border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--raised) 80%, #000); color: var(--ink); font-size: 0.74rem; padding: 8px 16px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35), 0 0 12px rgba(232,180,131,0.08); }
|
||||||
|
button:hover, .filebtn:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35), 0 0 14px rgba(232,180,131,0.25); }
|
||||||
|
button.primary { background: var(--accent); color: var(--accent-ink); }
|
||||||
|
select, input[type="number"], input[type="search"] { background: var(--raised) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: 8px !important; }
|
||||||
|
.seg { border-radius: 999px; border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
|
||||||
|
.seg button { border-radius: 0; box-shadow: none; }
|
||||||
|
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
|
||||||
|
.tchip { border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 55%, var(--line)); background: color-mix(in srgb, var(--raised) 85%, #000); font-size: 0.72rem; padding: 7px 14px; }
|
||||||
|
.tchip[aria-pressed="true"] { background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--raised)); box-shadow: 0 0 14px color-mix(in srgb, var(--c, var(--accent)) 35%, transparent), inset 0 0 0 1px var(--c, var(--accent)); }
|
||||||
|
.tchip.featured { font-size: 0.8rem; }
|
||||||
|
|
||||||
|
/* deco frame: double line + sunburst corners, tinted by --frame */
|
||||||
|
.deco { position: relative; border: 1px solid color-mix(in srgb, var(--frame) 75%, transparent); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px color-mix(in srgb, var(--frame) 40%, transparent); }
|
||||||
|
.deco::before, .deco::after { content: ""; position: absolute; width: 46px; height: 46px; pointer-events: none; background: var(--frame); opacity: 0.55;
|
||||||
|
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 46'%3E%3Cg stroke='black' stroke-width='1' fill='none'%3E%3Cpath d='M2 2 L44 9 M2 2 L40 16 M2 2 L35 22 M2 2 L29 28 M2 2 L22 35 M2 2 L16 40 M2 2 L9 44'/%3E%3Cpath d='M2 14 A12 12 0 0 0 14 2' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E") no-repeat;
|
||||||
|
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 46'%3E%3Cg stroke='black' stroke-width='1' fill='none'%3E%3Cpath d='M2 2 L44 9 M2 2 L40 16 M2 2 L35 22 M2 2 L29 28 M2 2 L22 35 M2 2 L16 40 M2 2 L9 44'/%3E%3Cpath d='M2 14 A12 12 0 0 0 14 2' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E") no-repeat; }
|
||||||
|
.deco::before { top: 6px; left: 6px; }
|
||||||
|
.deco::after { bottom: 6px; right: 6px; transform: rotate(180deg); }
|
||||||
|
.panel, .odd, .truth, .finding, .controls, .map-shell, .valley-shell, .journey, .dcard, .tbl-wrap { border-color: color-mix(in srgb, var(--frame) 30%, var(--line)); }
|
||||||
|
.panel, .odd, .truth { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--frame) 8%), var(--surface)); }
|
||||||
|
.controls { background: color-mix(in srgb, var(--surface) 80%, #000); }
|
||||||
|
.odd::before { display: none; }
|
||||||
|
.odd { border-radius: 120px 120px 14px 14px / 60px 60px 14px 14px; padding-top: 26px; text-align: center; justify-items: center; }
|
||||||
|
.odd .big { font-family: var(--font-display); font-weight: 400; text-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent); }
|
||||||
|
.combo .odd { border-radius: 14px; text-align: left; justify-items: start; }
|
||||||
|
.truth { border-radius: 14px; }
|
||||||
|
table { background: transparent; }
|
||||||
|
th { background: color-mix(in srgb, var(--surface) 70%, #000); color: var(--accent); font-size: 0.7rem; }
|
||||||
|
td { border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent); }
|
||||||
|
.tbl-wrap { background: color-mix(in srgb, var(--raised) 60%, var(--bg)); }
|
||||||
|
.formula { background: var(--death-bg); border-left-color: var(--accent); }
|
||||||
|
#tip { background: #2a1420; border-color: var(--accent); box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 12px rgba(232,180,131,0.15); }
|
||||||
|
.toast { background: var(--accent); color: var(--accent-ink); }
|
||||||
|
.pill { background: color-mix(in srgb, var(--raised) 70%, #000); }
|
||||||
|
.lore { border-left-color: var(--accent); font-style: italic; }
|
||||||
|
|
||||||
|
/* hero: arched title card over a dusk forest */
|
||||||
|
.hero { background: radial-gradient(90% 120% at 50% 0%, var(--hero-bg2), var(--hero-bg) 70%); }
|
||||||
|
.hero .wrap { justify-items: center; text-align: center; padding-block: 28px 0; }
|
||||||
|
.arch { --frame: var(--accent); position: relative; padding: 34px clamp(18px, 5vw, 64px) 26px; border-radius: 260px 260px 18px 18px / 150px 150px 18px 18px; border: 1px solid color-mix(in srgb, var(--accent) 80%, transparent);
|
||||||
|
box-shadow: inset 0 0 0 5px rgba(26,9,18,0.9), inset 0 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 40px rgba(0,0,0,0.45);
|
||||||
|
background: radial-gradient(70% 80% at 50% 40%, rgba(40,10,26,0.92), rgba(22,7,15,0.95)); display: grid; gap: 10px; justify-items: center; max-width: 760px; width: 100%; }
|
||||||
|
.arch .crest { width: 120px; height: 34px; margin-top: -8px; }
|
||||||
|
.hero h1 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; font-size: clamp(1.7rem, 5vw, 3rem); text-shadow: 0 0 22px rgba(232,180,131,0.25); }
|
||||||
|
.hero .kicker { font-family: var(--font-label); color: var(--accent); letter-spacing: 0.22em; font-size: 0.7rem; }
|
||||||
|
.hero .tagline { color: var(--hero-muted); font-size: var(--step-1); }
|
||||||
|
.hero .unofficial { border-color: var(--hero-line); color: var(--hero-muted); }
|
||||||
|
.tabs { justify-content: flex-start; gap: 6px; margin-top: 22px; padding-bottom: 14px; flex-wrap: nowrap; width: fit-content; max-width: 100%; }
|
||||||
|
.tab { border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); padding: 9px 16px; font-size: 0.7rem; color: var(--hero-muted); background: rgba(20,6,13,0.6); border-top-width: 1px; }
|
||||||
|
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 16px rgba(232,180,131,0.35); }
|
||||||
|
.embers { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
|
||||||
|
.embers i { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 8px var(--ember); opacity: 0; animation: rise linear infinite; }
|
||||||
|
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 0.9; } 100% { transform: translateY(-340px) translateX(20px); opacity: 0; } }
|
||||||
|
@media (prefers-reduced-motion: reduce) { .embers i { animation: none; opacity: 0.5; bottom: auto; } }
|
||||||
|
|
||||||
|
/* death palette: steel frame, ember glow */
|
||||||
|
.death { --frame: var(--death); background: radial-gradient(80% 90% at 50% 30%, #2a0b19, var(--death-bg)) !important; color: #efe6f2; }
|
||||||
|
.death .big { color: #efe6f2 !important; text-shadow: 0 0 22px rgba(227,105,47,0.45), 0 0 4px rgba(255,255,255,0.4) !important; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; }
|
||||||
|
.death .how, .death p { color: #c8bcc9; }
|
||||||
|
|
||||||
|
.arch::before { top: auto; bottom: 6px; left: 6px; transform: rotate(270deg); }
|
||||||
|
.odds { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
|
||||||
|
@media (max-width: 600px) { .hero .tagline { font-size: var(--step-0); } }
|
||||||
|
/* dragon-tinted frames */
|
||||||
|
.dcard { --frame: var(--dc, var(--accent)); border-radius: 60px 60px 12px 12px / 34px 34px 12px 12px; border: 1px solid color-mix(in srgb, var(--frame) 60%, transparent); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px color-mix(in srgb, var(--frame) 30%, transparent); padding-top: 16px; }
|
||||||
|
.dcard .nm { font-family: var(--font-display); font-weight: 400; }
|
||||||
|
.gal-group h3 { color: var(--ink); }
|
||||||
|
.loc-card { --frame: var(--lc, var(--accent)); }
|
||||||
|
.valley-shell { --frame: var(--vt, var(--accent)); border-color: color-mix(in srgb, var(--frame) 60%, transparent); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px color-mix(in srgb, var(--frame) 40%, transparent), 0 0 30px color-mix(in srgb, var(--frame) 15%, transparent); }
|
||||||
|
#panel-rare .panel:nth-child(odd) { --frame: var(--dr-blue); }
|
||||||
|
#panel-rare .panel:nth-child(even) { --frame: var(--dr-black); }
|
||||||
|
.stop .n { font-family: var(--font-display); font-weight: 400; color: var(--accent); }
|
||||||
|
.journey { background: color-mix(in srgb, var(--surface) 85%, #000); }
|
||||||
|
footer { border-top-color: var(--line); }
|
||||||
|
|
||||||
|
/* the valley explorer (landing page) */
|
||||||
|
.explorer { gap: 0; }
|
||||||
|
.ex-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface);
|
||||||
|
--frame: var(--vt, var(--accent)); border-color: color-mix(in srgb, var(--frame) 55%, transparent); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px color-mix(in srgb, var(--frame) 35%, transparent), 0 0 36px color-mix(in srgb, var(--frame) 14%, transparent); transition: box-shadow .3s; }
|
||||||
|
@media (max-width: 980px) { .ex-shell { grid-template-columns: minmax(0, 1fr); } }
|
||||||
|
.ex-map-wrap { position: relative; overflow-x: auto; background: #d9b07a; }
|
||||||
|
#ex-map { display: block; width: 100%; min-width: 720px; height: auto; }
|
||||||
|
#ex-map text { font-family: var(--font-body); }
|
||||||
|
.ex-dragon { cursor: pointer; transition: opacity .25s; }
|
||||||
|
.ex-dragon:focus-visible, .ex-mark:focus-visible, .ex-alt:focus-visible { outline: none; filter: drop-shadow(0 0 4px #fff); }
|
||||||
|
.ex-mark, .ex-alt { cursor: pointer; }
|
||||||
|
.ex-hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; background: color-mix(in srgb, #1d0a12 78%, transparent); color: #f6e6c4; font-family: var(--font-label); letter-spacing: .14em; text-transform: uppercase; font-size: .72rem; pointer-events: none; white-space: nowrap; }
|
||||||
|
.ex-tip { position: absolute; z-index: 3; max-width: 260px; padding: 8px 10px; border-radius: 8px; background: #fbf0d6; color: #3b2416; font-size: 13px; line-height: 1.35; box-shadow: 0 4px 18px #0006; pointer-events: none; }
|
||||||
|
.ex-panel { position: relative; border-left: 1px solid var(--line); }
|
||||||
|
.ex-scroll { position: absolute; inset: 0; overflow: auto; display: grid; gap: 12px; align-content: start; padding: 18px; }
|
||||||
|
@media (max-width: 980px) { .ex-panel { border-left: 0; border-top: 1px solid var(--line); } .ex-scroll { position: static; } }
|
||||||
|
.ex-panel h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; margin: 0; }
|
||||||
|
.ex-choose { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
|
||||||
|
.ex-dchip { display: grid; justify-items: center; gap: 2px; padding: 6px 4px 8px; 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); font-size: .68rem; }
|
||||||
|
.ex-dchip svg { width: 58px; height: 46px; }
|
||||||
|
.ex-dchip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 22%, var(--raised)); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 35%, transparent), inset 0 0 0 1px var(--c); }
|
||||||
|
.ex-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
|
||||||
|
.ex-toggle { display: flex; gap: 8px; align-items: center; font-size: var(--step--1); color: var(--muted); }
|
||||||
|
.ex-layers { display: grid; gap: 4px; margin: 4px 0 0 24px; }
|
||||||
|
.ex-layer { display: grid; grid-template-columns: auto 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: var(--step--1); color: inherit; cursor: pointer; }
|
||||||
|
.ex-layer.none { color: var(--muted); cursor: default; }
|
||||||
|
.ex-layer .sw { height: 0; border-top: 4px solid var(--sw); border-radius: 2px; }
|
||||||
|
.ex-layer .n { color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||||
|
.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 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-inside + .ex-inside { margin-top: 8px; }
|
||||||
|
.ex-inside .ex-roll { display: block; font-style: italic; }
|
||||||
|
.ex-fulltree ul { list-style: disc; }
|
||||||
|
.ex-fulltree li.best { font-weight: 600; }
|
||||||
|
.ex-fulltree li.pale { opacity: 0.7; font-style: italic; }
|
||||||
|
.ex-fulltree li.roll { list-style: none; }
|
||||||
|
.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 h2 { color: var(--c); }
|
||||||
|
.ex-place { cursor: pointer; }
|
||||||
|
.ex-place:hover text, .ex-place:focus-visible text { text-decoration: underline; fill-opacity: 1; }
|
||||||
|
.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-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 .nm { display: grid; font-weight: 700; color: var(--c); min-width: 0; }
|
||||||
|
.ex-from-row .nm small { font-weight: 400; color: var(--muted); }
|
||||||
|
.ex-from-row b { font-size: 1.1rem; }
|
||||||
|
.ex-from-row i { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--w); background: var(--c); }
|
||||||
|
.ex-from-row.off { opacity: .55; }
|
||||||
|
.ex-from-row.off small { grid-column: 3; color: var(--muted); }
|
||||||
|
button.ex-from-row:hover { border-color: var(--c); }
|
||||||
|
.ex-close { width: 32px; height: 32px; border-radius: 50%; padding: 0; font-size: 1.1rem; line-height: 1; }
|
||||||
|
.ex-routes { display: grid; gap: 8px; }
|
||||||
|
.ex-route-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-family: var(--font-body); text-transform: none; letter-spacing: normal; font-size: var(--step--1); }
|
||||||
|
.ex-route-card.on { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
|
||||||
|
.ex-route-card .nm { font-family: var(--font-display); font-size: 1rem; }
|
||||||
|
.ex-route-card .nm em { font-style: normal; color: var(--muted); font-size: .8rem; }
|
||||||
|
.ex-route-card b { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; }
|
||||||
|
.ex-route-card small { grid-column: 2 / 4; color: var(--muted); }
|
||||||
|
.ex-swatch { grid-row: 1 / 3; width: 30px; height: 0; border-top: 6px solid var(--c); }
|
||||||
|
.ex-swatch.dashed { border-top-style: dashed; } .ex-swatch.dotted { border-top-style: dotted; }
|
||||||
|
.ex-key { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
|
||||||
|
.ex-key span { display: inline-block; width: 22px; border-top: 4px solid var(--muted); }
|
||||||
|
.ex-key .dashed { border-top-style: dashed; } .ex-key .dotted { border-top-style: dotted; }
|
||||||
|
.ex-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
|
||||||
|
.ex-steps li { border-radius: 8px; }
|
||||||
|
.ex-steps li.chance { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 6px 10px; border: 1px dashed var(--line); font-size: var(--step--1); }
|
||||||
|
.ex-steps li.chance small { grid-column: 1 / 3; color: var(--muted); font-family: var(--font-data); }
|
||||||
|
.ex-step { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; width: 100%; text-align: left; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-family: var(--font-body); text-transform: none; letter-spacing: normal; font-size: var(--step--1); }
|
||||||
|
.ex-step small { grid-column: 1 / 3; color: var(--muted); font-family: var(--font-data); }
|
||||||
|
.ex-steps li.open .ex-step { border-color: var(--accent); }
|
||||||
|
.ex-opts { display: grid; gap: 2px; padding: 6px 0 4px 10px; }
|
||||||
|
.ex-opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; text-align: left; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-family: var(--font-body); text-transform: none; letter-spacing: normal; font-size: var(--step--1); }
|
||||||
|
.ex-opt:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
|
||||||
|
.ex-opt.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
|
||||||
|
.ex-opt b { font-family: var(--font-data); }
|
||||||
|
.ex-opt .rec { font-style: normal; font-size: 9.5px; font-family: var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--bg); background: var(--accent); border-radius: 999px; padding: 1px 6px; margin-left: 4px; }
|
||||||
|
.ex-why summary { cursor: pointer; font-family: var(--font-label); letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; color: var(--accent); }
|
||||||
|
.ex-why { display: grid; gap: 6px; }
|
||||||
|
.linklike { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; text-transform: none; letter-spacing: normal; cursor: pointer; }
|
||||||
|
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; width: fit-content; }
|
||||||
|
.seg button { border: 0; border-radius: 0; background: transparent; padding: 7px 13px; color: var(--muted); font-size: 0.7rem; }
|
||||||
|
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, var(--raised)); color: var(--ink); }
|
||||||
|
|
||||||
|
/* the odds, per dragon */
|
||||||
|
.odds-colours { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||||
|
@media (max-width: 900px) { .odds-colours { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||||||
|
@media (max-width: 560px) { .odds-colours { grid-template-columns: minmax(0, 1fr); } }
|
||||||
|
.odd-colour { color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
|
||||||
|
.odd-colour:hover, .odd-colour:focus-visible { transform: translateY(-2px); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 30%, transparent); }
|
||||||
|
.odd-art { width: 110px; height: 88px; max-width: none; }
|
||||||
|
.odd .go { font-family: var(--font-label); letter-spacing: .12em; text-transform: uppercase; font-size: .68rem; color: var(--c); }
|
||||||
|
.ladder { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: grid; gap: 10px; }
|
||||||
|
.ladder ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
|
||||||
|
.ladder li { display: grid; grid-template-columns: 70px minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: var(--step--1); }
|
||||||
|
.ladder li i { display: block; height: 10px; border-radius: 4px; width: var(--w); background: var(--c); }
|
||||||
|
.ladder li b { font-family: var(--font-data); text-align: right; }
|
||||||
|
.combo { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
|
||||||
|
/* prose uses the full width of its column (it looked cramped on wide screens) */
|
||||||
|
p, .lede, .lore, .method p, .method li { max-width: none; }
|
||||||
|
footer p + p { margin-top: 8px; }
|
||||||
|
a { color: var(--accent); text-underline-offset: 2px; }
|
||||||
|
/* methods as tabs */
|
||||||
|
.mtabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
|
||||||
|
.mtab { border-radius: 999px; padding: 7px 14px; font-size: .7rem; background: transparent; }
|
||||||
|
.mtab[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 22%, var(--raised)); border-color: var(--accent); color: var(--ink); }
|
||||||
|
.mpanel { padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
|
||||||
|
.mpanel[hidden] { display: none; }
|
||||||
|
.mpanel h3 { margin: 0; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<header class="hero">
|
||||||
|
<svg class="hero-art" id="hero-art" viewBox="0 0 1200 420" preserveAspectRatio="xMidYMax slice" aria-hidden="true"></svg>
|
||||||
|
<div class="embers" id="embers" aria-hidden="true"></div>
|
||||||
|
<div class="wrap">
|
||||||
|
<div class="arch deco">
|
||||||
|
<svg class="crest" viewBox="0 0 120 34" aria-hidden="true"><g fill="none" stroke="#e8b483" stroke-width="1.1"><path d="M4 20 H44 M76 20 H116"/><path d="M60 4 L68 17 L60 30 L52 17 Z"/><path d="M60 10 L64 17 L60 24 L56 17 Z" fill="#e8b483"/><path d="M44 20 C50 12, 54 12, 52 17 M76 20 C70 12, 66 12, 68 17"/><circle cx="4" cy="20" r="2" fill="#e8b483"/><circle cx="116" cy="20" r="2" fill="#e8b483"/></g></svg>
|
||||||
|
<span class="kicker">Basgiath · Riders Quadrant · Threshing</span>
|
||||||
|
<h1>Threshing Route Atlas</h1>
|
||||||
|
<p class="tagline" id="hero-tagline">Every path through the valley, mapped from the runs riders logged.</p>
|
||||||
|
<span class="unofficial">Unofficial fan atlas for readers of Rebecca Yarros's <i>Fourth Wing</i> · not affiliated with Dragonkind</span>
|
||||||
|
</div>
|
||||||
|
<nav class="tabs" role="tablist" aria-label="Atlas pages">
|
||||||
|
<button class="tab" role="tab" id="tab-valley" aria-controls="panel-valley" aria-selected="true">The Valley</button>
|
||||||
|
<button class="tab" role="tab" id="tab-odds" aria-controls="panel-odds" aria-selected="false">The Odds</button>
|
||||||
|
<button class="tab" role="tab" id="tab-dragons" aria-controls="panel-dragons" aria-selected="false">The Dragons</button>
|
||||||
|
<button class="tab" role="tab" id="tab-deep" aria-controls="panel-deep" aria-selected="false">Deep Dive</button>
|
||||||
|
<button class="tab" role="tab" id="tab-data" aria-controls="panel-data" aria-selected="false">Data & Methods</button>
|
||||||
|
<button class="tab" role="tab" id="tab-report" aria-controls="panel-report" aria-selected="false">Report a run</button>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="wrap">
|
||||||
|
<main>
|
||||||
|
<div class="tabpanel" id="panel-valley" role="tabpanel" aria-labelledby="tab-valley">
|
||||||
|
<section id="valley-sec" aria-labelledby="h-valley" class="explorer">
|
||||||
|
<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-hint" id="ex-hint">Pick a dragon, or a key moment</div>
|
||||||
|
<div class="ex-tip" id="ex-tip" hidden></div>
|
||||||
|
</div>
|
||||||
|
<aside class="ex-panel" id="ex-panel" aria-live="polite"></aside>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="tabpanel" id="panel-odds" role="tabpanel" aria-labelledby="tab-odds" hidden>
|
||||||
|
<section id="overview" aria-label="The odds">
|
||||||
|
<div class="odds" id="odds"></div>
|
||||||
|
<div class="odds odds-colours" id="odds-colours"></div>
|
||||||
|
</section>
|
||||||
|
<section aria-labelledby="h-journey">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Seven steps, and the rolls remember what you did</span>
|
||||||
|
<h2 id="h-journey">How a run unfolds</h2>
|
||||||
|
</div>
|
||||||
|
<div class="journey" id="journey"></div>
|
||||||
|
<div class="panel black-panel" id="black-evidence" hidden></div>
|
||||||
|
<p class="lore">In the books, first-years who survive to Threshing walk into a valley of unbonded dragons, and the dragons do the choosing. The <a href="https://dragonkind.com" target="_blank" rel="noopener">Dragonkind</a> site recreates that: every choice can end with you incinerated, and its author has said no single roll is worse than 1 in 20 and that the Black is not luck.</p>
|
||||||
|
<div class="cta"><button type="button" class="primary" data-go="valley">Walk the valley map</button><button type="button" data-go="deep">Dig into the statistics</button><button type="button" data-go="dragons">Meet the bonded dragons</button></div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="tabpanel" id="panel-dragons" role="tabpanel" aria-labelledby="tab-dragons" hidden>
|
||||||
|
<section id="register" aria-labelledby="h-register">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Bonded dragons, as riders registered them</span>
|
||||||
|
<h2 id="h-register">The bonded dragons</h2>
|
||||||
|
<p class="muted small">Every bonded dragon we could collect, sorted by colour, then tail, then lineage, then oldest first. Most come from ClumsyBadger's Unofficial Dragon Register form, and the rest from dragonkind.com result pages linked in the megathreads. Rider names and photos are left out. Misspelled lineages are corrected when they are within two letters of a lineage seen at least three times for the same colour. The original spelling is kept in the notes.</p>
|
||||||
|
</div>
|
||||||
|
<div class="data-status" id="reg-status"></div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>Colour × tail</h3><div class="tbl-wrap" id="reg-matrix"></div></div>
|
||||||
|
<div class="panel"><h3>Lineages</h3><div class="tbl-wrap" id="reg-lineages" style="max-height:340px"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="ctl"><label for="reg-colour">Colour</label><select id="reg-colour"></select></div>
|
||||||
|
<div class="ctl"><label for="reg-tail">Tail</label><select id="reg-tail"></select></div>
|
||||||
|
<div class="ctl"><label for="reg-lineage">Lineage</label><select id="reg-lineage"></select></div>
|
||||||
|
<div class="ctl"><label for="reg-sex">Sex</label><select id="reg-sex"></select></div>
|
||||||
|
<div class="ctl"><label for="reg-q">Search names</label><input id="reg-q" type="search" placeholder="Dragon or lineage" style="font:inherit;font-size:var(--step--1);padding:6px 10px;border:1px solid var(--line);border-radius:5px;background:var(--raised);color:var(--ink)"></div>
|
||||||
|
<div class="ctl"><span class="lbl">View</span><div class="seg" id="reg-view"><button type="button" data-v="cards" aria-pressed="true">Cards</button><button type="button" data-v="table" aria-pressed="false">Table</button></div></div>
|
||||||
|
<div class="btnrow" style="align-self:end"><button type="button" id="reg-copy">Copy as CSV</button><label class="filebtn" for="reg-upload">Load a newer register export…<input id="reg-upload" type="file" accept=".xlsx,.csv" hidden></label></div>
|
||||||
|
<span class="small muted" id="reg-count" style="align-self:center"></span>
|
||||||
|
</div>
|
||||||
|
<div class="gallery" id="reg-gallery"></div>
|
||||||
|
<div class="tbl-wrap" id="reg-table" style="max-height:640px" hidden></div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="tabpanel" id="panel-deep" role="tabpanel" aria-labelledby="tab-deep" hidden>
|
||||||
|
<section id="map-sec" aria-labelledby="h-map">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Interactive</span>
|
||||||
|
<h2 id="h-map">Route map</h2>
|
||||||
|
<p class="muted small">Pick an outcome to colour every step by how often runs through it reached that outcome. Hover or tap a box or band for its numbers. To follow one route step by step, use <a href="#valley">The Valley</a>.</p>
|
||||||
|
</div>
|
||||||
|
<div class="controls" id="map-controls">
|
||||||
|
<div class="target-group">
|
||||||
|
<span class="lbl small muted">Bond a dragon</span>
|
||||||
|
<div class="targets" id="targets-rare"></div>
|
||||||
|
</div>
|
||||||
|
<div class="target-group">
|
||||||
|
<span class="lbl small muted">Rare sightings</span>
|
||||||
|
<div class="targets" id="targets-other"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="ctl"><span class="lbl">Band width shows</span>
|
||||||
|
<div class="seg" id="width-mode"><button type="button" data-v="traffic" aria-pressed="true">How many runs</button><button type="button" data-v="prob" aria-pressed="false">Chance of outcome</button></div></div>
|
||||||
|
<div class="ctl"><label for="minn">Grey out steps with fewer runs than</label><select id="minn"></select></div>
|
||||||
|
<div class="ctl"><label for="f-preset">Runs</label><select id="f-preset"></select></div>
|
||||||
|
</div>
|
||||||
|
<div class="map-shell deco">
|
||||||
|
<div class="map-top">
|
||||||
|
<div class="btnrow"><button type="button" id="btn-best">Show top routes for this outcome</button></div>
|
||||||
|
</div>
|
||||||
|
<div class="map-scroll"><svg id="map" role="img" aria-label="Route map"></svg></div>
|
||||||
|
<div class="map-foot">
|
||||||
|
<div class="legend" id="legend"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="best-routes"></div>
|
||||||
|
</section>
|
||||||
|
<section id="bondrates" aria-labelledby="h-dragons">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Statistics · all six colours</span>
|
||||||
|
<h2 id="h-dragons">Every dragon: how often the attempt ends in a bond</h2>
|
||||||
|
<p class="muted small">A run counts here when the player reached that dragon's bonding encounter and the form shows Bonded or Incinerated. Many players die on purpose to reroll, which drags the raw rate down. "Wanted it" keeps only runs where the player said they were after that colour, or any dragon.</p>
|
||||||
|
</div>
|
||||||
|
<div class="chart panel" id="ch-encounters"></div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>The two Greens</h3><div id="green-rescue"></div></div>
|
||||||
|
<div class="panel"><h3>First sighting: what the game rolls</h3><p class="small muted">Which dragon met the cadet first, by company and direction. Pools come from the community PDF, and cells outside them are counted as data-quality flags.</p><div class="tbl-wrap" id="tbl-first"></div></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="rare" aria-labelledby="h-rare">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Blue & Black</span>
|
||||||
|
<h2 id="h-rare">The rare dragons</h2>
|
||||||
|
<p class="muted small">Two separate rolls. The meadow Blue can join the Orange and Brown after you turn down the valley Red. The tree's shadow option leads to a Blue and then a Black.</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>Does the Blue show up in the meadow?</h3><p class="small muted">Share of meadow visits where a Blue was attempted, by who logged the run. The game cannot know which dragon a player is chasing, so gaps between these bars come from how people report, not from the game.</p><div class="chart" id="ch-blue-strata"></div></div>
|
||||||
|
<div class="panel"><h3>Does the shadow show up at the tree?</h3><p class="small muted">Share of tree climbs where the shadow option led to a Blue and/or Black.</p><div class="chart" id="ch-shadow-strata"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>What changes the Blue's appearance, once reporting bias is held fixed?</h3><p class="small muted">Adjusted odds ratios from one logistic model: route choices plus data source and chase goal. Bars that cross 1 mean no detectable effect.</p><div class="chart" id="ch-model-blue"></div><p class="small muted" id="model-blue-note"></p></div>
|
||||||
|
<div class="panel"><h3>What changes the shadow's appearance?</h3><p class="small muted">Same approach for the shadow. With so few shadows, intervals are wide.</p><div class="chart" id="ch-model-shadow"></div><p class="small muted" id="model-shadow-note"></p></div>
|
||||||
|
</div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>Day by day (form submissions)</h3><p class="small muted">Bulk imports carry no dates, so they are left out here. Dots are sized by the number of runs, and whiskers show 95% intervals.</p><div class="chart" id="ch-daily"></div></div>
|
||||||
|
<div class="panel"><h3>Bonding once you reach them</h3><div class="chart" id="ch-rare-bond"></div>
|
||||||
|
<details class="fold"><summary>Step-by-step survival inside the encounter (from the community PDF)</summary><div id="pdf-steps"></div></details>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="findings" aria-labelledby="h-findings">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">What the data supports</span>
|
||||||
|
<h2 id="h-findings">Findings</h2>
|
||||||
|
<p class="muted small">These sentences are generated from the current data and filters, so they update when the data does. "Lead" means a pattern worth testing that is not yet established.</p>
|
||||||
|
</div>
|
||||||
|
<div class="findings" id="findings-list"></div>
|
||||||
|
</section>
|
||||||
|
<section id="routes" aria-labelledby="h-routes">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Ranked</span>
|
||||||
|
<h2 id="h-routes">Route table</h2>
|
||||||
|
<p class="muted small">A route here means every choice up to the hour. Routes are ranked by the lower end of their 95% interval, so a route needs both a high rate and enough runs to rank high. Each route is compared with every other route that could reach the same outcome. "Adjusted" holds data source and chase goal fixed (Mantel–Haenszel). q-values correct for testing many routes at once.</p>
|
||||||
|
</div>
|
||||||
|
<div class="controls"><div class="ctl"><label for="rt-target">Outcome</label><select id="rt-target"></select></div><div class="ctl"><label for="rt-min">Minimum runs per route</label><select id="rt-min"></select></div><p class="small muted" id="rt-note" style="align-self:center"></p></div>
|
||||||
|
<div class="tbl-wrap" id="tbl-routes"></div>
|
||||||
|
</section>
|
||||||
|
<section id="factors" aria-labelledby="h-factors">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">One choice at a time</span>
|
||||||
|
<h2 id="h-factors">Factor explorer</h2>
|
||||||
|
<p class="muted small">Each row compares runs with that answer against runs with any other answer to the same question, using Fisher's exact test. These comparisons are unadjusted, so check the adjusted models above before trusting a difference. Shaded rows have q < 0.05 after correcting for every comparison in this table.</p>
|
||||||
|
</div>
|
||||||
|
<div class="controls"><div class="ctl"><label for="fx-outcome">Outcome</label><select id="fx-outcome"></select></div><div class="ctl"><label for="fx-factor">Question</label><select id="fx-factor"></select></div></div>
|
||||||
|
<div class="grid2"><div class="tbl-wrap" id="tbl-factors"></div><div class="panel"><h3>Odds ratios</h3><div class="chart" id="ch-factor"></div></div></div>
|
||||||
|
</section>
|
||||||
|
<section id="quality" aria-labelledby="h-quality">
|
||||||
|
<div class="section-head">
|
||||||
|
<span class="eyebrow">Read this before quoting a number</span>
|
||||||
|
<h2 id="h-quality">Data quality and bias</h2>
|
||||||
|
</div>
|
||||||
|
<div class="grid3" id="quality-panels"></div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="tabpanel" id="panel-data" role="tabpanel" aria-labelledby="tab-data" hidden>
|
||||||
|
<section aria-labelledby="h-truths">
|
||||||
|
<div class="section-head"><span class="eyebrow" id="h-truths-kicker">What the runs say</span><h2 id="h-truths">Three things worth knowing</h2></div>
|
||||||
|
<div class="truths" id="truths"></div>
|
||||||
|
</section>
|
||||||
|
<section id="data-sec" aria-labelledby="h-data">
|
||||||
|
<div class="section-head"><span class="eyebrow">Where the numbers come from</span><h2 id="h-data">Data</h2></div>
|
||||||
|
<div class="data-status" id="data-status"><span class="loading">Loading data…</span></div>
|
||||||
|
<p class="small muted">The data refresh every day from the community sources. Every number on this page is computed in Python (<code>analysis/stats/site_stats.py</code>) from the coded runs and published as <a href="data/stats.json">data/stats.json</a>; the coded runs themselves are <a href="data/runs_clean.csv" download>data/runs_clean.csv</a>: every run from every source (the community spreadsheet, runs reported here, result pages posted in the Reddit megathreads and the DragonKind bot), with a <code>source</code> column. The statistics on this page use the community spreadsheet's runs; the other sources are coded from different questions and join the statistics once they have been reviewed. Every column is described in <a href="data/dictionary.yaml">data/dictionary.yaml</a>, and <a href="data/croissant.json">data/croissant.json</a> carries the same description in the Croissant metadata format, with a checksum for every file.</p>
|
||||||
|
</section>
|
||||||
|
<section id="share" aria-labelledby="h-share">
|
||||||
|
<div class="section-head"><span class="eyebrow">Open by design</span><h2 id="h-share">Share & reproduce</h2>
|
||||||
|
<p class="muted small">Everything on this page is computed from the community form export by the code in the <a href="https://git.kenschiano.net/DragonKind/threshing-atlas" target="_blank" rel="noopener">repository</a>, which updates the data every day. The rules for reading each answer are in <code>core/spec/form.yaml</code>, the game in <code>core/spec/game.yaml</code>, and what is measured in <code>analysis/stats/measures.yaml</code>.</p></div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>Copy the outputs</h3>
|
||||||
|
<div class="btnrow"><button type="button" id="cp-reddit" class="primary">Copy Reddit post (Markdown)</button><a class="btnlike" href="data/runs_clean.csv" download>Download coded runs (CSV)</a><button type="button" id="cp-json">Copy all results (JSON)</button></div>
|
||||||
|
<p class="small muted">The Reddit post is written from the numbers for the runs selected above.</p></div>
|
||||||
|
<div class="panel"><h3>Read the code</h3>
|
||||||
|
<div class="btnrow"><button type="button" data-src="python/form.yaml">form.yaml (every answer's meaning)</button><button type="button" data-src="python/coding.py">coding.py (the coding rules)</button><button type="button" data-src="python/measures.yaml">measures.yaml (what is measured)</button><button type="button" data-src="python/site_stats.py">site_stats.py (every number on this page)</button><button type="button" data-src="python/stats_core.py">stats_core.py</button><button type="button" data-src="app.js">app.js (this page)</button><button type="button" data-src="solver.js">solver.js (best routes)</button><button type="button" data-src="explorer.js">explorer.js (the valley map)</button><button type="button" data-src="register.js">register.js</button><button type="button" data-src="README.md">README</button></div>
|
||||||
|
<p class="small muted">The page itself computes nothing: it displays the numbers the Python code publishes. Tests in the repository check every rule and every number.</p>
|
||||||
|
<pre id="srcview" hidden></pre></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section id="methods" aria-labelledby="h-methods" class="method">
|
||||||
|
<div class="section-head"><span class="eyebrow">How every number is made</span><h2 id="h-methods">Methods</h2></div>
|
||||||
|
<div class="mtabs" role="tablist" aria-label="Methods"><button type="button" role="tab" class="mtab" id="mt-0" aria-controls="mt-0-panel" aria-selected="true" tabindex="0">1. Runs</button><button type="button" role="tab" class="mtab" id="mt-1" aria-controls="mt-1-panel" aria-selected="false" tabindex="-1">2. Rates</button><button type="button" role="tab" class="mtab" id="mt-2" aria-controls="mt-2-panel" aria-selected="false" tabindex="-1">3. Comparisons</button><button type="button" role="tab" class="mtab" id="mt-3" aria-controls="mt-3-panel" aria-selected="false" tabindex="-1">4. Reporting bias</button><button type="button" role="tab" class="mtab" id="mt-4" aria-controls="mt-4-panel" aria-selected="false" tabindex="-1">5. Limits</button><button type="button" role="tab" class="mtab" id="mt-5" aria-controls="mt-5-panel" aria-selected="false" tabindex="-1">6. Best routes</button><button type="button" role="tab" class="mtab" id="mt-6" aria-controls="mt-6-panel" aria-selected="false" tabindex="-1">Missing answers</button></div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-0-panel" aria-labelledby="mt-0">
|
||||||
|
<h3>1. From form answers to runs</h3>
|
||||||
|
<p>Each row of the <a href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">"Threshing Routes" form</a> (and each row pasted in from players' own logs) is one threshing run. Every row is coded with the same fixed rules, written down in <code>core/spec/form.yaml</code> and <code>core/atlas/coding.py</code> (both viewable under Share & reproduce):</p>
|
||||||
|
<ul>
|
||||||
|
<li><b>Source.</b> Rows with a real timestamp are form submissions. Rows labelled "Data Import", "Manual Upload" or "Historical import" were bulk-pasted from players' own run logs and are called <i>bulk logs</i> here.</li>
|
||||||
|
<li><b>Leaving your squadmates.</b> The form only offered "> Left them" from 27 October 2026. Squad runs before that date, or without a date, are coded as unknown rather than as "stayed together".</li>
|
||||||
|
<li><b>Cadet encounter.</b> Split into the scream choice (help, investigate and leave, or ignore) and its resolution (killed the bullies, squadmate's revenge, left them to the dragons, tourniquet, left the cadet, took their weapons). The fork in the road only exists after helping, so other branches are coded "(no fork)".</li>
|
||||||
|
<li><b>Encounter branch.</b> A tree run with a Blue or Black recorded took the shadow. A tree run that passed on the Red ("changed my mind") and then met the Greens climbed down quickly and let the Red pass, since only a quick descent puts you above the Red. Any other tree run with Greens recorded descended slowly, and one with only a Red descended quickly. A valley run with an Orange, Brown or Blue recorded (or a Red marked "Changed my mind") passed the Red and reached the meadow.</li>
|
||||||
|
<li><b>Outcome.</b> Bonded to the one dragon marked "Bonded!". Otherwise incinerated by the last dragon marked "Incinerated" in encounter order, or died before the hour. "Saved by another" on the Greens plus a bonded Orange or Brown counts as a rescue bond.</li>
|
||||||
|
<li><b>Flags.</b> Rows are flagged, not deleted, when answers contradict each other: several directions or wings, Greens in the valley, two bonds, or a first sighting outside the documented pool. You can drop flagged rows with the checkbox on Deep Dive's route map.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-1-panel" aria-labelledby="mt-1" hidden>
|
||||||
|
<h3>2. Rates and their uncertainty</h3>
|
||||||
|
<p>A rate is k events out of n runs that could have had that event. The denominator matters. The meadow Blue rate divides by runs that reached the meadow, not by all runs. Intervals are <b>95% <a href="https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval" target="_blank" rel="noopener">Wilson score intervals</a></b>, which behave well for small n and for rates near 0%:</p>
|
||||||
|
<div class="formula">p̂ = k / n, z = 1.96
|
||||||
|
centre = (p̂ + z²/2n) / (1 + z²/n)
|
||||||
|
half = z·√(p̂(1−p̂)/n + z²/4n²) / (1 + z²/n)
|
||||||
|
CI = centre ± half</div>
|
||||||
|
<p>With 0 events in n runs, the upper end is still informative. For example, 0 shadows in a few hundred bulk-log tree climbs still gives an upper bound near 1%.</p>
|
||||||
|
</div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-2-panel" aria-labelledby="mt-2" hidden>
|
||||||
|
<h3>3. Comparing choices</h3>
|
||||||
|
<p>For one answer against the rest, the 2×2 table is [a b; c d] = [event, no event] × [this answer, other answers].</p>
|
||||||
|
<div class="formula">OR = (a·d) / (b·c)
|
||||||
|
95% CI = exp( ln OR ± 1.96·√(1/a + 1/b + 1/c + 1/d) )
|
||||||
|
(0.5 is added to every cell when any cell is 0)
|
||||||
|
p = Fisher's exact test, two-sided
|
||||||
|
q = Benjamini–Hochberg: sort p, q(i) = min over j≥i of p(j)·m/j</div>
|
||||||
|
<p>Comparisons use the <b><a href="https://en.wikipedia.org/wiki/Odds_ratio" target="_blank" rel="noopener">odds ratio</a></b>, <b><a href="https://en.wikipedia.org/wiki/Fisher%27s_exact_test" target="_blank" rel="noopener">Fisher's exact test</a></b> and <b><a href="https://en.wikipedia.org/wiki/False_discovery_rate#Benjamini%E2%80%93Hochberg_procedure" target="_blank" rel="noopener">Benjamini–Hochberg q-values</a></b>. An odds ratio of 2 means the odds of the outcome are twice as high with that answer. q-values control the false-discovery rate. With dozens of comparisons, some p < 0.05 results are expected by chance, so a "real" difference needs q < 0.05.</p>
|
||||||
|
</div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-3-panel" aria-labelledby="mt-3" hidden>
|
||||||
|
<h3>4. Adjusting for who reports what</h3>
|
||||||
|
<p>Players chasing a rare dragon log runs where they saw a Blue far more often than other players do. Bulk loggers record every run, including dull ones. To separate route effects from reporting effects, the page fits a <b><a href="https://en.wikipedia.org/wiki/Logistic_regression" target="_blank" rel="noopener">logistic regression</a></b> with every route choice plus data source and chase goal:</p>
|
||||||
|
<div class="formula">logit P(event) = β₀ + Σ βⱼ·xⱼ (x = 0/1 indicators; reference = most common answer)
|
||||||
|
fitted by Newton–Raphson with a small ridge penalty λ = 1 on the slopes
|
||||||
|
adjusted OR = exp(βⱼ), 95% CI = exp(βⱼ ± 1.96·SEⱼ)</div>
|
||||||
|
<p>The <a href="https://en.wikipedia.org/wiki/Ridge_regression" target="_blank" rel="noopener">ridge penalty</a> keeps estimates finite when an answer has 0 events. It shrinks extreme odds ratios slightly toward 1, which makes the model more cautious. Route rankings use the <b><a href="https://en.wikipedia.org/wiki/Cochran%E2%80%93Mantel%E2%80%93Haenszel_statistics" target="_blank" rel="noopener">Mantel–Haenszel odds ratio</a></b> across strata of data source and chase goal (bulk logs; form runs chasing Blue, Black, or "Blue or Black" on the newer form; everything else) for the same reason.</p>
|
||||||
|
</div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-4-panel" aria-labelledby="mt-4" hidden>
|
||||||
|
<h3>5. What this data cannot tell you</h3>
|
||||||
|
<ul>
|
||||||
|
<li>It is self-reported and self-selected. Runs worth bragging about are over-represented, and that inflates every rare-dragon rate. Bulk logs are the least selected rows.</li>
|
||||||
|
<li>Runs are not independent. One player may log dozens of runs, and the form has no player ID, so intervals are somewhat too narrow.</li>
|
||||||
|
<li>The form records mostly stage-level choices. The newer form asks how you reacted to the first dragon, but most riders answer "unsure", and it does not record the answers given inside a bonding encounter, so route claims that depend on those cannot be tested here.</li>
|
||||||
|
<li>The form records dragons you <i>attempted</i>. A player who saw the Blue but chose the Orange would not record the Blue, so Blue sightings are slightly undercounted.</li>
|
||||||
|
<li>Step-by-step survival inside an encounter comes from the <a href="https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view" target="_blank" rel="noopener">community PDF</a>, which coded the free-text answers by hand. It is shown as published and cannot be recomputed here.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-5-panel" aria-labelledby="mt-5" hidden>
|
||||||
|
<h3>6. Best routes, the valley map and The Odds</h3>
|
||||||
|
<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 and, with squadmates, whether you later leave them; direction; how you react when the first dragon appears; the cadet encounter in the game's order — investigate the scream or keep walking, help your squadmate or walk away, your first move in the fight (pause to assess, charge the smaller cadet, or get between your squadmate and the bigger one) and, after pausing, what to do about the smaller cadet's dagger, then the bullies' fate or what to do for the wounded cadet — the fork, tree or valley, how to climb down, whether to jump onto the Red below the tree or let it pass and go on to the two Greens, 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>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. Clicking the bully fight means you stepped in to help: the chances assume your best first move and include the risk of dying in the fight. The move matters: about 3 in 10 riders who charged straight in were killed, against almost none who paused to assess. Several choices made at one place (as at the bully fight) share one diamond on the map, which opens a small card with each choice in order. For Orange and Brown, the Greens rescue is used only when their own meadow is out of reach.</p>
|
||||||
|
<p><b>Choices that are not modelled yet.</b> The answers you give at the bonding encounters themselves (for example which way to turn for the two Greens, or when to jump onto the Red) are not recorded by the community form, so every encounter uses its average bond chance. Ken's bot records every option it picks, so these can be added once enough bot runs come in. Letting the Red pass is rarely logged on its own; its chance is taken from the two Greens' encounter, which has plenty of data. Reactions to the first dragon use the form's categories, and only those logged at least 20 times for that dragon are offered. On the map, a choice you make holds for every route to that dragon, and routes it rules out are hidden.</p>
|
||||||
|
</div>
|
||||||
|
<div class="mpanel method" role="tabpanel" id="mt-6-panel" aria-labelledby="mt-6" hidden>
|
||||||
|
<h3>Missing answers</h3>
|
||||||
|
<p>"Unsure", blank answers, conflicting answers and questions an older version of the form did not ask are treated as <b>missing information, never as a choice</b>. Each comparison uses the runs that answered that question; models use runs that answered every question in them (<a href="https://en.wikipedia.org/wiki/Listwise_deletion" target="_blank" rel="noopener">complete cases</a>). "I've lost count" counts as a later attempt. The only exception is the chase goal used to adjust for reporting bias: runs from before that question existed stay in the models as their own adjustment group, but that group is not shown as a finding. The solver and the valley map ignore missing steps in the same way.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="tabpanel" id="panel-report" role="tabpanel" aria-labelledby="tab-report" hidden>
|
||||||
|
<!-- the links here are the sources in collection/pipeline.yaml -->
|
||||||
|
<section id="report-sec" aria-labelledby="h-report">
|
||||||
|
<div class="section-head"><span class="eyebrow">Every run helps</span><h2 id="h-report">Report a run</h2>
|
||||||
|
<p class="muted">Every run anyone logs ends up in the Atlas's open data, <a href="data/runs_clean.csv" download>runs_clean.csv</a>, which anyone can download and reuse. Deaths are as useful as bonds: the odds on this page are only as good as the runs behind them. Please report each run in one place only.</p></div>
|
||||||
|
<div class="grid2">
|
||||||
|
<div class="panel"><h3>Use the community form</h3>
|
||||||
|
<p class="small">The easiest way, no account needed. The r/fourthwing megathreads collect runs with u/ClumsyBadger's Google Form, and its answers go into a public spreadsheet. The Atlas reads that spreadsheet every day (source <b>reddit spreadsheet</b>), so a run logged there is counted here.</p>
|
||||||
|
<p class="btnrow"><a class="btnlike primary" href="https://forms.gle/DRpj9tG8gb5E4Hcu7" target="_blank" rel="noopener">Threshing Routes form</a>
|
||||||
|
<a class="btnlike" href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">The responses spreadsheet</a>
|
||||||
|
<a class="btnlike" href="https://www.reddit.com/r/fourthwing/comments/1wz5cnj/" target="_blank" rel="noopener">The megathread</a></p>
|
||||||
|
<p class="small muted">The form is anonymous and can be filled in once per attempt. Its author asks for random runs too (just pick the top option each time): they show which choices matter without the bias of everyone copying the same "best" route.</p>
|
||||||
|
</div>
|
||||||
|
<div class="panel"><h3>Or report it on the Atlas</h3>
|
||||||
|
<p class="small">A short form with the game's own choices: an issue on the Atlas's repository at git.kenschiano.net, so you need an account there. Reports show up in the data the next day with the source <b>reported</b>. Everyone who can see the repository can read reports: please leave out your account name.</p>
|
||||||
|
<p><a class="btnlike" href="https://git.kenschiano.net/DragonKind/threshing-atlas/issues/new?template=.github/ISSUE_TEMPLATE/report-a-run.yml" target="_blank" rel="noopener">Report a run on git.kenschiano.net</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel"><h3>Where the Atlas's runs come from</h3>
|
||||||
|
<table class="small"><thead><tr><th scope="col">Source</th><th scope="col">What it is</th></tr></thead><tbody>
|
||||||
|
<tr><td>reddit spreadsheet</td><td>The community form and spreadsheet linked from the r/fourthwing megathreads.</td></tr>
|
||||||
|
<tr><td>reported</td><td>Runs reported here, with "Report a run".</td></tr>
|
||||||
|
<tr><td>register</td><td>The Unofficial Dragon Register: which dragon each rider bonded (no route).</td></tr>
|
||||||
|
<tr><td>reddit thread</td><td>Dragonkind result pages posted in the megathreads (the dragon is known, the route is not).</td></tr>
|
||||||
|
<tr><td>bot</td><td>Runs logged by the DragonKind bot.</td></tr>
|
||||||
|
<tr><td>reddit pdf</td><td>The community route PDF: a map of the choices, used to check the game's routes (it holds no runs).</td></tr>
|
||||||
|
</tbody></table>
|
||||||
|
<p class="small muted">What every column means: <a href="data/dictionary.yaml">data/dictionary.yaml</a>.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
<footer><div class="wrap"><p><b>Data:</b> the community <a href="https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0" target="_blank" rel="noopener">"Threshing Routes" responses</a> compiled by <a href="https://www.reddit.com/user/ClumsyBadger/" target="_blank" rel="noopener">u/ClumsyBadger</a>, with percentages in the <a href="https://drive.google.com/file/d/17o72ehHsSPW4UdsKF-sXTxMLEuinWeEg/view" target="_blank" rel="noopener">route PDF</a> by <a href="https://www.reddit.com/user/ClumsyBadger/" target="_blank" rel="noopener">u/ClumsyBadger</a>, <a href="https://www.reddit.com/user/Old_Regular3018/" target="_blank" rel="noopener">u/Old_Regular3018</a> and <a href="https://www.reddit.com/user/Smart_Trifle_2099/" target="_blank" rel="noopener">u/Smart_Trifle_2099</a>; the <a href="https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ" target="_blank" rel="noopener">Unofficial Dragon Register</a>; and the r/fourthwing bonding megathreads (<a href="https://www.reddit.com/r/fourthwing/comments/1wvwfp9/" target="_blank" rel="noopener">Part 3</a>, <a href="https://www.reddit.com/r/fourthwing/comments/1wz5cnj/" target="_blank" rel="noopener">Part 4</a>). Code and data: <a href="https://git.kenschiano.net/DragonKind/threshing-atlas" target="_blank" rel="noopener">git.kenschiano.net/DragonKind/threshing-atlas</a> (MIT, data CC BY 4.0).</p>
|
||||||
|
<p><b>Unofficial fan analysis,</b> not affiliated with <a href="https://dragonkind.com" target="_blank" rel="noopener">Dragonkind</a> or its authors. The author has said no single roll is worse than 1 in 20 and that the Black is not luck, but <b>no route guarantees a bond</b>.</p></div></footer>
|
||||||
|
<div id="tip" hidden></div>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
||||||
|
<script src="solver.js"></script>
|
||||||
|
<script src="register.js"></script>
|
||||||
|
<script src="app.js"></script>
|
||||||
|
<script src="valley.js"></script>
|
||||||
|
<script src="dragons.js"></script>
|
||||||
|
<script src="explorer.js"></script>
|
||||||
|
<script src="ui.js"></script>
|
||||||
@@ -0,0 +1,323 @@
|
|||||||
|
"""Community form rows -> one coded run per row.
|
||||||
|
|
||||||
|
The tables (how each question is found, what every answer means, which answers count as missing) live in
|
||||||
|
core/spec/form.yaml. This module holds the logic that combines answers into a run: which way the rider went,
|
||||||
|
which branch they took after the hour, how the run ended, and which rows look inconsistent (data_flags).
|
||||||
|
|
||||||
|
python -m atlas.coding [form_responses.json|.xlsx|.csv] [out.csv]
|
||||||
|
|
||||||
|
Prints a summary of the coded export (default: data/public/form_responses.json), and writes the coded runs to
|
||||||
|
out.csv when given. The published runs (every source) are written by `python -m collection build`.
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
from . import spec
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
F = spec.form()
|
||||||
|
A = F["answers"]
|
||||||
|
COLORS = F["colours"]
|
||||||
|
MISSING = frozenset(F["missing_values"])
|
||||||
|
ENC = F["encounter_answers"]
|
||||||
|
_EMAIL = re.compile(F["redact"]["pattern"])
|
||||||
|
|
||||||
|
|
||||||
|
def is_missing(v):
|
||||||
|
"""True for answers that carry no information about the choice (blank, "Unsure", not asked...)."""
|
||||||
|
return v is None or v == "" or v in MISSING or (isinstance(v, float) and v != v)
|
||||||
|
|
||||||
|
|
||||||
|
def redact(v):
|
||||||
|
"""Replace email addresses in free text."""
|
||||||
|
return v if v is None else _EMAIL.sub(F["redact"]["replacement"], str(v))
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- reading cells
|
||||||
|
|
||||||
|
def find_columns(cols):
|
||||||
|
"""Map each question key in form.yaml to the export's column header. Returns (columns, missing keys)."""
|
||||||
|
out = {}
|
||||||
|
low = {c: str(c).lower() for c in cols}
|
||||||
|
for key, col in F["columns"].items():
|
||||||
|
words = col["match"]
|
||||||
|
hits = [c for c in cols if all((w[1:] not in low[c]) if w[0] == "!" else (w in low[c]) for w in words)]
|
||||||
|
if hits:
|
||||||
|
out[key] = hits[0]
|
||||||
|
missing = [k for k, col in F["columns"].items()
|
||||||
|
if k not in out and not col.get("optional") and col.get("replaced_by") not in out]
|
||||||
|
return out, missing
|
||||||
|
|
||||||
|
|
||||||
|
def blank(v):
|
||||||
|
if v is None or v is pd.NaT:
|
||||||
|
return True
|
||||||
|
if not isinstance(v, str):
|
||||||
|
try:
|
||||||
|
if pd.isna(v):
|
||||||
|
return True
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
pass
|
||||||
|
return str(v).strip() in ("", "nan", "NaN", "NaT")
|
||||||
|
|
||||||
|
|
||||||
|
def text(v):
|
||||||
|
return None if blank(v) else str(v).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def parse_timestamp(v):
|
||||||
|
"""Form submissions carry a timestamp; bulk-pasted rows carry a label such as 'Data Import'.
|
||||||
|
Returns 'YYYY-MM-DD' or None."""
|
||||||
|
if isinstance(v, (datetime, pd.Timestamp)) and not pd.isna(v):
|
||||||
|
return pd.Timestamp(v).strftime("%Y-%m-%d")
|
||||||
|
if isinstance(v, (int, float)) and not isinstance(v, bool) and 40000 < v < 80000: # Excel serial date
|
||||||
|
return (pd.Timestamp("1899-12-30") + pd.Timedelta(days=int(v))).strftime("%Y-%m-%d")
|
||||||
|
t = text(v)
|
||||||
|
if not t:
|
||||||
|
return None
|
||||||
|
m = re.match(r"^(\d{4})-(\d{2})-(\d{2})", t)
|
||||||
|
if m:
|
||||||
|
return f"{m.group(1)}-{m.group(2)}-{m.group(3)}"
|
||||||
|
m = re.match(r"^(\d{1,2})/(\d{1,2})/(\d{4})", t) # Google Sheets CSV export: M/D/YYYY
|
||||||
|
if m:
|
||||||
|
return f"{m.group(3)}-{int(m.group(1)):02d}-{int(m.group(2)):02d}"
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def parse_attempt(v):
|
||||||
|
v = text(v)
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
t = v.lower()
|
||||||
|
if "lost count" in t:
|
||||||
|
return None
|
||||||
|
for w, n in F["attempt_words"].items():
|
||||||
|
if t.startswith(w):
|
||||||
|
return n
|
||||||
|
m = re.search(r"\d+", t)
|
||||||
|
return int(m.group()) if m else None
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- one row -> one run
|
||||||
|
|
||||||
|
def code_row(r, C):
|
||||||
|
"""Code one export row. r: mapping header -> cell; C: from find_columns()."""
|
||||||
|
g = lambda k: text(r[C[k]]) if k in C else None # noqa: E731
|
||||||
|
flags = []
|
||||||
|
ts = r[C["timestamp"]] if "timestamp" in C else None
|
||||||
|
d = parse_timestamp(ts)
|
||||||
|
source, date = ("Form", d) if d else ((text(ts) or "Unknown import"), None)
|
||||||
|
|
||||||
|
wings = [w for w in ("First", "Second", "Third", "Fourth") if g("wing_" + w)]
|
||||||
|
wing = wings[0] if len(wings) == 1 else ("Multiple" if wings else "Unknown")
|
||||||
|
section = g("wing_" + wings[0]) if len(wings) == 1 else None
|
||||||
|
if len(wings) > 1:
|
||||||
|
flags.append("multiple wings")
|
||||||
|
|
||||||
|
if "first_dir" in C:
|
||||||
|
# Redesigned form: one direction question and one colour question. The older per-direction colour
|
||||||
|
# columns are still in the sheet for some rows and are used only to fill gaps and to cross-check.
|
||||||
|
direction = A["direction"].get(g("first_dir"))
|
||||||
|
first = g("first_colour")
|
||||||
|
legacy = [d for d in ("West", "Center") if g("leg_" + d)]
|
||||||
|
if not direction and len(legacy) == 1:
|
||||||
|
direction = legacy[0]
|
||||||
|
flags.append("direction taken from the older sighting column")
|
||||||
|
leg = g("leg_" + direction) if direction else None
|
||||||
|
if not first and leg:
|
||||||
|
first = leg
|
||||||
|
elif first and leg and first != leg and first != "Unsure" and leg != "Unsure":
|
||||||
|
flags.append("first sighting differs between the old and new columns")
|
||||||
|
if not direction:
|
||||||
|
direction = "Unknown"
|
||||||
|
flags.append("direction missing")
|
||||||
|
else:
|
||||||
|
dirs = [d for d in ("East", "West", "Center") if g("dir_" + d)]
|
||||||
|
if len(dirs) == 1:
|
||||||
|
direction, first = dirs[0], g("dir_" + dirs[0])
|
||||||
|
else:
|
||||||
|
direction, first = ("Multiple" if dirs else "Unknown"), None
|
||||||
|
flags.append("direction " + ("multiple" if dirs else "missing"))
|
||||||
|
|
||||||
|
company_raw = g("company") or "Unknown"
|
||||||
|
suffix = F["company_left_suffix"]
|
||||||
|
left_squad = company_raw.endswith(suffix)
|
||||||
|
company = company_raw[: -len(suffix)] if left_squad else company_raw
|
||||||
|
if not left_squad and company in ("1 Squadmate", "2 Squadmates") and not (date and date >= F["left_squadmates_asked_from"]):
|
||||||
|
left_squad = None # the form did not offer "left them" yet: unknown, not "stayed together"
|
||||||
|
alias = F.get("first_sighting_alias") or {}
|
||||||
|
if first in alias:
|
||||||
|
flags.append(f"first sighting answered as {first!r}")
|
||||||
|
first = alias[first]
|
||||||
|
pools = F["sighting_pool"]
|
||||||
|
pool = list(pools.get(company, {}).get(direction, [])) + (list(pools["Alone"].get(direction, [])) if left_squad else [])
|
||||||
|
if first and first != "Unsure" and pool and first not in pool:
|
||||||
|
flags.append(f"first sighting {first} not in documented pool for {company}/{direction}")
|
||||||
|
|
||||||
|
cadet_raw = g("cadet")
|
||||||
|
combat = combat2 = None
|
||||||
|
if "cadet_actions" in C:
|
||||||
|
act = g("cadet_actions")
|
||||||
|
a = A["cadet_actions"].get(act, ["Unknown", None, None, "Unknown"])
|
||||||
|
if act and act not in A["cadet_actions"]:
|
||||||
|
flags.append("unrecognised cadet answer")
|
||||||
|
scream, combat, combat2 = a[0], a[1], a[2]
|
||||||
|
out = A["cadet_outcome"].get(cadet_raw)
|
||||||
|
if a[3] is not None:
|
||||||
|
resolution = a[3]
|
||||||
|
if out == "DIED in combat" and not resolution.startswith("DIED"):
|
||||||
|
flags.append("died in combat on a path without combat")
|
||||||
|
else:
|
||||||
|
resolution = out or "Unknown"
|
||||||
|
else:
|
||||||
|
scream, resolution = A["cadet_legacy"].get(cadet_raw, ["Unknown", "Unknown"])
|
||||||
|
if cadet_raw and cadet_raw not in A["cadet_legacy"]:
|
||||||
|
flags.append("unrecognised cadet answer")
|
||||||
|
combat = A["combat_legacy"].get(g("combat")) if g("combat") else None
|
||||||
|
|
||||||
|
post_raw = g("post")
|
||||||
|
if scream == "Investigate & help" and not resolution.startswith("DIED"):
|
||||||
|
post = post_raw if post_raw in ("Forest", "West", "East") else "Unknown"
|
||||||
|
elif scream in ("Ignore the scream", "Investigate & leave"):
|
||||||
|
post = "(no fork)" # the form allowed an answer here; the game has no fork on this branch
|
||||||
|
else:
|
||||||
|
post = None
|
||||||
|
|
||||||
|
hour = A["hour"].get(g("hour"))
|
||||||
|
died_early = scream.startswith("DIED") or resolution.startswith("DIED")
|
||||||
|
if died_early:
|
||||||
|
hour = None
|
||||||
|
elif hour is None:
|
||||||
|
hour = "Unknown"
|
||||||
|
|
||||||
|
enc = {c: g("enc_" + c) for c in COLORS}
|
||||||
|
rare = A["rare"].get(g("rare"))
|
||||||
|
bonded = [c for c in COLORS if enc[c] == ENC["bonded"]]
|
||||||
|
burned = [c for c in COLORS if enc[c] == ENC["burned"]]
|
||||||
|
|
||||||
|
# Which encounter branch did the run take after the hour?
|
||||||
|
branch = None
|
||||||
|
if hour == "Tree":
|
||||||
|
if enc["Blue"] or enc["Black"] or rare == "Shadow":
|
||||||
|
branch = "Shadow (rare)"
|
||||||
|
elif enc["Red"] == ENC["passed"] and enc["Green"]:
|
||||||
|
# only climbing down quickly puts you above the Red: passing on it and meeting the Greens means the
|
||||||
|
# rider let it pass
|
||||||
|
branch = "Descend quickly: let the Red pass"
|
||||||
|
elif enc["Green"]:
|
||||||
|
branch = "Descend slowly: two Greens"
|
||||||
|
if enc["Red"]:
|
||||||
|
flags.append("tree run with both the Red and the two Greens attempted")
|
||||||
|
elif enc["Red"]:
|
||||||
|
branch = "Descend quickly: Red"
|
||||||
|
elif enc["Orange"] or enc["Brown"]:
|
||||||
|
branch = "Descend slowly: two Greens"
|
||||||
|
flags.append("tree run with Orange/Brown but no Green recorded")
|
||||||
|
elif hour == "Valley":
|
||||||
|
if enc["Green"]:
|
||||||
|
flags.append("Green recorded on a Valley run (no Greens in the valley)")
|
||||||
|
meadow = [c for c in ("Orange", "Brown", "Blue") if enc[c]] or rare == "Blue (valley)"
|
||||||
|
if meadow or enc["Red"] == ENC["passed"]:
|
||||||
|
branch = "Passed the Red: meadow"
|
||||||
|
elif enc["Red"]:
|
||||||
|
branch = "Valley Red"
|
||||||
|
|
||||||
|
# How the run ended
|
||||||
|
outcome, outcome_color = None, None
|
||||||
|
if died_early:
|
||||||
|
outcome = "Died before the hour"
|
||||||
|
elif len(bonded) == 1:
|
||||||
|
outcome, outcome_color = "Bonded", bonded[0]
|
||||||
|
elif len(bonded) > 1:
|
||||||
|
outcome = "Ambiguous"
|
||||||
|
flags.append("more than one dragon marked Bonded")
|
||||||
|
elif burned:
|
||||||
|
order = F["burn_order"]["valley" if hour == "Valley" else "tree"]
|
||||||
|
outcome, outcome_color = "Incinerated", [c for c in order if c in burned][-1]
|
||||||
|
if len(burned) > 1:
|
||||||
|
flags.append("more than one dragon marked Incinerated")
|
||||||
|
elif hour == "DIED before the hour":
|
||||||
|
outcome = "Died before the hour"
|
||||||
|
else:
|
||||||
|
outcome = "No outcome recorded"
|
||||||
|
|
||||||
|
rescued = enc["Green"] == ENC["rescued"] and outcome == "Bonded" and outcome_color in ("Orange", "Brown")
|
||||||
|
attempt = parse_attempt(g("attempt"))
|
||||||
|
if (rare == "Blue (valley)" and hour == "Tree") or (rare == "Shadow" and hour == "Valley"):
|
||||||
|
flags.append("rare-dragon answer does not match the path")
|
||||||
|
goal_raw = g("goal_v2")
|
||||||
|
goal = g("goal") or (A["goal_v2"].get(goal_raw, goal_raw) if goal_raw and goal_raw != "Unknown" else None) or "(not asked/blank)"
|
||||||
|
return {
|
||||||
|
"source": source, "date": date, "wing": wing, "section": section,
|
||||||
|
"squad": A["squad_any_case"].get((g("squad") or "").strip().lower(), g("squad") or "Unknown"), "attempt": attempt,
|
||||||
|
# "I've lost count" means many attempts, so it is a later attempt, not missing
|
||||||
|
"attempt_group": "First attempt" if attempt == 1 else ("Later attempt" if (attempt and attempt > 1) or "lost count" in (g("attempt") or "").lower() else "Unknown"),
|
||||||
|
"goal": goal, "company": company, "left_squadmates": left_squad,
|
||||||
|
"direction": direction, "first_sighting": first or "Unknown",
|
||||||
|
"sighting_action": (A["sighting_action"].get(g("sighting_action")) or g("sighting_action") or "Unknown") if "sighting_action" in C else "(not asked)",
|
||||||
|
"scream": scream, "resolution": resolution, "combat_first": combat or "(not recorded)",
|
||||||
|
"combat_second": combat2 or "(not recorded)",
|
||||||
|
"post_path": post, "hour": hour, "branch": branch,
|
||||||
|
**{"enc_" + c: enc[c] for c in COLORS},
|
||||||
|
"outcome": outcome, "outcome_color": outcome_color, "rescued": rescued,
|
||||||
|
"saw_blue_meadow": bool(hour == "Valley" and (enc["Blue"] or rare == "Blue (valley)")),
|
||||||
|
"saw_shadow": bool(hour == "Tree" and (enc["Blue"] or enc["Black"] or rare == "Shadow")),
|
||||||
|
"rare_reported": (rare or "Unknown") if "rare" in C else "(not asked)",
|
||||||
|
"malek_intent": (g("malek") or "Unknown") if "malek" in C else "(not asked)",
|
||||||
|
"tail": g("tail"),
|
||||||
|
"data_flags": "; ".join(flags),
|
||||||
|
"death_note": redact(g("death_note")), "bond_note": redact(g("bond_note")),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- files
|
||||||
|
|
||||||
|
def read_export(path):
|
||||||
|
"""An export as a DataFrame: the bundled JSON (data/public/form_responses.json), a CSV or the .xlsx."""
|
||||||
|
p = str(path).lower()
|
||||||
|
if p.endswith(".json"):
|
||||||
|
with open(path, encoding="utf-8") as f:
|
||||||
|
d = json.load(f)
|
||||||
|
return pd.DataFrame(d["rows"], columns=d["headers"])
|
||||||
|
if p.endswith(".csv"):
|
||||||
|
return pd.read_csv(path)
|
||||||
|
xl = pd.ExcelFile(path)
|
||||||
|
sheet = next((n for n in xl.sheet_names if "form responses" in n.lower()), xl.sheet_names[0])
|
||||||
|
return pd.read_excel(xl, sheet)
|
||||||
|
|
||||||
|
|
||||||
|
def code_frame(raw):
|
||||||
|
"""Code every row of an export. Returns (runs DataFrame with run_id, missing question keys)."""
|
||||||
|
C, missing = find_columns(raw.columns)
|
||||||
|
df = pd.DataFrame([code_row(r, C) for _, r in raw.iterrows()])
|
||||||
|
df.insert(0, "run_id", range(1, len(df) + 1))
|
||||||
|
return df, missing
|
||||||
|
|
||||||
|
|
||||||
|
def load(path):
|
||||||
|
return code_frame(read_export(path))
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=None):
|
||||||
|
argv = sys.argv[1:] if argv is None else argv
|
||||||
|
src = argv[0] if argv else ROOT / "data/public/form_responses.json"
|
||||||
|
out = argv[1] if len(argv) > 1 else None
|
||||||
|
df, missing = load(src)
|
||||||
|
if missing:
|
||||||
|
print("WARNING: columns not found:", missing)
|
||||||
|
# a whole-number column with gaps would otherwise be written as 1.0, 2.0, ... (data/dictionary.yaml: integer)
|
||||||
|
df["attempt"] = df["attempt"].astype("Int64")
|
||||||
|
if out:
|
||||||
|
df.to_csv(out, index=False)
|
||||||
|
print(f"{len(df)} runs" + (f" -> {out}" if out else ""))
|
||||||
|
print(df.outcome.value_counts().to_string())
|
||||||
|
print("rows with flags:", (df["data_flags"] != "").sum())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
# The community "Threshing Routes" form: how each question is found in an export and how every answer is coded.
|
||||||
|
#
|
||||||
|
# This file is the single source of truth for the coding rules' tables. core/atlas/coding.py reads it; the logic
|
||||||
|
# that combines answers (which branch a run took, how it ended) lives there and is described on the page's
|
||||||
|
# Methods tab. To support a new or renamed answer, add it here and add a case to tests/core/test_coding.py.
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
colours: [Red, Green, Orange, Brown, Blue, Black]
|
||||||
|
|
||||||
|
# Answers that carry no information about the choice. They are kept in the coded data for transparency, but every
|
||||||
|
# analysis treats them as missing: never shown or compared as if they were a choice.
|
||||||
|
missing_values: ["Unknown", "Unsure", "Unsure/unknown", "Multiple", "(not recorded)", "(not asked)",
|
||||||
|
"(not asked/blank)", "Unknown/lost count", "Blank/not asked"]
|
||||||
|
|
||||||
|
# Free-text answers sometimes contain an email address; it is replaced before anything is displayed or exported.
|
||||||
|
redact:
|
||||||
|
pattern: '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}'
|
||||||
|
replacement: "[email removed]"
|
||||||
|
|
||||||
|
# Columns are found by words in the question text (case-insensitive), so the coding keeps working when the form
|
||||||
|
# owner reorders, renames slightly or adds questions. A word starting with "!" must NOT appear in the header.
|
||||||
|
columns:
|
||||||
|
timestamp: { match: ["timestamp"] }
|
||||||
|
wing_First: { match: ["wing and section", "[first]"] }
|
||||||
|
wing_Second: { match: ["wing and section", "[second]"] }
|
||||||
|
wing_Third: { match: ["wing and section", "[third]"] }
|
||||||
|
wing_Fourth: { match: ["wing and section", "[fourth]"] }
|
||||||
|
squad: { match: ["what squad"] }
|
||||||
|
attempt: { match: ["attempt number"] }
|
||||||
|
company: { match: ["who accompanied"] }
|
||||||
|
dir_East: { match: ["initial direction", "[east"], replaced_by: first_dir }
|
||||||
|
dir_West: { match: ["initial direction", "[west"], replaced_by: first_dir }
|
||||||
|
dir_Center: { match: ["initial direction", "[forest center"], replaced_by: first_dir }
|
||||||
|
cadet: { match: ["outcome of your cadet encounter"] }
|
||||||
|
post: { match: ["path did you take after the bully"] }
|
||||||
|
hour: { match: ["after walking an hour"] }
|
||||||
|
enc_Red: { match: ["attempt to bond", "[red"] }
|
||||||
|
enc_Green: { match: ["attempt to bond", "[green"] }
|
||||||
|
enc_Orange: { match: ["attempt to bond", "[orange"] }
|
||||||
|
enc_Brown: { match: ["attempt to bond", "[brown"] }
|
||||||
|
enc_Blue: { match: ["attempt to bond", "[blue"] }
|
||||||
|
enc_Black: { match: ["attempt to bond", "[black"] }
|
||||||
|
death_note: { match: ["those who died"] }
|
||||||
|
bond_note: { match: ["those who bonded"] }
|
||||||
|
goal: { match: ["colour dragon are you trying"], replaced_by: goal_v2 }
|
||||||
|
combat: { match: ["combat choice"], replaced_by: cadet_actions }
|
||||||
|
# Questions added in the redesigned form (late October 2026)
|
||||||
|
first_dir: { match: ["what was your first direction"], replaced_by: dir_Center }
|
||||||
|
first_colour: { match: ["colour was your initial dragon sighting", "!["], replaced_by: dir_Center }
|
||||||
|
leg_West: { match: ["colour was your initial dragon sighting", "[west"], optional: true }
|
||||||
|
leg_Center: { match: ["colour was your initial dragon sighting", "[forest center"], optional: true }
|
||||||
|
sighting_action: { match: ["action did you take during the first dragon sighting"], optional: true }
|
||||||
|
cadet_actions: { match: ["during your cadet encounter"], replaced_by: combat }
|
||||||
|
goal_v2: { match: ["why are you doing this run"], replaced_by: goal }
|
||||||
|
malek: { match: ["seek malek"], optional: true }
|
||||||
|
rare: { match: ["encounter a rare dragon"], optional: true }
|
||||||
|
tail: { match: ["what tail does your dragon have"], optional: true }
|
||||||
|
|
||||||
|
# Answer → coded value, one table per question.
|
||||||
|
answers:
|
||||||
|
# Older form: one answer for the whole cadet encounter → [scream, resolution]
|
||||||
|
cadet_legacy:
|
||||||
|
"Bullies > You dealt with them": ["Investigate & help", "Killed the bullies yourself"]
|
||||||
|
"Bullies > Squadmate's revenge": ["Investigate & help", "Squadmate's revenge"]
|
||||||
|
"Bullies > Left to the Dragons": ["Investigate & help", "Left bullies to the dragons"]
|
||||||
|
"Bullies > Assessed the situation": ["Investigate & help", "Unknown"]
|
||||||
|
"Injured Cadet > Tourniquet": ["Ignore the scream", "Tourniquet"]
|
||||||
|
"Injured Cadet > Left them there": ["Ignore the scream", "Left injured cadet"]
|
||||||
|
"Injured Cadet > Took their weapons": ["Ignore the scream", "Took their weapons"]
|
||||||
|
"Avoided combat (Investigated scream > Left them to it)": ["Investigate & leave", "Left them to it"]
|
||||||
|
"You died in combat": ["Investigate & help", "DIED in combat"]
|
||||||
|
"N/A - You died with initial dragon sighting": ["DIED at first sighting", "DIED at first sighting"]
|
||||||
|
# Older form: the first move in the fight
|
||||||
|
combat_legacy:
|
||||||
|
"Bullies > Assessed the situation": "Assess the situation"
|
||||||
|
"Bullies > Even the numbers (Rushed the smaller cadet)": "Even the numbers (smaller cadet)"
|
||||||
|
"Bullies > Put yourself in the middle (Rushed the bigger cadet attacking your squadmate)": "Put yourself in the middle (bigger cadet)"
|
||||||
|
# Redesigned form: the encounter as a path of actions → [scream, first move, second move, resolution or null]
|
||||||
|
# (null resolution: the separate outcome question decides it, see cadet_outcome)
|
||||||
|
cadet_actions:
|
||||||
|
"Bullies > Assess > Unknown": ["Investigate & help", "Assess the situation", null, null]
|
||||||
|
"Bullies > Assess > Smaller Cadet": ["Investigate & help", "Assess the situation", "Engage the smaller cadet", null]
|
||||||
|
"Bullies > Assess > Daggers or not": ["Investigate & help", "Assess the situation", "Daggers or not (protect squadmate)", null]
|
||||||
|
"Bullies > Unknown": ["Investigate & help", null, null, null]
|
||||||
|
"Bullies > Smaller Cadet (Did not assess)": ["Investigate & help", "Even the numbers (smaller cadet)", null, null]
|
||||||
|
"Bullies > Bigger Cadet (Did not assess)": ["Investigate & help", "Put yourself in the middle (bigger cadet)", null, null]
|
||||||
|
"Injured Cadet > Tourniquet": ["Ignore the scream", null, null, "Tourniquet"]
|
||||||
|
"Injured Cadet > Left them there": ["Ignore the scream", null, null, "Left injured cadet"]
|
||||||
|
"Injured Cadet > Took their weapons": ["Ignore the scream", null, null, "Took their weapons"]
|
||||||
|
"Avoided combat (Investigated scream > Left them to it)": ["Investigate & leave", null, null, "Left them to it"]
|
||||||
|
"N/A - You died with initial dragon sighting": ["DIED at first sighting", null, null, "DIED at first sighting"]
|
||||||
|
"Unsure": ["Unknown", null, null, "Unknown"]
|
||||||
|
cadet_outcome:
|
||||||
|
"Squadmate's revenge": "Squadmate's revenge"
|
||||||
|
"You ended the bullies yourself": "Killed the bullies yourself"
|
||||||
|
"Left to the Dragons": "Left bullies to the dragons"
|
||||||
|
"You died in combat": "DIED in combat"
|
||||||
|
direction:
|
||||||
|
"Forest Center": Center
|
||||||
|
"West / Scent": West
|
||||||
|
"East / Roar": East
|
||||||
|
goal_v2:
|
||||||
|
"Hoping for a Rare Dragon (Blue or Black)": "Blue or Black"
|
||||||
|
"Trying to bond the Red dragon under the tree": "Red (tree)"
|
||||||
|
"Daily Run Assignment data": "Daily run data"
|
||||||
|
"Just here for fun, and maybe a dragon": "Any (for fun)"
|
||||||
|
# Squad: matched ignoring case and spaces (riders type it); an answer not listed still stops the build
|
||||||
|
squad_any_case:
|
||||||
|
"first": "First"
|
||||||
|
"second": "Second"
|
||||||
|
"third": "Third"
|
||||||
|
"don't know": "Don't know"
|
||||||
|
sighting_action:
|
||||||
|
"Hold Ground / Stay Still": "Hold still"
|
||||||
|
"Respect / Face it": "Respect / face it"
|
||||||
|
"Retreat / Run / Back Away": "Retreat / run"
|
||||||
|
"Hide / Duck": "Hide"
|
||||||
|
"Protect / Help Squadmate": "Protect squadmate"
|
||||||
|
"Draw / Drop Weapon": "Weapon"
|
||||||
|
"Meet Gaze": "Meet its gaze"
|
||||||
|
"Protect / Help Sqaudmate": "Protect squadmate"
|
||||||
|
"Approach": "Approach"
|
||||||
|
"Stand on your own": "Stand alone"
|
||||||
|
"Unsure": "Unknown"
|
||||||
|
"Unsure - You don't remember": "Unknown"
|
||||||
|
rare:
|
||||||
|
"Yes - A blue dragon in the valley": "Blue (valley)"
|
||||||
|
"Yes - Shadow!!!": "Shadow"
|
||||||
|
"No": "No"
|
||||||
|
hour:
|
||||||
|
"Continued to Valley Centre": Valley
|
||||||
|
"Climbed the tallest tree": Tree
|
||||||
|
"N/A - You're dead": "DIED before the hour"
|
||||||
|
|
||||||
|
# Suffix on the company answer that means the rider later left their squadmates. The answer was only offered from
|
||||||
|
# this date (none of the 504 squad runs before it chose it; 40 of 144 after it did): earlier and undated squad runs
|
||||||
|
# are coded as unknown (empty), not as "stayed together".
|
||||||
|
company_left_suffix: " > Left them"
|
||||||
|
left_squadmates_asked_from: "2026-10-27"
|
||||||
|
|
||||||
|
# The encounter answers in the "attempt to bond" grid
|
||||||
|
encounter_answers: { bonded: "Bonded!", burned: "Incinerated", passed: "Changed my mind", rescued: "Saved by another" }
|
||||||
|
|
||||||
|
# When more than one dragon is marked Incinerated, the run ended on the last one met, in this order.
|
||||||
|
burn_order:
|
||||||
|
tree: [Red, Green, Orange, Brown, Blue, Black]
|
||||||
|
valley: [Red, Orange, Brown, Blue, Green, Black]
|
||||||
|
|
||||||
|
# First-dragon pools per company and direction, from the community PDF. Only used to FLAG rows that report a
|
||||||
|
# dragon outside the documented pool. Leaving your squadmates sends you into the solo pools too.
|
||||||
|
sighting_pool:
|
||||||
|
Alone: { East: [Red, Orange], West: [Red, Brown, Green], Center: [Red, Brown] }
|
||||||
|
1 Squadmate: { East: [Green, Orange, Red], West: [Red, Brown, Green], Center: [Red, Brown] }
|
||||||
|
2 Squadmates: { East: [Red, Orange], West: [Green, Brown, Red], Center: [Red, Brown] }
|
||||||
|
|
||||||
|
# The dragons each bonding encounter can end with (bond or burn), from the community PDF. Only used to FLAG runs
|
||||||
|
# answered through "Report a run" (reported, reddit comment) that end with a dragon the encounter does not have.
|
||||||
|
# Orange and Brown after the two Greens: a Green's rescue, then the Orange or Brown.
|
||||||
|
# Flags (data_flags, matched as text inside a flag) that mean a run cannot have happened as recorded: the game's own
|
||||||
|
# rules, from the form coder (core/atlas/coding.py) and the checks of collection/etl/runs.py rule_flags. A run with one
|
||||||
|
# is kept in runs_clean.csv, flagged, and left out of the route model and the site statistics (atlas.runs.impossible).
|
||||||
|
# Everything else, however partial, is used. Not here on purpose: a first sighting outside the documented pool (the
|
||||||
|
# pool is what riders have seen, not a rule), a missing direction, several wings, a missing Green before a rescue.
|
||||||
|
impossible_flags:
|
||||||
|
- "Green recorded on a Valley run"
|
||||||
|
- "Black recorded on a Valley run"
|
||||||
|
- "encounter, which has only"
|
||||||
|
- "more than one dragon marked Bonded"
|
||||||
|
- "more than one dragon marked Incinerated"
|
||||||
|
- "tree run with both the Red and the two Greens attempted"
|
||||||
|
- "died in combat on a path without combat"
|
||||||
|
- "rare-dragon answer does not match the path"
|
||||||
|
- "does not follow"
|
||||||
|
- "fight answers on a run that did not help"
|
||||||
|
- "a path after the fight on a run without a fight"
|
||||||
|
- "a second fight move without pausing to assess"
|
||||||
|
- "died before the hour, yet reached"
|
||||||
|
|
||||||
|
encounter_colours:
|
||||||
|
"Shadow (rare)": [Blue, Black]
|
||||||
|
"Descend quickly: Red": [Red]
|
||||||
|
"Descend quickly: let the Red pass": [Green]
|
||||||
|
"Descend slowly: two Greens": [Green, Orange, Brown]
|
||||||
|
"Valley Red": [Red]
|
||||||
|
"Passed the Red: meadow": [Orange, Brown, Blue]
|
||||||
|
|
||||||
|
# First-sighting answers that are not a single colour: coded as this colour, and the row is flagged with the
|
||||||
|
# original answer (data_flags), so nothing is lost.
|
||||||
|
first_sighting_alias:
|
||||||
|
"2 Greens": Green
|
||||||
|
|
||||||
|
# How a bulk-pasted row's attempt answer is read
|
||||||
|
attempt_words: { first: 1, second: 2, third: 3, fourth: 4, fifth: 5 }
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
# What the site measures: outcomes and their denominators, route targets and their comparison groups, the
|
||||||
|
# bonding-encounter contexts, the stages of the route map, the filter presets and the minimum-run thresholds.
|
||||||
|
# analysis/stats/site_stats.py reads this file and writes data/public/stats.json, which the page only displays.
|
||||||
|
#
|
||||||
|
# Conditions: {field: value} means equal; {field: {in: [...]}}, {field: {not: value}}, {field: {exists: true}}
|
||||||
|
# (not blank), {any: [condition, ...]} (at least one). Several fields in one condition must all hold.
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
# Which runs of data/public/runs_clean.csv the statistics use (its `source` column): every source that records the
|
||||||
|
# route (the community form, "Report a run", the Reddit megathread comments, the DragonKind bot). The Reddit result
|
||||||
|
# pages and the register record only the end, so they stay out. The bot plays to a strategy and burns on purpose at
|
||||||
|
# encounters it is not chasing: like every rider's deliberate death (`_deliberate`, the route model's rule), those
|
||||||
|
# burns are left out of the bond rates, never counted as failed bonds.
|
||||||
|
sources: [reddit spreadsheet, reported, reddit comment, bot]
|
||||||
|
|
||||||
|
colours: [Red, Green, Orange, Brown, Blue, Black]
|
||||||
|
|
||||||
|
# Outcomes for the factor tables and models: who could have had the outcome (denom), and the outcome (event).
|
||||||
|
outcomes:
|
||||||
|
blue_meadow:
|
||||||
|
label: Blue appears in the meadow
|
||||||
|
denom: { branch: "Passed the Red: meadow" }
|
||||||
|
event: { saw_blue_meadow: true }
|
||||||
|
shadow:
|
||||||
|
label: Shadow option appears at the tree
|
||||||
|
denom: { hour: Tree, branch: { exists: true } }
|
||||||
|
event: { saw_shadow: true }
|
||||||
|
bond_blue_meadow:
|
||||||
|
label: Bond, given you approached the meadow Blue
|
||||||
|
denom: { branch: "Passed the Red: meadow", enc_Blue: { in: ["Bonded!", "Incinerated"] }, _deliberate: { not: true } }
|
||||||
|
event: { enc_Blue: "Bonded!" }
|
||||||
|
reach_hour:
|
||||||
|
label: Survive to the hour (tree/valley choice)
|
||||||
|
denom: {}
|
||||||
|
event: { hour: { in: [Tree, Valley] } }
|
||||||
|
# one more outcome per colour: "Run ends bonded to <colour>", among runs that reached the hour
|
||||||
|
bonded_outcome:
|
||||||
|
label: Run ends bonded to {colour}
|
||||||
|
denom: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } }
|
||||||
|
event: { outcome: Bonded, outcome_color: "{colour}" }
|
||||||
|
|
||||||
|
# Factors compared in the factor tables (each answer against the other answers to the same question)
|
||||||
|
factors: [company, direction, first_sighting, scream, resolution, combat_first, post_path, hour, wing, squad,
|
||||||
|
attempt_group, entry, goal, sighting_action, combat_second, malek_intent]
|
||||||
|
|
||||||
|
# Route targets: the outcome (event) and which runs could have reached it at all (pool)
|
||||||
|
targets:
|
||||||
|
bond_Blue: { label: Bond Blue, colour: Blue, event: { outcome: Bonded, outcome_color: Blue }, pool: { hour: Valley, _deliberate: { not: true } } }
|
||||||
|
bond_Black: { label: Bond Black, colour: Black, event: { outcome: Bonded, outcome_color: Black }, pool: { hour: Tree, _deliberate: { not: true } } }
|
||||||
|
see_Blue: { label: Meet a Blue (meadow), colour: Blue, event: { saw_blue_meadow: true }, pool: { branch: "Passed the Red: meadow" } }
|
||||||
|
see_shadow: { label: Get the tree shadow, colour: Black, event: { saw_shadow: true }, pool: { hour: Tree, branch: { exists: true } } }
|
||||||
|
bond_Red: { label: Bond Red, colour: Red, event: { outcome: Bonded, outcome_color: Red }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||||
|
bond_Green: { label: Bond Green, colour: Green, event: { outcome: Bonded, outcome_color: Green }, pool: { hour: Tree, _deliberate: { not: true } } }
|
||||||
|
bond_Orange: { label: Bond Orange, colour: Orange, event: { outcome: Bonded, outcome_color: Orange }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||||
|
bond_Brown: { label: Bond Brown, colour: Brown, event: { outcome: Bonded, outcome_color: Brown }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||||
|
bond_any: { label: Bond any dragon, colour: null, event: { outcome: Bonded }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||||
|
|
||||||
|
# Bonding encounters: which recorded attempt (column) belongs to which in-game encounter (where)
|
||||||
|
encounters:
|
||||||
|
- { context: "Red (tree, descend quickly)", colour: Red, column: enc_Red, where: { hour: Tree, branch: "Descend quickly: Red" } }
|
||||||
|
- { context: "Green (two Greens)", colour: Green, column: enc_Green, where: { hour: Tree, any: [ { branch: "Descend slowly: two Greens" }, { branch: "Descend quickly: let the Red pass" } ] } }
|
||||||
|
- { context: "Blue (shadow)", colour: Blue, column: enc_Blue, where: { hour: Tree, branch: "Shadow (rare)" } }
|
||||||
|
- { context: "Black (shadow)", colour: Black, column: enc_Black, where: { hour: Tree, branch: "Shadow (rare)" } }
|
||||||
|
- { context: "Red (valley)", colour: Red, column: enc_Red, where: { hour: Valley, branch: Valley Red } }
|
||||||
|
- { context: "Orange (meadow)", colour: Orange, column: enc_Orange, where: { hour: Valley, branch: "Passed the Red: meadow" } }
|
||||||
|
- { context: "Brown (meadow)", colour: Brown, column: enc_Brown, where: { hour: Valley, branch: "Passed the Red: meadow" } }
|
||||||
|
- { context: "Blue (meadow)", colour: Blue, column: enc_Blue, where: { hour: Valley, branch: "Passed the Red: meadow" } }
|
||||||
|
|
||||||
|
# The route map's columns, in order. "chance": steps the game rolls, not the rider.
|
||||||
|
stages:
|
||||||
|
- { key: company, label: Company }
|
||||||
|
- { key: direction, label: Direction }
|
||||||
|
- { key: first_sighting, label: First sighting, chance: true }
|
||||||
|
- { key: cadet, label: Cadet encounter }
|
||||||
|
- { key: post_path, label: Fork in the road }
|
||||||
|
- { key: hour, label: After an hour }
|
||||||
|
- { key: encounter, label: Encounter, chance: true }
|
||||||
|
- { key: end, label: Outcome }
|
||||||
|
|
||||||
|
# Filter presets: the page shows one at a time (no statistics are computed in the browser)
|
||||||
|
presets:
|
||||||
|
all: { label: All runs, filters: { source: all, goal: all, excludeFlagged: false } }
|
||||||
|
form: { label: Form submissions only, filters: { source: form, goal: all, excludeFlagged: false } }
|
||||||
|
bulk: { label: Bulk logs only (imports), filters: { source: bulk, goal: all, excludeFlagged: false } }
|
||||||
|
reddit: { label: Reddit comments only, filters: { source: reddit, goal: all, excludeFlagged: false } }
|
||||||
|
bot: { label: DragonKind bot only, filters: { source: bot, goal: all, excludeFlagged: false } }
|
||||||
|
not_chasing: { label: Not chasing Blue/Black, filters: { source: all, goal: exclude_rare, excludeFlagged: false } }
|
||||||
|
chasing: { label: Chasing Blue/Black, filters: { source: all, goal: only_rare, excludeFlagged: false } }
|
||||||
|
unflagged: { label: Rows without data-quality flags, filters: { source: all, goal: all, excludeFlagged: true } }
|
||||||
|
|
||||||
|
# Minimum runs a full route needs before it is ranked (q-values are corrected within each threshold)
|
||||||
|
route_thresholds: [5, 10, 20, 30]
|
||||||
|
|
||||||
|
rare_goals: [Blue, Black, Blue or Black]
|
||||||
|
|
||||||
|
# "Show the paths of all riders" on the valley map (site/atlas/explorer.js): one layer per source that records a
|
||||||
|
# route, each with its own switch. Unlike everything above, the layers use every source of runs_clean.csv. Within a
|
||||||
|
# layer the runs are split by how they ended, drawn as line styles in the layer's colour: solid (did not die), dashed
|
||||||
|
# (chose to die: burned at an encounter the rider did not genuinely attempt, the route model's rule) and dotted
|
||||||
|
# (failed: every other death). Discord has no runs yet: its layer is ready for when it is imported.
|
||||||
|
path_layers:
|
||||||
|
- { key: sheet, label: "Google Sheet", sources: [reddit spreadsheet] }
|
||||||
|
- { key: reported, label: "Reported on the Atlas", sources: [reported] }
|
||||||
|
- { key: reddit, label: "Reddit megathread comments", sources: [reddit comment] }
|
||||||
|
- { key: bot, label: "DragonKind bot", sources: [bot] }
|
||||||
|
- { key: discord, label: "Discord", sources: [discord] }
|
||||||
|
# sources that record which dragon bonded but not the route: counted on the map, not drawn
|
||||||
|
path_unrouted: [reddit thread, register]
|
||||||
@@ -0,0 +1,595 @@
|
|||||||
|
"""Every number the Atlas page shows, precomputed: data/public/stats.json.
|
||||||
|
|
||||||
|
The page only displays these; it computes no statistics itself. What is measured (outcomes, route targets,
|
||||||
|
encounters, the route map's stages, the filter presets and route thresholds) is declared in measures.yaml.
|
||||||
|
|
||||||
|
python analysis/stats/site_stats.py [--out data/public/stats.json]
|
||||||
|
"""
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
HERE = Path(__file__).resolve().parent
|
||||||
|
ROOT = HERE.parents[1]
|
||||||
|
sys.path.insert(0, str(ROOT / "core"))
|
||||||
|
sys.path.insert(0, str(HERE))
|
||||||
|
from atlas import coding, model # noqa: E402
|
||||||
|
from atlas import runs as runs_io # noqa: E402
|
||||||
|
from stats_core import Z95, bh, logistic_ridge, mantel_haenszel, odds_ratio, p_from_z # noqa: E402
|
||||||
|
from stats_core import wilson as _wilson # noqa: E402
|
||||||
|
|
||||||
|
M = yaml.safe_load(open(HERE / "measures.yaml", encoding="utf-8"))
|
||||||
|
COLOURS = M["colours"]
|
||||||
|
is_missing = coding.is_missing
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- conditions from measures.yaml
|
||||||
|
|
||||||
|
def match(r, cond):
|
||||||
|
for k, want in cond.items():
|
||||||
|
if k == "any":
|
||||||
|
if not any(match(r, c) for c in want):
|
||||||
|
return False
|
||||||
|
continue
|
||||||
|
v = r.get(k)
|
||||||
|
if isinstance(want, dict):
|
||||||
|
if "in" in want and v not in want["in"]:
|
||||||
|
return False
|
||||||
|
if "not" in want and v == want["not"]:
|
||||||
|
return False
|
||||||
|
if "exists" in want and (v is not None and v != "") != want["exists"]:
|
||||||
|
return False
|
||||||
|
elif v != want:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def _fill(cond, colour):
|
||||||
|
return json.loads(json.dumps(cond).replace("{colour}", colour))
|
||||||
|
|
||||||
|
|
||||||
|
OUTCOMES = {k: v for k, v in M["outcomes"].items()}
|
||||||
|
for c in COLOURS:
|
||||||
|
b = M["bonded_outcome"]
|
||||||
|
OUTCOMES["bonded_" + c] = {"label": b["label"].replace("{colour}", c), "denom": b["denom"], "event": _fill(b["event"], c)}
|
||||||
|
TARGETS = M["targets"]
|
||||||
|
STAGES = M["stages"]
|
||||||
|
|
||||||
|
|
||||||
|
def W(k, n):
|
||||||
|
p, lo, hi = _wilson(k, n)
|
||||||
|
return {"k": int(k), "n": int(n), "p": p, "lo": lo, "hi": hi}
|
||||||
|
|
||||||
|
|
||||||
|
def rate(runs, pred):
|
||||||
|
return W(sum(1 for r in runs if pred(r)), len(runs))
|
||||||
|
|
||||||
|
|
||||||
|
def group_by(runs, key):
|
||||||
|
out = {}
|
||||||
|
for r in runs:
|
||||||
|
k = key(r) if callable(key) else r.get(key)
|
||||||
|
out.setdefault(_key(k), []).append(r)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def _key(v):
|
||||||
|
"""Object keys as JavaScript writes them (true/false/null), so the page can look them up as before."""
|
||||||
|
if v is True:
|
||||||
|
return "true"
|
||||||
|
if v is False:
|
||||||
|
return "false"
|
||||||
|
if v is None:
|
||||||
|
return "null"
|
||||||
|
if isinstance(v, float) and v.is_integer():
|
||||||
|
return str(int(v))
|
||||||
|
return str(v)
|
||||||
|
|
||||||
|
|
||||||
|
def is_rare(goal):
|
||||||
|
return goal in M["rare_goals"]
|
||||||
|
|
||||||
|
|
||||||
|
# sources other than the community spreadsheet: their own group wherever runs are split by where they came from
|
||||||
|
SOURCE_LABEL = {"reddit comment": "Reddit comments", "bot": "DragonKind bot", "reported": "Reported on the Atlas"}
|
||||||
|
|
||||||
|
|
||||||
|
def entry_group(r):
|
||||||
|
"""Where a run came from: the spreadsheet's entry type (Form, Data Import, ...) or the source's own label."""
|
||||||
|
return SOURCE_LABEL.get(r["source"]) or r["entry"]
|
||||||
|
|
||||||
|
|
||||||
|
def stratum(r):
|
||||||
|
if r["source"] in SOURCE_LABEL:
|
||||||
|
return SOURCE_LABEL[r["source"]]
|
||||||
|
if r["entry"] != "Form":
|
||||||
|
return "Bulk logs (imports)"
|
||||||
|
g = r["goal"]
|
||||||
|
return {"Blue": "Form: chasing Blue", "Black": "Form: chasing Black", "Blue or Black": "Form: chasing Blue or Black"}.get(g, "Form: other/blank goal")
|
||||||
|
|
||||||
|
|
||||||
|
def goal2(r):
|
||||||
|
return r["goal"] if is_rare(r["goal"]) else "Blank/not asked" if r["goal"] == "(not asked/blank)" else "Other colour/any"
|
||||||
|
|
||||||
|
|
||||||
|
def apply_filters(runs, f):
|
||||||
|
def ok(r):
|
||||||
|
sheet = r["source"] == "reddit spreadsheet"
|
||||||
|
if f.get("source") == "form" and not (sheet and r["entry"] == "Form"):
|
||||||
|
return False
|
||||||
|
if f.get("source") == "bulk" and not (sheet and r["entry"] != "Form"):
|
||||||
|
return False
|
||||||
|
if f.get("source") == "reddit" and r["source"] != "reddit comment":
|
||||||
|
return False
|
||||||
|
if f.get("source") == "bot" and r["source"] != "bot":
|
||||||
|
return False
|
||||||
|
if f.get("goal") == "exclude_rare" and is_rare(r["goal"]):
|
||||||
|
return False
|
||||||
|
if f.get("goal") == "only_rare" and not is_rare(r["goal"]):
|
||||||
|
return False
|
||||||
|
if f.get("excludeFlagged") and r["data_flags"]:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
return [r for r in runs if ok(r)]
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- tables and models
|
||||||
|
|
||||||
|
def odds(a, b, c, d):
|
||||||
|
or_, lo, hi, p, corr = odds_ratio(a, b, c, d)
|
||||||
|
return {"or": or_, "or_lo": lo, "or_hi": hi, "fisher_p": p, "corrected": corr}
|
||||||
|
|
||||||
|
|
||||||
|
def factor_table(runs, key, min_n=5):
|
||||||
|
O = OUTCOMES[key]
|
||||||
|
D = [r for r in runs if match(r, O["denom"])]
|
||||||
|
ev = lambda r: match(r, O["event"]) # noqa: E731
|
||||||
|
rows, missing = [], {}
|
||||||
|
for f in M["factors"]:
|
||||||
|
known = [r for r in D if not is_missing(r.get(f))]
|
||||||
|
missing[f] = len(D) - len(known)
|
||||||
|
groups = group_by(known, f)
|
||||||
|
nf, ef = len(known), sum(1 for r in known if ev(r))
|
||||||
|
for lv in sorted(groups):
|
||||||
|
g = groups[lv]
|
||||||
|
k, n = sum(1 for r in g if ev(r)), len(g)
|
||||||
|
row = {"factor": f, "level": lv, **W(k, n)}
|
||||||
|
rk, rn = ef - k, nf - n
|
||||||
|
if n >= min_n and rn >= min_n and 0 < ef < nf:
|
||||||
|
row.update(odds(k, n - k, rk, rn - rk))
|
||||||
|
rows.append(row)
|
||||||
|
tested = [r for r in rows if "fisher_p" in r]
|
||||||
|
for r, q in zip(tested, bh([r["fisher_p"] for r in tested])):
|
||||||
|
r["q"] = q
|
||||||
|
return {"outcome": key, "label": O["label"], "overall": W(sum(1 for r in D if ev(r)), len(D)), "rows": rows, "missing": missing}
|
||||||
|
|
||||||
|
|
||||||
|
def fit_model(runs, key, factors, lam=1.0):
|
||||||
|
import numpy as np
|
||||||
|
O = OUTCOMES[key]
|
||||||
|
D = []
|
||||||
|
for r in runs:
|
||||||
|
if not match(r, O["denom"]):
|
||||||
|
continue
|
||||||
|
o = {"y": 1 if match(r, O["event"]) else 0, **{name: fn(r) for name, fn in factors.items()}}
|
||||||
|
if all(o[f] is not None for f in factors):
|
||||||
|
D.append(o)
|
||||||
|
if len(D) < 20:
|
||||||
|
return None
|
||||||
|
cols, names, refs = [np.ones(len(D))], [], {}
|
||||||
|
for f in factors:
|
||||||
|
counts = group_by(D, f)
|
||||||
|
levels = sorted(counts, key=lambda lv: (-len(counts[lv]), lv))
|
||||||
|
refs[f] = levels[0]
|
||||||
|
for lv in levels[1:]:
|
||||||
|
cols.append(np.array([1.0 if _key(o[f]) == lv else 0.0 for o in D]))
|
||||||
|
names.append((f, lv, len(counts[lv])))
|
||||||
|
y = np.array([o["y"] for o in D])
|
||||||
|
b, se = logistic_ridge(np.column_stack(cols), y, lam)
|
||||||
|
terms = [{"term": f"{f} = {lv}", "factor": f, "level": lv, "n": n, "or": math.exp(b[i + 1]),
|
||||||
|
"lo": math.exp(b[i + 1] - Z95 * se[i + 1]), "hi": math.exp(b[i + 1] + Z95 * se[i + 1]),
|
||||||
|
"p": float(p_from_z(b[i + 1] / se[i + 1]))} for i, (f, lv, n) in enumerate(names)]
|
||||||
|
return {"outcome": key, "label": O["label"], "n": len(D), "events": int(y.sum()), "refs": refs, "lambda": lam, "terms": terms}
|
||||||
|
|
||||||
|
|
||||||
|
def route_key(r):
|
||||||
|
return [r["company"], r["direction"], r["first_sighting"], r["scream"], r["resolution"], r.get("post_path") or "—", r.get("hour") or "—"]
|
||||||
|
|
||||||
|
|
||||||
|
def analyse(all_runs, filters):
|
||||||
|
runs = apply_filters(all_runs, filters)
|
||||||
|
res = {"filters": filters, "n": len(runs)}
|
||||||
|
|
||||||
|
flag_counts = {}
|
||||||
|
for r in runs:
|
||||||
|
for f in (r["data_flags"].split("; ") if r["data_flags"] else []):
|
||||||
|
k = "first sighting outside documented pool" if f.startswith("first sighting") else f
|
||||||
|
flag_counts[k] = flag_counts.get(k, 0) + 1
|
||||||
|
dates = sorted(r["date"] for r in runs if r.get("date"))
|
||||||
|
outs = group_by(runs, lambda r: r["outcome"] + (" " + r["outcome_color"] if r.get("outcome_color") else ""))
|
||||||
|
res["meta"] = {
|
||||||
|
"sources": {k: len(v) for k, v in group_by(runs, entry_group).items()},
|
||||||
|
"date_min": dates[0] if dates else None, "date_max": dates[-1] if dates else None,
|
||||||
|
"n_flagged": sum(1 for r in runs if r["data_flags"]), "flag_counts": flag_counts,
|
||||||
|
"outcomes": {k: len(v) for k, v in outs.items()},
|
||||||
|
}
|
||||||
|
|
||||||
|
res["chance"] = {}
|
||||||
|
for key in ("blue_meadow", "shadow"):
|
||||||
|
O = OUTCOMES[key]
|
||||||
|
D = [r for r in runs if match(r, O["denom"])]
|
||||||
|
ev = lambda r, O=O: match(r, O["event"]) # noqa: E731
|
||||||
|
by = lambda k: {s: rate(g, ev) for s, g in sorted(group_by(D, k).items())} # noqa: E731
|
||||||
|
form = [r for r in D if r["entry"] == "Form"]
|
||||||
|
res["chance"][key] = {"label": O["label"], "overall": rate(D, ev), "by_stratum": by(stratum), "by_goal": by("goal"),
|
||||||
|
"by_attempt": by("attempt_group"), "form_overall": rate(form, ev)}
|
||||||
|
|
||||||
|
fs = group_by([r for r in runs if not is_missing(r["direction"]) and not is_missing(r["company"])], lambda r: r["company"] + "|" + r["direction"])
|
||||||
|
res["first_sighting"] = [{"key": k, "n": len(g), "colors": {c: len(v) for c, v in sorted(group_by(g, "first_sighting").items())}}
|
||||||
|
for k, g in sorted(fs.items())]
|
||||||
|
|
||||||
|
res["encounters"] = []
|
||||||
|
for e in M["encounters"]:
|
||||||
|
col, colour = e["column"], e["colour"]
|
||||||
|
# a rider who chose to burn here (chasing another colour) did not fail this encounter
|
||||||
|
A = [r for r in runs if match(r, e["where"]) and r.get(col) in ("Bonded!", "Incinerated") and not r.get("_deliberate")]
|
||||||
|
win = lambda r, col=col: r.get(col) == "Bonded!" # noqa: E731
|
||||||
|
intent = [r for r in A if r["goal"] == colour or r["goal"].startswith("Any") or (r["goal"] == "Blue or Black" and colour in ("Blue", "Black"))]
|
||||||
|
res["encounters"].append({"context": e["context"], "color": colour, "overall": rate(A, win), "intent_matched": rate(intent, win),
|
||||||
|
"by_stratum": {s: rate(g, win) for s, g in sorted(group_by(A, stratum).items())}})
|
||||||
|
greens_where = next(e["where"] for e in M["encounters"] if e["colour"] == "Green")
|
||||||
|
greens = [r for r in runs if match(r, greens_where) and r.get("enc_Green") and not r.get("_deliberate")]
|
||||||
|
g = {"green_encounters": len(greens),
|
||||||
|
"bonded_green": sum(1 for r in greens if r["enc_Green"] == "Bonded!"),
|
||||||
|
"rescued_orange": sum(1 for r in greens if r["rescued"] and r.get("outcome_color") == "Orange"),
|
||||||
|
"rescued_brown": sum(1 for r in greens if r["rescued"] and r.get("outcome_color") == "Brown"),
|
||||||
|
"incinerated": sum(1 for r in greens if r["outcome"] == "Incinerated")}
|
||||||
|
g["no_outcome"] = g["green_encounters"] - g["bonded_green"] - g["rescued_orange"] - g["rescued_brown"] - g["incinerated"]
|
||||||
|
g["rates"] = {k: W(g[k], g["green_encounters"]) for k in ("bonded_green", "rescued_orange", "rescued_brown", "incinerated", "no_outcome")}
|
||||||
|
res["green_rescue"] = g
|
||||||
|
|
||||||
|
res["factors"] = {k: factor_table(runs, k) for k in OUTCOMES}
|
||||||
|
|
||||||
|
first2 = lambda r: r["first_sighting"] if r["first_sighting"] in ("Red", "Brown", "Orange", "Green") else None # noqa: E731
|
||||||
|
known = lambda f: (lambda r: None if is_missing(r.get(f)) else r[f]) # noqa: E731
|
||||||
|
src2 = lambda r: SOURCE_LABEL.get(r["source"]) or ("Form submission" if r["entry"] == "Form" else "Bulk log (import)") # noqa: E731
|
||||||
|
res["models"] = {
|
||||||
|
"blue_meadow": fit_model(runs, "blue_meadow", {"source": src2, "goal": goal2, "direction": known("direction"),
|
||||||
|
"first_sighting": first2, "resolution": known("resolution"), "company": known("company")}),
|
||||||
|
"shadow": fit_model(runs, "shadow", {"source": src2, "goal": goal2, "attempt": known("attempt_group"), "direction": known("direction")}),
|
||||||
|
"bond_blue_meadow": fit_model(runs, "bond_blue_meadow", {"source": src2, "goal": goal2, "direction": known("direction"), "resolution": known("resolution")}),
|
||||||
|
}
|
||||||
|
|
||||||
|
res["daily"] = []
|
||||||
|
for d, gr in sorted(group_by([r for r in runs if r.get("date")], "date").items()):
|
||||||
|
m = [r for r in gr if match(r, OUTCOMES["blue_meadow"]["denom"])]
|
||||||
|
t = [r for r in gr if match(r, OUTCOMES["shadow"]["denom"])]
|
||||||
|
bk, sk = sum(1 for r in m if r["saw_blue_meadow"]), sum(1 for r in t if r["saw_shadow"])
|
||||||
|
res["daily"].append({"date": d, "runs": len(gr), "meadow_n": len(m), "blue_k": bk, "tree_n": len(t), "shadow_k": sk,
|
||||||
|
"blue": W(bk, len(m)), "shadow": W(sk, len(t))})
|
||||||
|
|
||||||
|
res["source_rates"] = {key: {s: rate([r for r in g if match(r, OUTCOMES[key]["denom"])], lambda r, k=key: match(r, OUTCOMES[k]["event"]))
|
||||||
|
for s, g in group_by(runs, entry_group).items()} for key in ("blue_meadow", "shadow")}
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- route map and route rankings
|
||||||
|
|
||||||
|
def stage_value(r, key):
|
||||||
|
if key in ("company", "direction", "post_path"):
|
||||||
|
return None if is_missing(r.get(key)) else r[key]
|
||||||
|
if key == "first_sighting":
|
||||||
|
return None if r["scream"] == "DIED at first sighting" or is_missing(r["first_sighting"]) else r["first_sighting"]
|
||||||
|
if key == "cadet":
|
||||||
|
if r["scream"].startswith("DIED") or is_missing(r["scream"]) or is_missing(r["resolution"]):
|
||||||
|
return None
|
||||||
|
return "Help → " + r["resolution"] if r["scream"] == "Investigate & help" else r["scream"] + " → " + r["resolution"]
|
||||||
|
if key == "hour":
|
||||||
|
return "Climb the tree" if r.get("hour") == "Tree" else "Valley centre" if r.get("hour") == "Valley" else None
|
||||||
|
if key == "encounter":
|
||||||
|
if not r.get("branch"):
|
||||||
|
return None
|
||||||
|
if r["hour"] == "Tree":
|
||||||
|
if r["branch"] == "Shadow (rare)":
|
||||||
|
return "Tree: shadow → Blue/Black"
|
||||||
|
if r["branch"] == "Descend quickly: Red":
|
||||||
|
return "Tree: Red below"
|
||||||
|
return "Tree: two Greens"
|
||||||
|
if r["branch"] == "Valley Red":
|
||||||
|
return "Valley: bond the Red"
|
||||||
|
for cond, label in ((r.get("enc_Blue"), "Meadow: Blue"), (r.get("enc_Orange") and r.get("enc_Brown"), "Meadow: Orange/Brown"),
|
||||||
|
(r.get("enc_Orange"), "Meadow: Orange"), (r.get("enc_Brown"), "Meadow: Brown")):
|
||||||
|
if cond:
|
||||||
|
return label
|
||||||
|
return "Meadow (no attempt recorded)"
|
||||||
|
if key == "end":
|
||||||
|
if r["outcome"] == "Bonded":
|
||||||
|
return "Bonded " + r["outcome_color"]
|
||||||
|
if r["outcome"] in ("Incinerated", "Died before the hour"):
|
||||||
|
return r["outcome"]
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def route_map(runs):
|
||||||
|
"""The route map: nodes and links with run counts, and for every target the hits and their Wilson interval."""
|
||||||
|
nodes, links = {}, {}
|
||||||
|
hits = {t: {} for t in TARGETS}
|
||||||
|
tries = {t: {} for t in TARGETS} # runs that count for the target (no deliberate deaths for a bond)
|
||||||
|
for r in runs:
|
||||||
|
prev = None
|
||||||
|
hit = {t: match(r, T["event"]) for t, T in TARGETS.items()}
|
||||||
|
counts = {t: not (r.get("_deliberate") and t.startswith("bond_")) for t in TARGETS}
|
||||||
|
for si, s in enumerate(STAGES):
|
||||||
|
v = stage_value(r, s["key"])
|
||||||
|
if v is None:
|
||||||
|
continue
|
||||||
|
nid = f"{si}|{v}"
|
||||||
|
nd = nodes.setdefault(nid, {"id": nid, "stage": si, "stageKey": s["key"], "value": v, "n": 0})
|
||||||
|
nd["n"] += 1
|
||||||
|
for t in TARGETS:
|
||||||
|
hits[t][nid] = hits[t].get(nid, 0) + hit[t]
|
||||||
|
tries[t][nid] = tries[t].get(nid, 0) + counts[t]
|
||||||
|
if prev:
|
||||||
|
lid = prev + "→" + nid
|
||||||
|
ln = links.setdefault(lid, {"id": lid, "source": prev, "target": nid, "n": 0, "chance": bool(s.get("chance"))})
|
||||||
|
ln["n"] += 1
|
||||||
|
for t in TARGETS:
|
||||||
|
hits[t][lid] = hits[t].get(lid, 0) + hit[t]
|
||||||
|
tries[t][lid] = tries[t].get(lid, 0) + counts[t]
|
||||||
|
prev = nid
|
||||||
|
nl, ll = list(nodes.values()), list(links.values())
|
||||||
|
by_target = {t: {"nodes": [W(hits[t][n["id"]], tries[t][n["id"]]) for n in nl],
|
||||||
|
"links": [W(hits[t][l["id"]], tries[t][l["id"]]) for l in ll]} for t in TARGETS}
|
||||||
|
return {"nodes": nl, "links": ll, "by_target": by_target}
|
||||||
|
|
||||||
|
|
||||||
|
def rank_routes(runs, target, thresholds):
|
||||||
|
"""Full routes (every choice up to the hour), ranked for one target. Each route with at least min_n runs is
|
||||||
|
compared with all other runs that could reach the target (Fisher), and within data-source / chase-goal strata
|
||||||
|
(Mantel-Haenszel). q-values are corrected within each threshold. Ranked by the lower end of the 95% interval."""
|
||||||
|
T = TARGETS[target]
|
||||||
|
ev = lambda r: match(r, T["event"]) # noqa: E731
|
||||||
|
key_stages = [s["key"] for s in STAGES[:6]]
|
||||||
|
pool = [r for r in runs if match(r, T["pool"])]
|
||||||
|
tot_k, tot_n = sum(1 for r in pool if ev(r)), len(pool)
|
||||||
|
full = [r for r in pool if all(stage_value(r, k) or (k == "post_path" and r.get("post_path") is None) for k in key_stages)]
|
||||||
|
groups = group_by(full, lambda r: " › ".join(stage_value(r, k) or "—" for k in key_stages))
|
||||||
|
strata = list(group_by(pool, stratum).values())
|
||||||
|
rows = []
|
||||||
|
for key, g in groups.items():
|
||||||
|
if len(g) < min(thresholds):
|
||||||
|
continue
|
||||||
|
k, n = sum(1 for r in g if ev(r)), len(g)
|
||||||
|
o = {"route": key, "values": [stage_value(g[0], s) for s in key_stages], **W(k, n)}
|
||||||
|
o.update(odds(k, n - k, tot_k - k, tot_n - n - (tot_k - k)))
|
||||||
|
ids = {id(r) for r in g}
|
||||||
|
tabs = []
|
||||||
|
for sg in strata:
|
||||||
|
a = sum(1 for r in sg if id(r) in ids and ev(r))
|
||||||
|
nin = sum(1 for r in sg if id(r) in ids)
|
||||||
|
c = sum(1 for r in sg if id(r) not in ids and ev(r))
|
||||||
|
tabs.append([a, nin - a, c, len(sg) - nin - c])
|
||||||
|
mh = mantel_haenszel(tabs)
|
||||||
|
o.update(dict(zip(("mh_or", "mh_lo", "mh_hi", "mh_p"), mh)) if mh else {"mh_or": None, "mh_lo": None, "mh_hi": None, "mh_p": None})
|
||||||
|
rows.append(o)
|
||||||
|
rows.sort(key=lambda r: (-r["lo"], -r["n"]))
|
||||||
|
out = {"target": target, "overall": W(tot_k, tot_n), "rows": rows, "by_threshold": {}}
|
||||||
|
for m in thresholds:
|
||||||
|
idx = [i for i, r in enumerate(rows) if r["n"] >= m]
|
||||||
|
q = bh([rows[i]["fisher_p"] for i in idx])
|
||||||
|
mi = [i for i in idx if rows[i]["mh_p"] is not None]
|
||||||
|
mq = bh([rows[i]["mh_p"] for i in mi])
|
||||||
|
out["by_threshold"][str(m)] = {"n_routes_tested": len(idx), "q": {str(i): v for i, v in zip(idx, q)},
|
||||||
|
"mh_q": {str(i): v for i, v in zip(mi, mq)}}
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- the valley map and the summary cards
|
||||||
|
|
||||||
|
def place_ids():
|
||||||
|
"""The places drawn on the valley map (the keys of L in site/atlas/valley.js)."""
|
||||||
|
src = (ROOT / "site/atlas/valley.js").read_text(encoding="utf-8")
|
||||||
|
body = src[src.index("const L = {"):]
|
||||||
|
body = body[:body.index("\n };")]
|
||||||
|
return set(re.findall(r'^\s{4}"?([^":{}\n]+(?::[^":{}\n]+)*)"?:\s*\{\s*x:', body, re.M))
|
||||||
|
|
||||||
|
|
||||||
|
PLACES = None
|
||||||
|
|
||||||
|
|
||||||
|
def place_path(r):
|
||||||
|
"""The places a run passed through, as drawn on the valley map (mirrors path() in valley.js)."""
|
||||||
|
L = PLACES
|
||||||
|
s = []
|
||||||
|
if "comp:" + str(r["company"]) in L:
|
||||||
|
s.append("comp:" + r["company"])
|
||||||
|
if r["direction"] not in ("East", "West", "Center"):
|
||||||
|
return s
|
||||||
|
s.append("dir:" + r["direction"])
|
||||||
|
sight = f"see:{r['direction']}:{r['first_sighting']}"
|
||||||
|
if sight in L:
|
||||||
|
s.append(sight)
|
||||||
|
if r["scream"] in ("DIED at first sighting", "Unknown"):
|
||||||
|
return s
|
||||||
|
s.append("scream")
|
||||||
|
if r["scream"] == "Investigate & help":
|
||||||
|
s.append("bully")
|
||||||
|
if "res:" + r["resolution"] in L:
|
||||||
|
s.append("res:" + r["resolution"])
|
||||||
|
if (r.get("resolution") or "").startswith("DIED"):
|
||||||
|
return s
|
||||||
|
if r.get("post_path") in ("Forest", "West", "East"):
|
||||||
|
s.append("fork:" + r["post_path"])
|
||||||
|
elif r["scream"] == "Ignore the scream":
|
||||||
|
s.append("wounded")
|
||||||
|
if "res:" + r["resolution"] in L:
|
||||||
|
s.append("res:" + r["resolution"])
|
||||||
|
elif r["scream"] == "Investigate & leave":
|
||||||
|
s.append("away")
|
||||||
|
if r.get("hour") not in ("Tree", "Valley"):
|
||||||
|
return s
|
||||||
|
s.append("hour")
|
||||||
|
b = r.get("branch")
|
||||||
|
if r["hour"] == "Tree":
|
||||||
|
s.append("tree")
|
||||||
|
if b == "Descend quickly: Red":
|
||||||
|
s.append("treeRed")
|
||||||
|
elif b == "Descend quickly: let the Red pass":
|
||||||
|
s += ["treeRed", "greens"]
|
||||||
|
elif b == "Descend slowly: two Greens":
|
||||||
|
s.append("greens")
|
||||||
|
elif b == "Shadow (rare)":
|
||||||
|
s.append("stream")
|
||||||
|
if r.get("enc_Blue") or r.get("enc_Black"):
|
||||||
|
s.append("redwood")
|
||||||
|
if r.get("enc_Black"):
|
||||||
|
s.append("black")
|
||||||
|
else:
|
||||||
|
s.append("valley")
|
||||||
|
if b == "Valley Red":
|
||||||
|
s.append("valleyRed")
|
||||||
|
elif b == "Passed the Red: meadow":
|
||||||
|
s.append("meadow")
|
||||||
|
oc = r.get("outcome_color")
|
||||||
|
tried = "Blue" if r.get("enc_Blue") else oc if oc in ("Orange", "Brown") else "Orange" if r.get("enc_Orange") else "Brown" if r.get("enc_Brown") else None
|
||||||
|
if tried:
|
||||||
|
s.append("meadow:" + tried)
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def valley(runs):
|
||||||
|
counts, edges = {}, {}
|
||||||
|
for r in runs:
|
||||||
|
seq = place_path(r)
|
||||||
|
for i, p in enumerate(seq):
|
||||||
|
counts[p] = counts.get(p, 0) + 1
|
||||||
|
if i:
|
||||||
|
k = seq[i - 1] + ">" + p
|
||||||
|
edges[k] = edges.get(k, 0) + 1
|
||||||
|
return {"counts": counts, "edges": [[*k.split(">"), n] for k, n in sorted(edges.items(), key=lambda kv: -kv[1])]}
|
||||||
|
|
||||||
|
|
||||||
|
DEATHS = ("Incinerated", "Died before the hour")
|
||||||
|
|
||||||
|
|
||||||
|
def deliberate(r):
|
||||||
|
"""A deliberate death: burned at a bonding encounter the rider did not genuinely attempt (chasing another colour,
|
||||||
|
choosing to die and try again). The route model's own rule."""
|
||||||
|
if r["outcome"] != "Incinerated":
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
v = model.prepare_run(r)
|
||||||
|
return bool(v.get("encCtx")) and not model.genuine_attempt(r, v["encCtx"])
|
||||||
|
except (KeyError, TypeError, ValueError): # a source coded from other questions (e.g. the bot): not known
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def path_layers(runs):
|
||||||
|
"""'Show the paths of all riders' on the valley map: for every layer in measures.yaml path_layers (one source or
|
||||||
|
more), how many runs went from each place to the next (like valley()), split by how the runs ended: `lived` (did
|
||||||
|
not die), `chose` (a deliberate death) and `failed` (every other death), plus where the deaths happened. Every
|
||||||
|
source is used here, not only the statistics' sources. Sources that record no route are counted only."""
|
||||||
|
out = []
|
||||||
|
for layer in M["path_layers"]:
|
||||||
|
sel = [r for r in runs if r["source"] in layer["sources"]]
|
||||||
|
kinds = {"lived": [], "chose": [], "failed": []}
|
||||||
|
for r in sel:
|
||||||
|
kinds["lived" if r["outcome"] not in DEATHS else "chose" if deliberate(r) else "failed"].append(r)
|
||||||
|
ends = {}
|
||||||
|
for k in ("chose", "failed"):
|
||||||
|
e = {}
|
||||||
|
for r in kinds[k]:
|
||||||
|
seq = place_path(r)
|
||||||
|
if seq:
|
||||||
|
e[seq[-1]] = e.get(seq[-1], 0) + 1
|
||||||
|
ends[k] = dict(sorted(e.items(), key=lambda kv: -kv[1]))
|
||||||
|
out.append({"key": layer["key"], "label": layer["label"], "runs": len(sel),
|
||||||
|
"counts": {k: len(v) for k, v in kinds.items()},
|
||||||
|
"lines": {k: valley(v)["edges"] for k, v in kinds.items()}, "ends": ends})
|
||||||
|
unrouted = {s: sum(1 for r in runs if r["source"] == s) for s in M.get("path_unrouted", [])}
|
||||||
|
return {"layers": out, "unrouted": unrouted}
|
||||||
|
|
||||||
|
|
||||||
|
def overview(runs):
|
||||||
|
"""The Odds' summary cards: cadets who went in and either bonded or died. Deliberate deaths (burned at an
|
||||||
|
encounter the rider did not genuinely attempt) and runs with no recorded outcome are left out."""
|
||||||
|
ended = [r for r in runs if r["outcome"] in ("Bonded", "Incinerated", "Died before the hour")]
|
||||||
|
cadets = [r for r in ended if not deliberate(r)]
|
||||||
|
bonded = sum(1 for r in cadets if r["outcome"] == "Bonded")
|
||||||
|
return {"cadets": len(cadets), "bonded": bonded, "dead": len(cadets) - bonded, "deliberate": len(ended) - len(cadets),
|
||||||
|
"early_deaths": sum(1 for r in cadets if r["outcome"] == "Died before the hour")}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- everything
|
||||||
|
|
||||||
|
def clean(o):
|
||||||
|
if isinstance(o, dict):
|
||||||
|
return {str(k): clean(v) for k, v in o.items()}
|
||||||
|
if isinstance(o, (list, tuple)):
|
||||||
|
return [clean(v) for v in o]
|
||||||
|
if hasattr(o, "item"):
|
||||||
|
o = o.item()
|
||||||
|
if isinstance(o, float) and (math.isinf(o) or math.isnan(o)):
|
||||||
|
return None
|
||||||
|
return o
|
||||||
|
|
||||||
|
|
||||||
|
def build(runs, rows, exported=None, every_run=None):
|
||||||
|
global PLACES
|
||||||
|
PLACES = place_ids()
|
||||||
|
th = M["route_thresholds"]
|
||||||
|
out = {
|
||||||
|
"schema": 1,
|
||||||
|
"data": {"form_rows": rows, "runs": len(runs), "exported": exported},
|
||||||
|
"meta": {
|
||||||
|
"presets": {k: v["label"] for k, v in M["presets"].items()}, "route_thresholds": th,
|
||||||
|
"targets": {k: {"label": t["label"], "color": t["colour"]} for k, t in TARGETS.items()},
|
||||||
|
"outcomes": {k: {"label": o["label"]} for k, o in OUTCOMES.items()},
|
||||||
|
"factors": M["factors"], "stages": [{"key": s["key"], "label": s["label"], "chance": bool(s.get("chance"))} for s in STAGES],
|
||||||
|
"missing_values": sorted(coding.MISSING),
|
||||||
|
},
|
||||||
|
"presets": {},
|
||||||
|
}
|
||||||
|
for pid, p in M["presets"].items():
|
||||||
|
sub = apply_filters(runs, p["filters"])
|
||||||
|
out["presets"][pid] = {
|
||||||
|
"label": p["label"], "analyse": analyse(runs, p["filters"]),
|
||||||
|
"routes": {t: rank_routes(sub, t, th) for t in TARGETS},
|
||||||
|
"map": route_map(sub), "valley": valley(sub), "overview": overview(sub),
|
||||||
|
}
|
||||||
|
if every_run is not None:
|
||||||
|
out["paths"] = path_layers(every_run)
|
||||||
|
return clean(out)
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=None):
|
||||||
|
ap = argparse.ArgumentParser(description=__doc__)
|
||||||
|
ap.add_argument("--data", default=str(runs_io.PATH))
|
||||||
|
ap.add_argument("--out", default=str(ROOT / "data/public/stats.json"))
|
||||||
|
a = ap.parse_args(argv)
|
||||||
|
# a run that cannot have happened as recorded (core/spec/form.yaml impossible_flags) is left out, as in the model
|
||||||
|
runs = [r for r in runs_io.read(a.data, sources=M["sources"]) if not runs_io.impossible(r)]
|
||||||
|
for r in runs:
|
||||||
|
r["_deliberate"] = deliberate(r)
|
||||||
|
every = [r for r in runs_io.read(a.data) if not runs_io.impossible(r)]
|
||||||
|
out = build(runs, len(runs), exported(), every_run=every)
|
||||||
|
Path(a.out).write_text(json.dumps(out, separators=(",", ":"), ensure_ascii=False), encoding="utf-8")
|
||||||
|
print(f"{a.out}: {len(runs)} runs, {len(out['presets'])} presets, {Path(a.out).stat().st_size / 1e6:.1f} MB")
|
||||||
|
|
||||||
|
|
||||||
|
def exported():
|
||||||
|
"""When the community spreadsheet last changed (data/manifest.json), else the date in its public file."""
|
||||||
|
m = ROOT / "data/manifest.json"
|
||||||
|
entry = json.loads(m.read_text(encoding="utf-8")).get("reddit_spreadsheet") if m.exists() else None
|
||||||
|
if entry:
|
||||||
|
return entry["changed"]
|
||||||
|
return json.loads((ROOT / "data/public/form_responses.json").read_text(encoding="utf-8")).get("exported")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
"""The statistics behind every number on the page: Wilson intervals, odds ratios with Fisher's test, Benjamini-Hochberg
|
||||||
|
q-values, Mantel-Haenszel, ridge logistic regression. Tested against known answers in tests/core/test_stats.py."""
|
||||||
|
import math
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from scipy.stats import fisher_exact, norm
|
||||||
|
|
||||||
|
Z95 = 1.959963984540054
|
||||||
|
|
||||||
|
|
||||||
|
def wilson(k, n, z=Z95):
|
||||||
|
"""Wilson score 95% interval for a proportion k/n. Returns (p, lo, hi); None when n == 0."""
|
||||||
|
if n == 0:
|
||||||
|
return (None, None, None)
|
||||||
|
p = k / n
|
||||||
|
d = 1 + z * z / n
|
||||||
|
c = (p + z * z / (2 * n)) / d
|
||||||
|
h = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
|
||||||
|
return (p, max(0.0, c - h), min(1.0, c + h))
|
||||||
|
|
||||||
|
|
||||||
|
def odds_ratio(a, b, c, d):
|
||||||
|
"""2x2 table [[a, b], [c, d]] = [[exposed&event, exposed&no-event], [unexposed&event, unexposed&no-event]].
|
||||||
|
Returns OR, 95% CI (Woolf log method with Haldane-Anscombe +0.5 correction when any cell is 0),
|
||||||
|
and the two-sided Fisher exact p-value (computed on the uncorrected table)."""
|
||||||
|
corr = 0.5 if 0 in (a, b, c, d) else 0.0
|
||||||
|
A, B, C, D = a + corr, b + corr, c + corr, d + corr
|
||||||
|
or_ = (A * D) / (B * C)
|
||||||
|
se = math.sqrt(1 / A + 1 / B + 1 / C + 1 / D)
|
||||||
|
lo, hi = math.exp(math.log(or_) - Z95 * se), math.exp(math.log(or_) + Z95 * se)
|
||||||
|
p = fisher_exact([[a, b], [c, d]], alternative="two-sided")[1]
|
||||||
|
return or_, lo, hi, p, corr > 0
|
||||||
|
|
||||||
|
|
||||||
|
def bh(pvals):
|
||||||
|
"""Benjamini-Hochberg false-discovery-rate adjusted q-values."""
|
||||||
|
m = len(pvals)
|
||||||
|
if m == 0:
|
||||||
|
return []
|
||||||
|
order = sorted(range(m), key=lambda i: pvals[i])
|
||||||
|
q = [0.0] * m
|
||||||
|
prev = 1.0
|
||||||
|
for rank in range(m, 0, -1):
|
||||||
|
i = order[rank - 1]
|
||||||
|
prev = min(prev, pvals[i] * m / rank)
|
||||||
|
q[i] = prev
|
||||||
|
return q
|
||||||
|
|
||||||
|
|
||||||
|
def logistic_ridge(X, y, lam=1.0, iters=100, tol=1e-10):
|
||||||
|
"""Logistic regression fitted by Newton-Raphson (IRLS) with a small L2 penalty `lam`
|
||||||
|
on every coefficient except the intercept (column 0). The penalty keeps estimates finite
|
||||||
|
when a category has 0 events (complete separation). Returns beta and Wald standard errors
|
||||||
|
from the penalised information matrix."""
|
||||||
|
X = np.asarray(X, float)
|
||||||
|
y = np.asarray(y, float)
|
||||||
|
n, k = X.shape
|
||||||
|
beta = np.zeros(k)
|
||||||
|
P = np.eye(k) * lam
|
||||||
|
P[0, 0] = 0
|
||||||
|
for _ in range(iters):
|
||||||
|
eta = X @ beta
|
||||||
|
mu = 1 / (1 + np.exp(-eta))
|
||||||
|
W = mu * (1 - mu)
|
||||||
|
grad = X.T @ (y - mu) - P @ beta
|
||||||
|
H = (X * W[:, None]).T @ X + P
|
||||||
|
step = np.linalg.solve(H, grad)
|
||||||
|
beta += step
|
||||||
|
if np.max(np.abs(step)) < tol:
|
||||||
|
break
|
||||||
|
mu = 1 / (1 + np.exp(-(X @ beta)))
|
||||||
|
H = (X * (mu * (1 - mu))[:, None]).T @ X + P
|
||||||
|
se = np.sqrt(np.diag(np.linalg.inv(H)))
|
||||||
|
return beta, se
|
||||||
|
|
||||||
|
|
||||||
|
def p_from_z(z):
|
||||||
|
return 2 * (1 - norm.cdf(abs(z)))
|
||||||
|
|
||||||
|
|
||||||
|
def mantel_haenszel(tables):
|
||||||
|
"""Mantel-Haenszel common OR over 2x2 tables [a, b, c, d], Robins-Breslow-Greenland 95% CI,
|
||||||
|
and the CMH chi-square p-value (1 df, continuity-corrected)."""
|
||||||
|
R = S = PR = PSQR = QS = sA = sE = sV = 0.0
|
||||||
|
for a, b, c, d in tables:
|
||||||
|
n = a + b + c + d
|
||||||
|
if n < 2:
|
||||||
|
continue
|
||||||
|
r, s_ = a * d / n, b * c / n
|
||||||
|
P, Q = (a + d) / n, (b + c) / n
|
||||||
|
R += r; S += s_; PR += P * r; PSQR += P * s_ + Q * r; QS += Q * s_
|
||||||
|
m1, m0, n1, n0 = a + b, c + d, a + c, b + d
|
||||||
|
sA += a; sE += m1 * n1 / n; sV += m1 * m0 * n1 * n0 / (n * n * (n - 1))
|
||||||
|
if not R or not S:
|
||||||
|
return None
|
||||||
|
or_ = R / S
|
||||||
|
se = math.sqrt(PR / (2 * R * R) + PSQR / (2 * R * S) + QS / (2 * S * S))
|
||||||
|
chi = max(0.0, abs(sA - sE) - 0.5) ** 2 / sV if sV > 0 else 0.0
|
||||||
|
return or_, math.exp(math.log(or_) - Z95 * se), math.exp(math.log(or_) + Z95 * se), p_from_z(math.sqrt(chi))
|
||||||
+205
@@ -0,0 +1,205 @@
|
|||||||
|
/* register.js — the Dragon Register section: clean, merge, sort and display bonded dragons.
|
||||||
|
* Works in the browser (window.DragonRegister) and in Node (module.exports) for testing. */
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof module === "object" && module.exports) module.exports = factory();
|
||||||
|
else root.DragonRegister = factory();
|
||||||
|
})(typeof self !== "undefined" ? self : this, function () {
|
||||||
|
"use strict";
|
||||||
|
const COLOUR_ORDER = ["Red", "Orange", "Brown", "Green", "Blue", "Black"];
|
||||||
|
const TAILS = ["Clubtail", "Daggertail", "Morningstartail", "Scorpiontail", "Swordtail"];
|
||||||
|
const KEYS = {
|
||||||
|
timestamp: ["timestamp"], cadet: ["cadet name"], wing: ["assignment - wing"], section: ["assignment - section"],
|
||||||
|
squad: ["assignment - squad"], name: ["dragon", "name"], lineage: ["lineage"], colour: ["colour"], tail: ["tail"],
|
||||||
|
sex: ["sex"], age: [/\bage\b/],
|
||||||
|
};
|
||||||
|
const str = (v) => (v === null || v === undefined ? null : String(v).trim() || null);
|
||||||
|
const title = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1).toLowerCase() : s);
|
||||||
|
|
||||||
|
function findCols(headers) {
|
||||||
|
const C = {};
|
||||||
|
for (const [k, words] of Object.entries(KEYS)) {
|
||||||
|
const h = headers.find((x) => words.every((w) => (w instanceof RegExp ? w.test(String(x).toLowerCase()) : String(x).toLowerCase().includes(w))) && !(k === "name" && /cadet/i.test(x)));
|
||||||
|
if (h) C[k] = h;
|
||||||
|
}
|
||||||
|
return C;
|
||||||
|
}
|
||||||
|
function tailOf(v) {
|
||||||
|
const t = (str(v) || "").toLowerCase().replace(/[^a-z]/g, "");
|
||||||
|
return TAILS.find((x) => x.toLowerCase() === t || x.toLowerCase().replace("tail", "") === t) || (t ? title(t) : "Unknown");
|
||||||
|
}
|
||||||
|
function lev(a, b) {
|
||||||
|
const m = a.length, n = b.length, d = Array.from({ length: m + 1 }, (_, i) => [i, ...new Array(n).fill(0)]);
|
||||||
|
for (let j = 1; j <= n; j++) d[0][j] = j;
|
||||||
|
for (let i = 1; i <= m; i++) for (let j = 1; j <= n; j++)
|
||||||
|
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
||||||
|
return d[m][n];
|
||||||
|
}
|
||||||
|
const lkey = (s) => (str(s) || "").toLowerCase().replace(/[^a-z]/g, "");
|
||||||
|
|
||||||
|
// rows: raw register form rows; extra: dragons from other sources (already structured)
|
||||||
|
function build(raw) {
|
||||||
|
const C = findCols(raw.headers || Object.keys(raw.rows[0] || {}));
|
||||||
|
const items = raw.rows.map((r, i) => ({
|
||||||
|
source: "Register form", source_url: null, submitted: str(r[C.timestamp]),
|
||||||
|
cadet: str(r[C.cadet]), wing: str(r[C.wing]), section: str(r[C.section]), squad: str(r[C.squad]),
|
||||||
|
// names typed in capitals ("RAERNUAL") are shown as names ("Raernual")
|
||||||
|
name: ((n) => (n && n.length > 1 && n === n.toUpperCase() ? n[0] + n.slice(1).toLowerCase() : n))(str(r[C.name])), lineage_raw: str(r[C.lineage]), colour: title(str(r[C.colour])), tail: tailOf(r[C.tail]),
|
||||||
|
sex: title(str(r[C.sex])), age: parseInt(r[C.age], 10), flags: [],
|
||||||
|
}));
|
||||||
|
(raw.extra || []).forEach((e) => items.push({
|
||||||
|
source: "Reddit (dragonkind.com result page)", source_url: e.url, submitted: null, cadet: null, wing: null, section: null, squad: null,
|
||||||
|
name: str(e.name), lineage_raw: str(e.lineage), colour: title(e.colour), tail: tailOf(e.tail), sex: title(e.sex), age: parseInt(e.age, 10), flags: [],
|
||||||
|
}));
|
||||||
|
// lineage spelling: spellings used 3+ times are canonical; others snap to a canonical of the same colour within 2 edits
|
||||||
|
const counts = {};
|
||||||
|
items.forEach((it) => { const k = lkey(it.lineage_raw); if (k) counts[k] = (counts[k] || 0) + 1; });
|
||||||
|
// spellings confirmed by an official dragonkind.com result page also count as canonical
|
||||||
|
const official = new Set(items.filter((it) => it.source_url).map((it) => lkey(it.lineage_raw)));
|
||||||
|
const canon = Object.keys(counts).filter((k) => counts[k] >= 3 || official.has(k));
|
||||||
|
const colourOfKey = {};
|
||||||
|
items.forEach((it) => { const k = lkey(it.lineage_raw); if (canon.includes(k)) (colourOfKey[k] = colourOfKey[k] || new Set()).add(it.colour); });
|
||||||
|
items.forEach((it) => {
|
||||||
|
let k = lkey(it.lineage_raw);
|
||||||
|
if (k && !canon.includes(k)) {
|
||||||
|
const best = canon.filter((c) => colourOfKey[c] && colourOfKey[c].has(it.colour)).map((c) => [c, lev(k, c)]).sort((a, b) => a[1] - b[1])[0];
|
||||||
|
if (best && best[1] <= 2) { it.flags.push(`lineage spelled "${it.lineage_raw}"`); k = best[0]; }
|
||||||
|
else it.flags.push("lineage seen fewer than 3 times");
|
||||||
|
}
|
||||||
|
it.lineage = k ? title(k) : "Unknown";
|
||||||
|
if (!Number.isFinite(it.age)) { it.age = null; it.flags.push("age missing"); }
|
||||||
|
if (!COLOUR_ORDER.includes(it.colour)) it.flags.push("unrecognised colour");
|
||||||
|
});
|
||||||
|
// a lineage should belong to one colour
|
||||||
|
const lc = {};
|
||||||
|
items.forEach((it) => (lc[it.lineage] = lc[it.lineage] || new Set()).add(it.colour));
|
||||||
|
items.forEach((it) => { if (lc[it.lineage].size > 1) it.flags.push(`lineage also recorded under ${[...lc[it.lineage]].filter((c) => c !== it.colour).join("/")}`); });
|
||||||
|
// duplicates: same dragon name + colour + tail + sex + age + lineage
|
||||||
|
const seen = new Map(), out = [];
|
||||||
|
items.forEach((it) => {
|
||||||
|
const key = [it.name && it.name.toLowerCase(), it.colour, it.tail, it.sex, it.age, it.lineage].join("|");
|
||||||
|
if (seen.has(key)) {
|
||||||
|
const first = seen.get(key);
|
||||||
|
first.duplicates = (first.duplicates || 0) + 1;
|
||||||
|
if (!first.also.includes(it.source) && it.source !== first.source) first.also.push(it.source);
|
||||||
|
if (it.source_url && !first.source_url) first.source_url = it.source_url;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
it.also = []; seen.set(key, it); out.push(it);
|
||||||
|
});
|
||||||
|
out.sort(compare);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function compare(a, b) {
|
||||||
|
const ci = (c) => (COLOUR_ORDER.indexOf(c) + 1 || 99);
|
||||||
|
return ci(a.colour) - ci(b.colour) || a.tail.localeCompare(b.tail) || a.lineage.localeCompare(b.lineage) ||
|
||||||
|
(b.age ?? -1) - (a.age ?? -1) || (a.name || "").localeCompare(b.name || "");
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------------------- browser UI
|
||||||
|
function mount(opts) {
|
||||||
|
const $ = (q) => document.querySelector(q);
|
||||||
|
const esc = (x) => String(x ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ }[c]));
|
||||||
|
const cssVar = (n) => getComputedStyle(document.documentElement).getPropertyValue(n).trim();
|
||||||
|
const DV = { Red: "--dr-red", Green: "--dr-green", Orange: "--dr-orange", Brown: "--dr-brown", Blue: "--dr-blue", Black: "--dr-black" };
|
||||||
|
const st = { all: [], label: "", f: { colour: "", tail: "", lineage: "", sex: "", q: "" }, bundled: null };
|
||||||
|
|
||||||
|
function load(raw, label) { st.all = build(raw); st.label = label; st.f = { colour: "", tail: "", lineage: "", sex: "", q: "" }; ["reg-colour", "reg-tail", "reg-lineage", "reg-sex", "reg-q"].forEach((id) => ($("#" + id).value = "")); render(); }
|
||||||
|
const filtered = () => st.all.filter((d) => (!st.f.colour || d.colour === st.f.colour) && (!st.f.tail || d.tail === st.f.tail) &&
|
||||||
|
(!st.f.lineage || d.lineage === st.f.lineage) && (!st.f.sex || d.sex === st.f.sex) &&
|
||||||
|
(!st.f.q || [d.name, d.lineage].join(" ").toLowerCase().includes(st.f.q.toLowerCase())));
|
||||||
|
const sw = (c) => `<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:var(${DV[c] || "--faint"});margin-right:6px;vertical-align:-1px;box-shadow:0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent)"></span>`;
|
||||||
|
const median = (a) => { const s = a.slice().sort((x, y) => x - y); const m = s.length >> 1; return s.length ? (s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2) : null; };
|
||||||
|
|
||||||
|
function fillSelect(id, values, label) {
|
||||||
|
const el = $("#" + id), cur = el.value;
|
||||||
|
el.innerHTML = `<option value="">${label}</option>` + values.map((v) => `<option>${esc(v)}</option>`).join("");
|
||||||
|
el.value = values.includes(cur) ? cur : "";
|
||||||
|
}
|
||||||
|
function render() {
|
||||||
|
const all = st.all, rows = filtered();
|
||||||
|
const colours = COLOUR_ORDER.filter((c) => all.some((d) => d.colour === c));
|
||||||
|
fillSelect("reg-colour", colours, "All colours");
|
||||||
|
fillSelect("reg-tail", TAILS.filter((t) => all.some((d) => d.tail === t)), "All tails");
|
||||||
|
fillSelect("reg-lineage", [...new Set(all.filter((d) => !st.f.colour || d.colour === st.f.colour).map((d) => d.lineage))].sort(), "All lineages");
|
||||||
|
fillSelect("reg-sex", [...new Set(all.map((d) => d.sex).filter(Boolean))].sort(), "Any sex");
|
||||||
|
const src = {}; all.forEach((d) => (src[d.source] = (src[d.source] || 0) + 1));
|
||||||
|
$("#reg-status").innerHTML = `<b>${all.length}</b> bonded dragons · ${Object.entries(src).map(([k, v]) => `${esc(k)} ${v}`).join(" · ")} · <span class="pill">${esc(st.label)}</span>`;
|
||||||
|
// colour x tail matrix
|
||||||
|
$("#reg-matrix").innerHTML = `<table><thead><tr><th>Colour</th>${TAILS.map((t) => `<th class="num">${t.replace("tail", "")}</th>`).join("")}<th class="num">Total</th></tr></thead><tbody>${colours.map((c) => {
|
||||||
|
const cs = rows.filter((d) => d.colour === c);
|
||||||
|
return `<tr><td>${sw(c)}${c}</td>${TAILS.map((t) => { const n = cs.filter((d) => d.tail === t).length; return `<td class="num"${n ? "" : ' style="color:var(--faint)"'}>${n || "·"}</td>`; }).join("")}<td class="num"><b>${cs.length}</b></td></tr>`;
|
||||||
|
}).join("")}</tbody></table>`;
|
||||||
|
// lineages
|
||||||
|
const lin = {};
|
||||||
|
rows.forEach((d) => { const k = d.colour + "|" + d.lineage; (lin[k] = lin[k] || []).push(d); });
|
||||||
|
$("#reg-lineages").innerHTML = `<table><thead><tr><th>Colour</th><th>Lineage</th><th class="num">Dragons</th><th class="num">Ages</th><th class="num">Median</th><th class="num">F / M</th></tr></thead><tbody>${Object.keys(lin).sort((a, b) => COLOUR_ORDER.indexOf(a.split("|")[0]) - COLOUR_ORDER.indexOf(b.split("|")[0]) || a.localeCompare(b)).map((k) => {
|
||||||
|
const g = lin[k], ages = g.map((d) => d.age).filter(Number.isFinite), [c, l] = k.split("|");
|
||||||
|
return `<tr><td>${sw(c)}${c}</td><td>${esc(l)}</td><td class="num">${g.length}</td><td class="num">${ages.length ? Math.min(...ages) + "–" + Math.max(...ages) : "–"}</td><td class="num">${ages.length ? median(ages) : "–"}</td><td class="num">${g.filter((d) => d.sex === "Female").length} / ${g.filter((d) => d.sex === "Male").length}</td></tr>`;
|
||||||
|
}).join("")}</tbody></table>`;
|
||||||
|
// main table, grouped by colour then tail
|
||||||
|
let lastGroup = "";
|
||||||
|
$("#reg-table").innerHTML = rows.length ? `<table><thead><tr><th>Colour</th><th>Tail</th><th>Lineage</th><th class="num">Age</th><th>Sex</th><th>Dragon</th><th>Rider's assignment</th><th>Source</th><th>Notes</th></tr></thead><tbody>${rows.map((d) => {
|
||||||
|
const g = d.colour + "|" + d.tail, head = g !== lastGroup; lastGroup = g;
|
||||||
|
return `<tr${head ? ' style="border-top:2px solid var(--line)"' : ""}><td>${sw(d.colour)}${esc(d.colour)}</td><td>${esc(d.tail)}</td><td>${esc(d.lineage)}</td><td class="num">${d.age ?? "–"}</td><td>${esc(d.sex)}</td><td><b>${esc(d.name)}</b></td><td class="small">${[d.wing, d.section, d.squad].filter(Boolean).map(esc).join(" · ") || "–"}</td><td class="small">${[d.source === "Register form" || d.also.includes("Register form") ? "form" : null, d.source_url ? `<a href="${esc(d.source_url)}" target="_blank" rel="noopener">result page</a>` : null].filter(Boolean).join(" + ")}${d.duplicates ? ` <span class="muted">(${d.duplicates + 1} entries merged)</span>` : ""}</td><td class="small muted">${esc(d.flags.join("; "))}</td></tr>`;
|
||||||
|
}).join("")}</tbody></table>` : `<p class="small muted" style="padding:12px">No dragons match these filters.</p>`;
|
||||||
|
$("#reg-count").textContent = `${rows.length} shown`;
|
||||||
|
renderGallery(rows);
|
||||||
|
}
|
||||||
|
// tail glyphs (24-unit box), drawn as simple original marks
|
||||||
|
const TAIL_GLYPH = {
|
||||||
|
Clubtail: '<path d="M5 19 L14 10" stroke-width="2.4"/><circle cx="16" cy="8" r="3.6" stroke="none" fill="currentColor"/>',
|
||||||
|
Daggertail: '<path d="M5 19 L8.5 15.5" stroke-width="2.4"/><path d="M7 14 L10 17" stroke-width="1.8"/><path d="M8.5 15.5 L19 5 L13.5 15.5 Z" fill="currentColor" stroke="none"/>',
|
||||||
|
Morningstartail: '<path d="M5 19 L11 13" stroke-width="2.4"/><circle cx="14.5" cy="9.5" r="3.4" fill="currentColor" stroke="none"/><path d="M14.5 3.5v2.5M14.5 13v2.5M8.5 9.5h2.5M18 9.5h2.5M10.3 5.3l1.8 1.8M16.9 11.9l1.8 1.8M18.7 5.3l-1.8 1.8M12.1 11.9l-1.8 1.8" stroke-width="1.6"/>',
|
||||||
|
Scorpiontail: '<path d="M5 19 C5 10 11 5.5 17 6.5 C20.5 7.2 20.5 11.5 17.5 12.5" stroke-width="2.2"/><path d="M17.5 12.5 L14.5 11 L16.2 15 Z" fill="currentColor" stroke="none"/>',
|
||||||
|
Swordtail: '<path d="M5 19 L19 5" stroke-width="2.6"/><path d="M6.5 13.5 L10.5 17.5" stroke-width="2"/><path d="M19 5 L16 6 L18 8 Z" fill="currentColor" stroke="none"/>',
|
||||||
|
};
|
||||||
|
function emblem(d) {
|
||||||
|
const col = cssVar(DV[d.colour] || "--faint");
|
||||||
|
const rgbv = (col.match(/[0-9a-f]{2}/gi) || ["80", "80", "80"]).slice(0, 3).map((h) => parseInt(h, 16));
|
||||||
|
const lum = col.startsWith("#") ? (0.299 * rgbv[0] + 0.587 * rgbv[1] + 0.114 * rgbv[2]) / 255 : 0.4;
|
||||||
|
const ink = lum > 0.6 ? "#14181d" : "#f4f1ea";
|
||||||
|
return `<svg viewBox="0 0 64 64" aria-hidden="true"><defs><radialGradient id="g${d.colour}" cx="35%" cy="30%" r="80%"><stop offset="0" stop-color="${col}" stop-opacity="0.85"/><stop offset="1" stop-color="${col}"/></radialGradient></defs>
|
||||||
|
<path d="M32 3 L57 17 L57 47 L32 61 L7 47 L7 17 Z" fill="url(#g${d.colour})" stroke="var(--ink)" stroke-opacity="0.25"/>
|
||||||
|
<path d="M32 9 L52 20 L52 44 L32 55 L12 44 L12 20 Z" fill="none" stroke="${ink}" stroke-opacity="0.35"/>
|
||||||
|
<g transform="translate(16 16) scale(1.35)" stroke="${ink}" fill="none" stroke-linecap="round" style="color:${ink}">${TAIL_GLYPH[d.tail] || ""}</g></svg>`;
|
||||||
|
}
|
||||||
|
function renderGallery(rows) {
|
||||||
|
const g = $("#reg-gallery");
|
||||||
|
if (!g) return;
|
||||||
|
const byC = {};
|
||||||
|
rows.forEach((d) => (byC[d.colour] = byC[d.colour] || []).push(d));
|
||||||
|
g.innerHTML = Object.keys(byC).sort((a, b) => COLOUR_ORDER.indexOf(a) - COLOUR_ORDER.indexOf(b)).map((c) => `
|
||||||
|
<div class="gal-group"><h3>${sw(c)}${esc(c)} dragons <span class="small muted" style="font-family:var(--font-body);letter-spacing:0">${byC[c].length}</span></h3>
|
||||||
|
<div class="cards">${byC[c].map((d) => `<div class="dcard" style="--dc: var(${DV[d.colour] || "--accent"})" title="${esc(d.flags.join("; "))}"><span class="age">${d.age ?? "?"} yrs</span>${emblem(d)}<span class="nm">${esc(d.name)}</span><span class="meta">${esc(d.sex || "")} ${esc(d.tail)}<br>${esc(d.lineage)} lineage${d.source_url ? `<br><a href="${esc(d.source_url)}" target="_blank" rel="noopener">result page</a>` : ""}</span></div>`).join("")}</div></div>`).join("") || `<p class="small muted">No dragons match these filters.</p>`;
|
||||||
|
}
|
||||||
|
document.querySelectorAll("#reg-view button").forEach((b) => b.addEventListener("click", () => {
|
||||||
|
document.querySelectorAll("#reg-view button").forEach((x) => x.setAttribute("aria-pressed", x === b));
|
||||||
|
$("#reg-gallery").hidden = b.dataset.v !== "cards";
|
||||||
|
$("#reg-table").hidden = b.dataset.v !== "table";
|
||||||
|
}));
|
||||||
|
function csv() {
|
||||||
|
const cols = ["colour", "tail", "lineage", "age", "sex", "name", "wing", "section", "squad", "source", "source_url", "lineage_raw", "flags"];
|
||||||
|
const q = (v) => { if (v === null || v === undefined) return ""; const s = Array.isArray(v) ? v.join("; ") : String(v); return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s; };
|
||||||
|
return [cols.join(","), ...filtered().map((d) => cols.map((c) => q(d[c])).join(","))].join("\n");
|
||||||
|
}
|
||||||
|
[["reg-colour", "colour"], ["reg-tail", "tail"], ["reg-lineage", "lineage"], ["reg-sex", "sex"]].forEach(([id, k]) =>
|
||||||
|
$("#" + id).addEventListener("change", (e) => { st.f[k] = e.target.value; if (k === "colour") st.f.lineage = ""; render(); }));
|
||||||
|
$("#reg-q").addEventListener("input", (e) => { st.f.q = e.target.value.trim(); render(); });
|
||||||
|
$("#reg-copy").addEventListener("click", () => opts.copy(csv(), "register CSV"));
|
||||||
|
$("#reg-upload").addEventListener("change", async (e) => {
|
||||||
|
const f = e.target.files[0]; if (!f) return;
|
||||||
|
try {
|
||||||
|
const wb = XLSX.read(await f.arrayBuffer(), { type: "array", cellDates: true });
|
||||||
|
const ws = wb.Sheets[wb.SheetNames.find((n) => /form responses/i.test(n)) || wb.SheetNames[0]];
|
||||||
|
const headers = (XLSX.utils.sheet_to_json(ws, { header: 1, blankrows: false })[0] || []).map(String);
|
||||||
|
const rows = XLSX.utils.sheet_to_json(ws, { defval: null, raw: true });
|
||||||
|
load({ headers, rows, extra: st.bundled.extra }, `uploaded ${f.name} + Reddit result pages`);
|
||||||
|
opts.toast(`Loaded ${rows.length} register rows`);
|
||||||
|
} catch (err) { opts.toast("That file could not be read. Export the register sheet as .xlsx or .csv."); console.error(err); }
|
||||||
|
e.target.value = "";
|
||||||
|
});
|
||||||
|
fetch("data/register.json").then((r) => r.json()).then((raw) => { st.bundled = raw; load(raw, `bundled snapshot (${raw.source}, exported ${raw.exported})`); })
|
||||||
|
.catch((e) => ($("#reg-status").textContent = "The register data could not load."));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { build, compare, mount, COLOUR_ORDER, TAILS, lev };
|
||||||
|
});
|
||||||
@@ -0,0 +1,519 @@
|
|||||||
|
/*
|
||||||
|
* solver.js: the route advisor for the site and the DragonKind bot.
|
||||||
|
*
|
||||||
|
* The route model is built in Python (core/atlas/solver.py) from the game in core/spec/game.yaml and published as
|
||||||
|
* data/policy.json. Each sample in it carries the game itself (model.game) and the count tables behind every roll
|
||||||
|
* (model.tables, model.alphas). This file reads both and re-solves the game from any point in a run, including
|
||||||
|
* points off the recommended route, so a rider (or the bot) always gets the best next choice. It is the same
|
||||||
|
* interpreter as the Python one, kept small: a walk of the game's steps, posterior-mean odds with hierarchical
|
||||||
|
* back-off, backward induction, and Dinkelbach iteration for the "eventually" goal.
|
||||||
|
* tests/core/advisor.test.js checks it gives exactly the Python model's values.
|
||||||
|
*
|
||||||
|
* Public API (unchanged for the bot): advisor(sample, colour, objective, { only }), recommendOption(adv, h, texts),
|
||||||
|
* solverHistory(formVars, seen), makeParams(tables, { alphas, game }), ENCOUNTERS (set from the first sample).
|
||||||
|
* Since November 2026: advisor options `attempt` (the account's attempt number: a first attempt has its own
|
||||||
|
* shadow odds), `fix` (hold some decisions to given options: an experiment arm) and sampling "uniform" (mapping);
|
||||||
|
* assign(plan, { accountSeq, attempt }) reads the experiment plan (experiments.json) and says what an attempt is for;
|
||||||
|
* screenPick(tree, sceneId, offered, { mode }) picks from the screen tree (tree.json): least-tried, or Thompson.
|
||||||
|
* knownAnswer(known, offered, { target, sceneColour }) looks a screen's choices up in known_answers.json (the guide's
|
||||||
|
* encounter answers and the bot's own results) for screens nothing else covers: a pick when the evidence is clear,
|
||||||
|
* and the evidence for every choice either way, to hand to Clef (issue #35).
|
||||||
|
* UMD: window.ThreshSolver in the browser, module.exports in Node. No dependencies.
|
||||||
|
*/
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof module === "object" && module.exports) module.exports = factory();
|
||||||
|
else root.ThreshSolver = factory();
|
||||||
|
})(typeof self !== "undefined" ? self : this, function () {
|
||||||
|
"use strict";
|
||||||
|
const ALPHA = 20;
|
||||||
|
const ZERO = { x: 0, o: 0, r: 0 }, REACHED = { x: 0, o: 0, r: 1 };
|
||||||
|
const canon = (s) => JSON.stringify(Object.keys(s).sort().map((k) => [k, s[k]]));
|
||||||
|
const encColour = (ctx) => (ctx === "tree-Greens" ? "Green" : ctx.split("-")[1]);
|
||||||
|
const api = {};
|
||||||
|
|
||||||
|
/* ---------- posterior draws, for Thompson sampling ---------- */
|
||||||
|
function rng(seed) {
|
||||||
|
let x = (seed >>> 0) || 0x9e3779b9;
|
||||||
|
return () => { x ^= x << 13; x >>>= 0; x ^= x >>> 17; x ^= x << 5; x >>>= 0; return (x + 0.5) / 4294967296; };
|
||||||
|
}
|
||||||
|
function normal(rand) { return Math.sqrt(-2 * Math.log(rand())) * Math.cos(2 * Math.PI * rand()); }
|
||||||
|
function gamma(k, rand) { // Marsaglia and Tsang
|
||||||
|
if (k < 1) return gamma(k + 1, rand) * Math.pow(rand(), 1 / k);
|
||||||
|
const d = k - 1 / 3, c = 1 / Math.sqrt(9 * d);
|
||||||
|
for (;;) {
|
||||||
|
let x, v;
|
||||||
|
do { x = normal(rand); v = 1 + c * x; } while (v <= 0);
|
||||||
|
v = v * v * v;
|
||||||
|
const u = rand();
|
||||||
|
if (u < 1 - 0.0331 * x ** 4 || Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) return d * v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dirichlet(a, rand) {
|
||||||
|
const g = a.map((x) => Math.max(gamma(x, rand), 1e-300));
|
||||||
|
let s = 0; for (const x of g) s += x;
|
||||||
|
return g.map((x) => x / s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- the odds: posterior means (or, with rand, one posterior draw) with hierarchical back-off ---------- */
|
||||||
|
/** The givens of a run (game.yaml `givens`): the defaults, with `attempt` set from an attempt number or name. */
|
||||||
|
function givenFor(game, { attempt = null, given = null } = {}) {
|
||||||
|
const g = Object.fromEntries(Object.entries(game.givens || {}).map(([k, v]) => [k, v.default]));
|
||||||
|
if (attempt != null && game.givens && game.givens.attempt) g.attempt = attempt === 1 || attempt === "1" || attempt === "First attempt" ? "First attempt" : "Later attempt";
|
||||||
|
return { ...g, ...(given || {}) };
|
||||||
|
}
|
||||||
|
// given: the run's givens; memo: pass the same Map to get the same posterior draw for another given
|
||||||
|
function makeParams(T, { alphas = {}, game, rand = null, given = null, memo = new Map() }) {
|
||||||
|
const normalise = (a) => { let sum = 0; for (const x of a) sum += x; return a.map((x) => x / sum); };
|
||||||
|
const estimate = rand ? (a) => dirichlet(a, rand) : normalise;
|
||||||
|
const known = given || givenFor(game);
|
||||||
|
const ctxKey = (s, names) => names.map((k) => (s[k] == null ? "?" : s[k])).join("|");
|
||||||
|
function chance(node, walked) {
|
||||||
|
const sp = game.chance[node], cats = sp.outcomes;
|
||||||
|
// a closed gate (game.yaml `requires`): the roll always comes out as `otherwise`
|
||||||
|
if (sp.requires && Object.entries(sp.requires).some(([k, v]) => walked[k] !== v)) return Object.fromEntries(cats.map((k) => [k, k === sp.otherwise ? 1 : 0]));
|
||||||
|
const state = { ...known, ...walked };
|
||||||
|
let p = null;
|
||||||
|
for (let L = 0; L <= sp.context.length; L++) {
|
||||||
|
const names = sp.context.slice(0, L);
|
||||||
|
if (names.some((k) => state[k] == null)) break;
|
||||||
|
const key = L + ":" + ctxKey(state, names), mk = node + "#" + key;
|
||||||
|
if (memo.has(mk)) { p = memo.get(mk); continue; }
|
||||||
|
// a level that is not pooled (game.yaml `distinct`) keeps a token prior of one run
|
||||||
|
const c = T[node][key] || {}, al = L <= (sp.distinct || 0) ? 1 : alphas[node] || ALPHA;
|
||||||
|
const a = cats.map((k, i) => (c[k] || 0) + (p ? al * p[i] : 0.5));
|
||||||
|
p = estimate(a);
|
||||||
|
memo.set(mk, p);
|
||||||
|
}
|
||||||
|
return Object.fromEntries(cats.map((k, i) => [k, p[i]]));
|
||||||
|
}
|
||||||
|
function encounter(ctx) {
|
||||||
|
const mk = "enc#" + ctx;
|
||||||
|
if (!memo.has(mk)) {
|
||||||
|
const e = T.encounter[ctx] || { outcomes: {}, seen: {} };
|
||||||
|
const cats = game.encounter_outcomes.filter((k) => k === "burn" || e.seen[k] || (e.outcomes[k] || 0) > 0 || k === encColour(ctx));
|
||||||
|
const a = estimate(cats.map((k) => (e.outcomes[k] || 0) + 0.5));
|
||||||
|
memo.set(mk, Object.fromEntries(cats.map((k, i) => [k, a[i]])));
|
||||||
|
}
|
||||||
|
return memo.get(mk);
|
||||||
|
}
|
||||||
|
return { chance, encounter };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- one walk of the game, used to solve (as Walker in core/atlas/solver.py) ---------- */
|
||||||
|
function apply(then, state, value) {
|
||||||
|
const s = then.keep ? Object.fromEntries(then.keep.filter((k) => k in state).map((k) => [k, state[k]])) : { ...state };
|
||||||
|
for (const k of then.drop || []) delete s[k];
|
||||||
|
for (const [k, v] of Object.entries(then.set || {})) s[k] = v === "$" ? value : v;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
function walker(game, support, only, hooks) {
|
||||||
|
const options = (name, state) => {
|
||||||
|
const by = game.decisions[name].support_by;
|
||||||
|
return by ? support[`${name}:${state[by]}`] || game.decisions[name].options : support[name];
|
||||||
|
};
|
||||||
|
function follow(then, value, state) {
|
||||||
|
const t = then[value] || then.default;
|
||||||
|
if (t.end) return hooks.end(t.end);
|
||||||
|
const s = apply(t, state, value);
|
||||||
|
if (t.encounter) {
|
||||||
|
const ctx = t.encounter.replace("$", value);
|
||||||
|
const opts = only && !only.includes(ctx) ? ["Die on purpose"] : support.encounter;
|
||||||
|
return hooks.decision("encounter", { ...s, enc: ctx }, opts, (o) => (o === "Die on purpose" ? hooks.dieOnPurpose() : hooks.attempt(ctx)));
|
||||||
|
}
|
||||||
|
return run(t.go, s);
|
||||||
|
}
|
||||||
|
function run(id, state) {
|
||||||
|
const st = game.steps[id];
|
||||||
|
if (st.decision) return hooks.decision(st.decision, state, options(st.decision, state), (o) => follow(st.then, o, state));
|
||||||
|
return hooks.chance(st.chance, state, (k) => follow(st.then, k, state));
|
||||||
|
}
|
||||||
|
return { root: () => run(game.start, {}) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Backward induction for colour X: score = (1 - lam) P(X) - lam P(other), ties to the higher P(X). */
|
||||||
|
function solve(params, game, support, X, lam = 0, only = null) {
|
||||||
|
const memo = new Map(), choices = new Map(), optVals = new Map();
|
||||||
|
const score = (v) => (1 - lam) * v.x - lam * v.o + 1e-9 * v.x - 1e-12 * v.o;
|
||||||
|
const w = walker(game, support, only, {
|
||||||
|
decision(name, state, opts, cont) {
|
||||||
|
const key = name + "@" + canon(state);
|
||||||
|
if (memo.has(key)) return memo.get(key);
|
||||||
|
let top = null, arg = null;
|
||||||
|
const vals = {};
|
||||||
|
for (const o of opts) {
|
||||||
|
const v = cont(o);
|
||||||
|
vals[o] = v;
|
||||||
|
if (!top || score(v) > score(top)) { top = v; arg = o; }
|
||||||
|
}
|
||||||
|
memo.set(key, top); choices.set(key, arg); optVals.set(key, vals);
|
||||||
|
return top;
|
||||||
|
},
|
||||||
|
chance(node, state, cont) {
|
||||||
|
let acc = ZERO;
|
||||||
|
for (const [k, p] of Object.entries(params.chance(node, state))) {
|
||||||
|
if (!p) continue;
|
||||||
|
const v = cont(k);
|
||||||
|
acc = { x: acc.x + p * v.x, o: acc.o + p * v.o, r: acc.r + p * v.r };
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
end: () => ZERO,
|
||||||
|
dieOnPurpose: () => REACHED,
|
||||||
|
attempt(ctx) {
|
||||||
|
let x = 0, o = 0;
|
||||||
|
for (const [k, p] of Object.entries(params.encounter(ctx))) if (k !== "burn") { if (k === X) x += p; else o += p; }
|
||||||
|
return { x, o, r: 1 };
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return { value: w.root(), choices, optVals };
|
||||||
|
}
|
||||||
|
function solveRatio(params, game, support, X, only) {
|
||||||
|
let lam = 0, s = solve(params, game, support, X, 0, only);
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
const v = s.value, r = v.x + v.o > 0 ? v.x / (v.x + v.o) : 0;
|
||||||
|
if (Math.abs(r - lam) < 1e-10) break;
|
||||||
|
lam = r;
|
||||||
|
s = solve(params, game, support, X, lam, only);
|
||||||
|
}
|
||||||
|
return { ...s, lam };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- the advisor ---------- */
|
||||||
|
/**
|
||||||
|
* advisor(sample, X, objective, { only }): sample is policy.samples.all (or .lowBias); X a colour; objective
|
||||||
|
* "eventually" (default) or "thisAttempt"; only: bond only at these encounters, die on purpose elsewhere.
|
||||||
|
* Returns { value, step(h), next(h), attempts(ctx), params, game }.
|
||||||
|
*
|
||||||
|
* h is a run so far, keyed by the game's step names: decisions (company, leave, direction, react, scream,
|
||||||
|
* clearing, fight, dagger, fate, wounded, post, hour, descend, red, valley, encounter) and rolls (fs, shadow,
|
||||||
|
* shadowColour, meadow). A rider asking for advice survived every deadly roll so far; step() reports the risk of
|
||||||
|
* the deadly roll just passed on the step after it. When h already has a later step but skips an earlier
|
||||||
|
* decision (an older form record, say), the recommended option is assumed for the skipped one.
|
||||||
|
*/
|
||||||
|
function advisor(sample, X, objective = "eventually", { only = null, sampling = "best", seed = 1, draws = 40, attempt = null, given = null, fix = null } = {}) {
|
||||||
|
const m = sample.model, game = m.game;
|
||||||
|
api.game = game; api.ENCOUNTERS = game.by_colour;
|
||||||
|
// attempt: the account's attempt number (or "First attempt" / "Later attempt"). A first attempt has its own odds
|
||||||
|
// for the rolls that depend on it (the shadow); without it, a later attempt is assumed.
|
||||||
|
const defaults = givenFor(game), known = givenFor(game, { attempt, given });
|
||||||
|
const special = Object.keys(known).some((k) => known[k] !== defaults[k]);
|
||||||
|
// "uniform" (mapping) may take any option the game has, so it is solved without the minimum-support rule
|
||||||
|
const all = Object.fromEntries(Object.entries(game.decisions).map(([k, d]) => [k, d.options]));
|
||||||
|
const base = sampling === "uniform" ? { ...all, encounter: m.support.encounter } : m.support;
|
||||||
|
// fix: { decision: option } holds those decisions to one option (an experiment arm); the rest is solved around it
|
||||||
|
let support = base;
|
||||||
|
if (fix) {
|
||||||
|
support = { ...base };
|
||||||
|
for (const [k, o] of Object.entries(fix)) {
|
||||||
|
if (!game.decisions[k] || !game.decisions[k].options.includes(o)) throw new Error(`fix: ${k} has no option "${o}"`);
|
||||||
|
support[k] = [o];
|
||||||
|
if (game.decisions[k].support_by) for (const key of Object.keys(support)) if (key.startsWith(k + ":")) support[key] = [o];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// One world (the posterior means, or one draw): the odds for this run's givens, solved for the objective.
|
||||||
|
// "Eventually" on a first attempt: every later attempt is an ordinary one, worth its own ratio (lam), so the
|
||||||
|
// best play now maximises P(X now) + P(no bond now) * lam: the same score with lam fixed.
|
||||||
|
const solveWith = (rand) => {
|
||||||
|
const memo = new Map();
|
||||||
|
const mk = (g) => makeParams(m.tables, { alphas: m.alphas, game, rand, given: g, memo });
|
||||||
|
if (objective !== "eventually") { const params = mk(known); return { params, sol: solve(params, game, support, X, 0, only) }; }
|
||||||
|
if (!special) { const params = mk(known); return { params, sol: solveRatio(params, game, support, X, only) }; }
|
||||||
|
const lam = solveRatio(mk(defaults), game, base, X, only).lam;
|
||||||
|
const params = mk(known);
|
||||||
|
return { params, sol: { ...solve(params, game, support, X, lam, only), lam } };
|
||||||
|
};
|
||||||
|
// "best": the best route under the posterior means. "thompson": the best route of one posterior draw of the odds
|
||||||
|
// (one per attempt: make a new advisor with a new seed for each attempt), so every option is tried about as
|
||||||
|
// often as it is likely to be the best one; as the data firm up, sampling settles on the best route.
|
||||||
|
// "uniform": every option on the screen is equally likely (recommendOption picks; see there).
|
||||||
|
const thompson = sampling === "thompson";
|
||||||
|
const { params, sol } = solveWith(thompson ? rng(seed) : null);
|
||||||
|
// the chance Thompson sampling picks each option at a history, estimated from `draws` other draws: the
|
||||||
|
// propensity to log, so the runs can be re-weighted later
|
||||||
|
let worlds = null;
|
||||||
|
const propensityAt = (key, choice) => {
|
||||||
|
if (!thompson) return 1;
|
||||||
|
if (!worlds) worlds = Array.from({ length: draws }, (_, i) => solveWith(rng(seed * 7919 + i + 1)).sol.choices);
|
||||||
|
return worlds.filter((c) => c.get(key) === choice).length / draws;
|
||||||
|
};
|
||||||
|
const VARS = new Set([...Object.keys(game.decisions), ...Object.keys(game.chance), "encounter"]);
|
||||||
|
const fmt = (v) => ({ pX: v.x, pOther: v.o, pReach: v.r });
|
||||||
|
const label = (k) => (game.decisions[k] || game.chance[k]).label;
|
||||||
|
const decisionAt = (name, key, extra) => {
|
||||||
|
const vals = sol.optVals.get(key) || {};
|
||||||
|
const choice = sol.choices.get(key);
|
||||||
|
return { kind: "decision", var: name, label: label(name), choice, propensity: propensityAt(key, choice),
|
||||||
|
options: Object.fromEntries(Object.entries(vals).map(([o, v]) => [o, fmt(v)])), ...extra };
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The next thing that happens after history h: a decision, a roll, or the end of the run. */
|
||||||
|
function step(h) {
|
||||||
|
const used = new Set();
|
||||||
|
const later = () => Object.keys(h).some((k) => VARS.has(k) && h[k] != null && !used.has(k));
|
||||||
|
let id = game.start, state = {}, risk = null;
|
||||||
|
for (let guard = 0; guard < 100; guard++) {
|
||||||
|
const st = game.steps[id];
|
||||||
|
let value;
|
||||||
|
if (st.decision) {
|
||||||
|
const name = st.decision, key = name + "@" + canon(state);
|
||||||
|
if (h[name] != null) { value = h[name]; used.add(name); }
|
||||||
|
else if (later()) value = sol.choices.get(key);
|
||||||
|
else return decisionAt(name, key, risk ? { risk } : {});
|
||||||
|
risk = null;
|
||||||
|
} else {
|
||||||
|
const node = st.chance, probs = params.chance(node, state), sp = game.chance[node];
|
||||||
|
if (sp.risk_label) { risk = { label: sp.risk_label, p: probs.die }; value = "live"; }
|
||||||
|
else if (h[node] != null) { value = h[node]; used.add(node); risk = null; }
|
||||||
|
else return { kind: "chance", var: node, label: label(node), probs, ...(risk ? { risk } : {}) };
|
||||||
|
}
|
||||||
|
const t = st.then[value] || st.then.default;
|
||||||
|
if (!t) return { kind: "end", invalid: `${st.decision || st.chance} = ${value}` };
|
||||||
|
if (t.end) return { kind: "end", what: t.end };
|
||||||
|
const s = apply(t, state, value);
|
||||||
|
if (t.encounter) {
|
||||||
|
const ctx = t.encounter.replace("$", value);
|
||||||
|
if (h.encounter == null) return decisionAt("encounter", "encounter@" + canon({ ...s, enc: ctx }), { encounter: ctx, ...(risk ? { risk } : {}) });
|
||||||
|
return { kind: "end", encounter: ctx, action: h.encounter, outcomes: h.encounter === "Die on purpose" ? { burn: 1 } : params.encounter(ctx) };
|
||||||
|
}
|
||||||
|
id = t.go; state = s;
|
||||||
|
}
|
||||||
|
throw new Error("the game has no end");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
colour: X, objective, only, sampling, seed: sampling === "best" ? null : seed, given: known, fix, value: sol.value, step, params, game,
|
||||||
|
/** 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),
|
||||||
|
/** the next decision only (null when the next step is a roll or the run is over) */
|
||||||
|
next(h) {
|
||||||
|
const s = step(h);
|
||||||
|
return s.kind === "decision" ? { decision: s.var, label: s.label, choice: s.choice, propensity: s.propensity, options: s.options } : null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- the bot ---------- */
|
||||||
|
const norm = (t) => String(t || "").toLowerCase().replace(/[‘’‛`']/g, "'").replace(/[–—-]/g, " ").replace(/[^a-z0-9'\s]/g, " ").replace(/\s+/g, " ").trim();
|
||||||
|
/**
|
||||||
|
* Which of the options on the bot's screen to pick: { index, decision, choice, margin, options, reason }.
|
||||||
|
* index is null when there is no advice for this screen (use the bot's own rules). The encounter decision
|
||||||
|
* ("Attempt the bond" / "Die on purpose") is returned without an index: the bot knows which option is which.
|
||||||
|
* The on-screen text of each option is in game.yaml (bot_text).
|
||||||
|
*/
|
||||||
|
function recommendOption(adv, h, offered) {
|
||||||
|
const rec = adv.next(h);
|
||||||
|
if (!rec) return null;
|
||||||
|
const texts = offered.map(norm), pats = (adv.game.bot_text || {})[rec.decision] || {};
|
||||||
|
// mapping (sampling "uniform"): every option on the screen that the game knows is equally likely, except a
|
||||||
|
// decision held by `fix` and the bonding encounter (where the advisor's own choice stands)
|
||||||
|
if (adv.sampling === "uniform" && rec.decision !== "encounter" && !(adv.fix && adv.fix[rec.decision])) {
|
||||||
|
const on = Object.keys(rec.options).map((o) => [o, pats[o] ? texts.findIndex((t) => new RegExp(pats[o]).test(t)) : -1]).filter(([, i]) => i >= 0);
|
||||||
|
if (on.length) {
|
||||||
|
const [o, i] = on[Math.floor(rng(hash(`${adv.seed}|${rec.decision}|${canon(h)}`))() * on.length)];
|
||||||
|
return { index: i, decision: rec.decision, choice: o, propensity: 1 / on.length, margin: null, options: rec.options, reason: `${rec.label}: ${o} (mapping: 1 of ${on.length} at random)` };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// With squadmates, staying and the direction are one screen ("Go west with your squadmate", "Convince them to
|
||||||
|
// head east instead", "Leave your squadmate"): staying is answered with the direction that follows it.
|
||||||
|
if (rec.decision === "leave" && rec.choice === "Stay together") {
|
||||||
|
const then = adv.next({ ...h, leave: rec.choice });
|
||||||
|
const dp = then && then.decision === "direction" ? ((adv.game.bot_text || {}).direction || {})[then.choice] : null;
|
||||||
|
const di = dp ? texts.findIndex((t) => new RegExp(dp).test(t)) : -1;
|
||||||
|
if (di >= 0) return { index: di, decision: "leave", choice: rec.choice, also: { direction: then.choice }, propensity: rec.propensity * then.propensity, margin: null, options: rec.options, reason: `${rec.label}: ${rec.choice}, ${then.label}: ${then.choice}` };
|
||||||
|
}
|
||||||
|
const pat = pats[rec.choice];
|
||||||
|
const idx = pat ? texts.findIndex((t) => new RegExp(pat).test(t)) : -1;
|
||||||
|
const values = Object.values(rec.options).map((v) => v.pX).sort((a, b) => b - a);
|
||||||
|
return { index: idx < 0 ? null : idx, decision: rec.decision, choice: rec.choice, propensity: rec.propensity,
|
||||||
|
margin: values.length > 1 ? values[0] - values[1] : null,
|
||||||
|
options: rec.options,
|
||||||
|
reason: idx < 0 && rec.decision !== "encounter" ? "the recommended choice is not on this screen; use the bot's own rules" : `${rec.label}: ${rec.choice}` };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The community form's variables for a run so far (graph.trajectoryVariables(t).vars, or a coded form run) as a
|
||||||
|
* history for advisor().step(), keyed by the game's step names. seen: what the bot saw on screen that the form does
|
||||||
|
* not ask: { shadow: "yes"|"no", shadowColour, meadow }. Uses the game of the last advisor made (or pass one).
|
||||||
|
*/
|
||||||
|
function solverHistory(vars, seen = {}, game = api.game) {
|
||||||
|
const D = game.decisions, F = game.from_form, h = {};
|
||||||
|
const has = (k, v) => D[k].options.includes(v);
|
||||||
|
if (has("company", vars.company)) h.company = vars.company;
|
||||||
|
const lf = vars.left_squadmates;
|
||||||
|
if (h.company && h.company !== "Alone" && lf != null && lf !== "") h.leave = String(lf).toLowerCase() === "true" ? "Leave them" : "Stay together";
|
||||||
|
if (has("direction", vars.direction)) h.direction = vars.direction;
|
||||||
|
if (["Red", "Brown", "Green", "Orange"].includes(vars.first_sighting)) h.fs = vars.first_sighting;
|
||||||
|
if (has("react", vars.sighting_action)) h.react = vars.sighting_action;
|
||||||
|
if (vars.scream === "Ignore the scream") h.scream = "Keep walking";
|
||||||
|
else if (vars.scream === "Investigate & help" || vars.scream === "Investigate & leave" || vars.scream_investigate) h.scream = "Investigate the scream";
|
||||||
|
if (vars.scream === "Investigate & help") h.clearing = "Help your squadmate";
|
||||||
|
if (vars.scream === "Investigate & leave") h.clearing = "Walk away";
|
||||||
|
if (F.fight[vars.combat_first]) h.fight = F.fight[vars.combat_first];
|
||||||
|
if (F.dagger[vars.combat_second]) h.dagger = F.dagger[vars.combat_second];
|
||||||
|
if (F.helped.includes(vars.resolution)) h.fate = vars.resolution;
|
||||||
|
if (F.ignored.includes(vars.resolution)) h.wounded = vars.resolution;
|
||||||
|
if (has("post", vars.post_path)) h.post = vars.post_path;
|
||||||
|
if (has("hour", vars.hour)) h.hour = vars.hour;
|
||||||
|
if (vars.branch === "Descend quickly: Red" || vars.branch === "Descend quickly: let the Red pass") h.descend = "Quickly (Red)";
|
||||||
|
if (vars.branch === "Descend quickly: let the Red pass") h.red = "Let it pass (two Greens)";
|
||||||
|
if (has("red", vars.red)) h.red = vars.red;
|
||||||
|
if (vars.branch === "Descend slowly: two Greens") h.descend = "Slowly (two Greens)";
|
||||||
|
if (vars.branch === "Valley Red") h.valley = "Face the Red";
|
||||||
|
if (vars.branch === "Passed the Red: meadow") h.valley = "Pass the Red (meadow)";
|
||||||
|
for (const k of ["meadow", "shadow", "shadowColour"]) if (seen[k]) h[k] = seen[k];
|
||||||
|
if (h.hour === "Tree" && h.descend && !h.shadow) h.shadow = "no";
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- the experiment plan (planner/experiments.yaml, published as experiments.json) ---------- */
|
||||||
|
function hash(s) { let x = 2166136261; for (const ch of String(s)) { x ^= ch.codePointAt(0); x = Math.imul(x, 16777619) >>> 0; } return x || 1; }
|
||||||
|
/** The arm of the n-th unit (0-based) of an experiment: balanced blocks, each block a seeded shuffle of the arms. */
|
||||||
|
function armFor(experiment, n) {
|
||||||
|
const arms = experiment.arms, k = arms.length, rand = rng(hash(`${experiment.id}|${experiment.seed || 0}|${Math.floor(n / k)}`));
|
||||||
|
const order = arms.map((_, i) => i);
|
||||||
|
for (let i = k - 1; i > 0; i--) { const j = Math.floor(rand() * (i + 1)); [order[i], order[j]] = [order[j], order[i]]; }
|
||||||
|
return arms[order[n % k]];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* What an attempt is for, under the plan: assign(plan, { accountSeq, attempt, facts }) ->
|
||||||
|
* { experimentId, arm, fix, target, objective, sampling, seed, propensity, burn, planId }, or null when no
|
||||||
|
* experiment covers the attempt (use the account's own goal).
|
||||||
|
* accountSeq: the account's number in the order the accounts were made (0, 1, 2, ...), the same for its whole
|
||||||
|
* life; attempt: the account's attempt number (1 = its first threshing); facts: what the plan's `when` rules ask
|
||||||
|
* about the account, e.g. { sawShadowBefore: true }. The answer is the same every time for
|
||||||
|
* the same plan id, so a restart mid-attempt changes nothing. Pass the result to advisor():
|
||||||
|
* advisor(policy.samples.all, a.target, a.objective, { attempt, fix: a.fix, sampling: a.sampling, seed: a.seed })
|
||||||
|
* and log experimentId, arm, planId and the propensity on the run.
|
||||||
|
*/
|
||||||
|
function assign(plan, { accountSeq, attempt, facts = {} }) {
|
||||||
|
const takes = (e) => !e.accounts || ((((accountSeq - (e.accounts.offset || 0)) % e.accounts.every) + e.accounts.every) % e.accounts.every) < e.accounts.take;
|
||||||
|
// when: facts about the account that must hold (a fact the bot does not pass counts as false)
|
||||||
|
const holds = (e) => Object.entries(e.when || {}).every(([k, v]) => (facts[k] == null ? false : facts[k]) === v);
|
||||||
|
let open = (plan.experiments || []).filter((e) => e.status === "running" && attempt >= e.attempts.from && (e.attempts.to == null || attempt <= e.attempts.to)
|
||||||
|
&& takes(e) && holds(e));
|
||||||
|
if (!open.length) return null;
|
||||||
|
if (open.some((e) => e.exclusive)) open = open.filter((e) => e.exclusive); // an exclusive experiment takes its attempts whole
|
||||||
|
const total = open.reduce((s, e) => s + e.share, 0);
|
||||||
|
let u = rng(hash(`${plan.seed || 0}|${accountSeq}|${attempt}`))() * total, exp = open[open.length - 1];
|
||||||
|
for (const e of open) { if (u < e.share) { exp = e; break; } u -= e.share; }
|
||||||
|
// the unit that is randomised: the account (one arm for life) or the attempt (blocks within the account)
|
||||||
|
// (accounts are counted among those the experiment takes, so its blocks stay balanced)
|
||||||
|
const off = exp.accounts ? (((accountSeq - (exp.accounts.offset || 0)) % exp.accounts.every) + exp.accounts.every) % exp.accounts.every : 0;
|
||||||
|
const nth = exp.accounts ? Math.floor(accountSeq / exp.accounts.every) * exp.accounts.take + off : accountSeq;
|
||||||
|
let arm = exp.unit === "account" ? armFor(exp, nth) : armFor({ ...exp, seed: `${exp.seed || 0}|${accountSeq}` }, attempt - exp.attempts.from);
|
||||||
|
// cycle: a different combination of these decisions on every attempt of the account, none repeated until all
|
||||||
|
// are used (the combinations are walked with a step that shares no factor with their number)
|
||||||
|
if (arm.cycle) {
|
||||||
|
const keys = Object.keys(arm.cycle), total = keys.reduce((n, k) => n * arm.cycle[k].length, 1);
|
||||||
|
const gcd = (a, b) => (b ? gcd(b, a % b) : a), h = hash(`${exp.seed || 0}|${exp.id}|${accountSeq}`);
|
||||||
|
let step = (h % total) || 1;
|
||||||
|
while (gcd(step, total) !== 1) step = (step % total) + 1;
|
||||||
|
let i = ((h >>> 8) + (attempt - exp.attempts.from) * step) % total;
|
||||||
|
const combo = {};
|
||||||
|
for (const k of keys) { combo[k] = arm.cycle[k][i % arm.cycle[k].length]; i = Math.floor(i / arm.cycle[k].length); }
|
||||||
|
arm = { id: keys.map((k) => `${k}=${combo[k]}`).join(" / "), fix: { ...arm.fix, ...combo } };
|
||||||
|
}
|
||||||
|
return { experimentId: exp.id, arm: arm.id, fix: arm.fix || null, target: exp.target, objective: exp.objective || "eventually",
|
||||||
|
sampling: exp.sampling || "best", seed: hash(`${plan.seed || 0}|${exp.id}|${accountSeq}|${attempt}`),
|
||||||
|
propensity: (exp.share / total) / exp.arms.length, burn: exp.burn || null, planId: plan.id };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- picks made from the screen tree (analysis/tree/build_tree.py, published as tree.json) ---------- */
|
||||||
|
/**
|
||||||
|
* Which option to pick on a screen, from what the tree knows about that screen:
|
||||||
|
* screenPick(tree, sceneId, offered, { mode, seed }) -> { index, text, n, mode, reason } (null: nothing offered)
|
||||||
|
* sceneId is the bot's own id for the screen; offered the option texts on it. An option the tree has never seen
|
||||||
|
* counts as never played.
|
||||||
|
* mode "least-tried": the option played least so far (mapping: fills the tree's gaps first).
|
||||||
|
* mode "thompson": for each option, draw a survival rate from what has been seen (survived + 1, died + 1) and
|
||||||
|
* take the highest: untested options get tried, deadly ones fade out. It looks one step
|
||||||
|
* ahead only, so use it where dying is the risk (a bonding encounter).
|
||||||
|
* Ties and draws use `seed` (give a new one per attempt and screen).
|
||||||
|
*/
|
||||||
|
function screenPick(tree, sceneId, offered, { mode = "least-tried", seed = 1 } = {}) {
|
||||||
|
if (!offered || !offered.length) return null;
|
||||||
|
const sc = ((tree || {}).screens || {})[sceneId], rand = rng(hash(`${seed}|${sceneId}|${mode}`));
|
||||||
|
const known = sc ? Object.values(sc.options) : [];
|
||||||
|
const rows = offered.map((text, index) => {
|
||||||
|
const o = known.find((k) => norm(k.text) === norm(text)) || { n: 0, to: {} };
|
||||||
|
const died = (o.to.DIED || { n: 0 }).n;
|
||||||
|
return { index, text, n: o.n, survived: o.n - died, died, tie: rand() };
|
||||||
|
});
|
||||||
|
let pick;
|
||||||
|
if (mode === "thompson") {
|
||||||
|
for (const r of rows) { const a = gamma(r.survived + 1, rand), b = gamma(r.died + 1, rand); r.draw = a / (a + b); }
|
||||||
|
pick = rows.reduce((x, y) => (y.draw > x.draw ? y : x));
|
||||||
|
} else {
|
||||||
|
pick = rows.reduce((x, y) => (y.n < x.n || (y.n === x.n && y.tie < x.tie) ? y : x));
|
||||||
|
}
|
||||||
|
return { index: pick.index, text: pick.text, n: pick.n, mode,
|
||||||
|
reason: mode === "thompson" ? `survived ${pick.survived} of ${pick.n} so far` : `played ${pick.n} times, the fewest on this screen` };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- known answers (analysis/known/build_known.py -> data/public/known_answers.json) ---------- */
|
||||||
|
const STOP = new Set("a an the to and or of your you its it is for at in on with this that be".split(" "));
|
||||||
|
const words = (t) => norm(t).split(" ").filter((w) => w && !STOP.has(w));
|
||||||
|
/** The guide labels a game text carries: the guide paraphrases ("Touch its talon"), the game says it in full ("Reach a
|
||||||
|
* hand slowly to touch its talon"), so a label matches when every word of it that matters is in the text. Labels of
|
||||||
|
* fewer than two such words ("Is your dragon") only match a text that is exactly the label. */
|
||||||
|
function guideMatches(known, text) {
|
||||||
|
const n = norm(text), have = new Set(words(text)), out = [];
|
||||||
|
for (const [k, e] of Object.entries(known.answers || {})) {
|
||||||
|
if (!e.guide) continue;
|
||||||
|
const w = words(e.text);
|
||||||
|
const exact = k === n;
|
||||||
|
if (exact || (w.length >= 2 && w.every((x) => have.has(x)))) e.guide.forEach((g) => out.push({ ...g, label: e.text, exact }));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A screen nothing else covers: what the Atlas knows about each choice, and a pick when it is clear.
|
||||||
|
* known data/public/known_answers.json
|
||||||
|
* offered the choice texts on screen, in order
|
||||||
|
* target the colour the account is after ("Blue"); sceneColour: the colour of this scene's dragon, if the
|
||||||
|
* bot knows it (only the guide's answers for that dragon's encounters are used then)
|
||||||
|
* Returns { pick, confidence, reason, choices }: pick is the index to take (null if nothing is clear), confidence
|
||||||
|
* "strong" (exactly one choice is on the guide's recommended path toward the target, and the bot's own runs don't
|
||||||
|
* contradict it) or "weak" (several fit, or only the bot's own record speaks for it). choices[i].verdict is "good",
|
||||||
|
* "bad" (the guide ends it in incineration, or the bot died on it at least 3 times in 4) or "unknown", with the
|
||||||
|
* evidence behind it. Anything weak or unknown goes to Clef with this evidence; a pick never skips the bot's guard.
|
||||||
|
*/
|
||||||
|
function knownAnswer(known, offered, { target, sceneColour = null } = {}) {
|
||||||
|
const T = target ? target[0].toUpperCase() + target.slice(1).toLowerCase() : null;
|
||||||
|
const choices = offered.map((text, index) => {
|
||||||
|
const e = (known.answers || {})[norm(text)] || {};
|
||||||
|
const bot = e.bot || null;
|
||||||
|
const guide = guideMatches(known, text).filter((g) => !sceneColour || (g.colours || []).includes(sceneColour));
|
||||||
|
const onPath = guide.filter((g) => T && (g.on_path || []).includes(T));
|
||||||
|
const botBad = bot && bot.n >= 2 && bot.died / bot.n >= 0.75;
|
||||||
|
const botGood = bot && bot.n >= 3 && bot.died === 0;
|
||||||
|
const guideBad = guide.length > 0 && guide.every((g) => /^Incinerated/.test(g.end));
|
||||||
|
const verdict = onPath.length && !botBad ? "good" : guideBad || botBad ? "bad" : "unknown";
|
||||||
|
return { index, text, verdict, guide, bot, onPath: onPath.length > 0, botGood: !!botGood };
|
||||||
|
});
|
||||||
|
const good = choices.filter((c) => c.verdict === "good");
|
||||||
|
let pick = null, confidence = null, reason = "nothing the Atlas knows covers these choices";
|
||||||
|
if (good.length === 1) {
|
||||||
|
pick = good[0].index; confidence = "strong";
|
||||||
|
reason = `on the guide's recommended path to the ${T} ("${good[0].onPath && good[0].guide.find((g) => (g.on_path || []).includes(T)).label}")`;
|
||||||
|
} else if (good.length > 1) {
|
||||||
|
const best = good.find((c) => c.botGood) || good[0];
|
||||||
|
pick = best.index; confidence = "weak"; reason = `${good.length} choices are on the guide's paths; the bot's record favours none clearly`;
|
||||||
|
} else {
|
||||||
|
const safe = choices.filter((c) => c.botGood && c.verdict !== "bad");
|
||||||
|
if (safe.length) {
|
||||||
|
const b = safe.reduce((x, y) => (y.bot.n > x.bot.n ? y : x));
|
||||||
|
pick = b.index; confidence = "weak"; reason = `the bot got through it ${b.bot.n} of ${b.bot.n} times`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { pick, confidence, reason, choices };
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.assign(api, {
|
||||||
|
advisor, recommendOption, solverHistory, norm, assign, armFor, givenFor, screenPick, knownAnswer,
|
||||||
|
makeParams: (T, { alphas, game } = {}) => makeParams(T, { alphas, game: game || api.game }),
|
||||||
|
/** remember the game of a policy sample (sets ENCOUNTERS) without solving anything */
|
||||||
|
useGame(sample) { api.game = sample.model.game; api.ENCOUNTERS = api.game.by_colour; return api.game; },
|
||||||
|
ENCOUNTERS: null, game: null,
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
/* ui.js — tabs, hero art, the plain-language overview and the illustrated valley map.
|
||||||
|
* Reads the same coded runs and results as the rest of the page (window.ThreshAtlas.state). */
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
const $ = (q, el = document) => el.querySelector(q);
|
||||||
|
const $$ = (q, el = document) => [...el.querySelectorAll(q)];
|
||||||
|
const NS = "http://www.w3.org/2000/svg";
|
||||||
|
const cssVar = (n) => getComputedStyle(document.documentElement).getPropertyValue(n).trim();
|
||||||
|
const esc = (x) => String(x ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ }[c]));
|
||||||
|
const pct = (p, d = 0) => (p === null || p === undefined || isNaN(p) ? "–" : (p * 100).toFixed(d) + "%");
|
||||||
|
const DV = { Red: "--dr-red", Green: "--dr-green", Orange: "--dr-orange", Brown: "--dr-brown", Blue: "--dr-blue", Black: "--dr-black" };
|
||||||
|
const oneIn = (p) => (p > 0 ? Math.max(1, Math.round(1 / p)) : null);
|
||||||
|
function el(tag, attrs = {}, parent) {
|
||||||
|
const e = document.createElementNS(NS, tag);
|
||||||
|
for (const [k, v] of Object.entries(attrs)) if (v !== null && v !== undefined) e.setAttribute(k, v);
|
||||||
|
if (parent) parent.appendChild(e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
function rgb(c) {
|
||||||
|
c = (c || "").trim();
|
||||||
|
if (c.startsWith("#")) { const h = c.length === 4 ? [...c.slice(1)].map((x) => x + x).join("") : c.slice(1); return [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16)); }
|
||||||
|
const m = c.match(/\d+(\.\d+)?/g); return m ? m.slice(0, 3).map(Number) : [128, 128, 128];
|
||||||
|
}
|
||||||
|
const mix = (a, b, t) => { const A = rgb(a), B = rgb(b); return `rgb(${A.map((v, i) => Math.round(v + (B[i] - v) * t)).join(",")})`; };
|
||||||
|
function rng(seed) { let s = seed >>> 0; return () => ((s = (s * 1664525 + 1013904223) >>> 0) / 4294967296); }
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ tabs
|
||||||
|
const TABS = ["valley", "odds", "dragons", "deep", "data", "report"];
|
||||||
|
// 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);
|
||||||
|
$("#tab-" + t).tabIndex = on ? 0 : -1;
|
||||||
|
$("#panel-" + t).hidden = !on;
|
||||||
|
});
|
||||||
|
if (focus) $("#tab-" + name).focus();
|
||||||
|
try { $("#tab-" + name).scrollIntoView({ block: "nearest", inline: "center" }); } catch (e) { /* ignore */ }
|
||||||
|
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);
|
||||||
|
b.addEventListener("click", () => showTab(t));
|
||||||
|
b.addEventListener("keydown", (e) => {
|
||||||
|
if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
|
||||||
|
const j = (i + (e.key === "ArrowRight" ? 1 : TABS.length - 1)) % TABS.length;
|
||||||
|
showTab(TABS[j], true); e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$$("[data-go]").forEach((b) => b.addEventListener("click", () => { showTab(b.dataset.go); window.scrollTo({ top: 0, behavior: "smooth" }); }));
|
||||||
|
// in-page links that point at sections inside other tabs
|
||||||
|
document.addEventListener("click", (e) => {
|
||||||
|
const a = e.target.closest('a[href^="#"]');
|
||||||
|
if (!a) return;
|
||||||
|
const id = a.getAttribute("href").slice(1);
|
||||||
|
if (tabOf(id)) {
|
||||||
|
// keep sub-paths such as #valley/blue so the destination can open on that selection
|
||||||
|
e.preventDefault();
|
||||||
|
try { history.replaceState(null, "", "#" + id); } catch (err) { /* ignore */ }
|
||||||
|
showTab(tabOf(id), false, true);
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
|
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" }); }
|
||||||
|
});
|
||||||
|
// #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");
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ methods tabs (arrow keys move between them)
|
||||||
|
const mtabs = $$(".mtab");
|
||||||
|
const showM = (b, focus) => {
|
||||||
|
mtabs.forEach((t) => { const on = t === b; t.setAttribute("aria-selected", on); t.tabIndex = on ? 0 : -1; $("#" + t.getAttribute("aria-controls")).hidden = !on; });
|
||||||
|
if (focus) b.focus();
|
||||||
|
};
|
||||||
|
mtabs.forEach((b, i) => {
|
||||||
|
b.addEventListener("click", () => showM(b));
|
||||||
|
b.addEventListener("keydown", (e) => {
|
||||||
|
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
||||||
|
e.preventDefault();
|
||||||
|
showM(mtabs[(i + (e.key === "ArrowRight" ? 1 : mtabs.length - 1)) % mtabs.length], true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ hero art (original, generic silhouettes)
|
||||||
|
function drawHero() {
|
||||||
|
const svg = $("#hero-art");
|
||||||
|
svg.innerHTML = "";
|
||||||
|
const g = el("g", {}, svg);
|
||||||
|
el("path", { d: "M0 330 L120 250 L210 290 L330 200 L430 270 L560 180 L690 260 L800 210 L930 280 L1040 220 L1200 290 L1200 420 L0 420 Z", fill: "#2c1120" }, g);
|
||||||
|
el("path", { d: "M0 360 L160 300 L300 330 L470 270 L620 330 L780 285 L960 335 L1100 300 L1200 330 L1200 420 L0 420 Z", fill: "#220a17" }, g);
|
||||||
|
// tree line
|
||||||
|
const R = rng(3); let tl = "M0 420 L0 380";
|
||||||
|
for (let x = 0; x <= 1200; x += 14) { const h = 18 + R() * 30; tl += ` L${x + 7} ${392 - h} L${x + 14} ${392 - R() * 6}`; }
|
||||||
|
el("path", { d: tl + " L1200 420 Z", fill: "#16060e" }, g);
|
||||||
|
// a generic cliff-top keep, right side
|
||||||
|
const keep = el("g", { fill: "#1a0812", transform: "translate(0 40)" }, g);
|
||||||
|
el("path", { d: "M930 360 L930 250 L960 240 L990 250 L1010 236 L1040 250 L1070 232 L1100 250 L1130 245 L1150 360 Z" }, keep);
|
||||||
|
[[952, 196, 20, 58], [1000, 180, 22, 70], [1058, 190, 18, 60], [1098, 205, 16, 46]].forEach(([x, y, w, h]) => {
|
||||||
|
el("rect", { x, y, width: w, height: h }, keep);
|
||||||
|
el("path", { d: `M${x - 3} ${y} L${x + w / 2} ${y - 18} L${x + w + 3} ${y} Z` }, keep);
|
||||||
|
});
|
||||||
|
// distant riders: simple winged silhouettes
|
||||||
|
const shape = "M50 30 L18 6 L27 21 L3 16 L25 32 Z M50 30 L82 6 L73 21 L97 16 L75 32 Z M37 30 Q50 23 63 30 Q50 37 37 30 Z M63 30 L76 26 L80 28 L73 31 Z M37 30 Q24 37 10 34 Q22 33 36 31 Z";
|
||||||
|
[[700, 70, 0.9, 0.9], [560, 120, 0.55, 0.7], [820, 130, 0.42, 0.55], [380, 95, 0.32, 0.45]].forEach(([x, y, s, o]) =>
|
||||||
|
el("path", { d: shape, transform: `translate(${x} ${y}) scale(${s})`, fill: "#0f040a", "fill-opacity": o }, g));
|
||||||
|
const em = $("#embers");
|
||||||
|
if (em && !em.childElementCount) {
|
||||||
|
const R2 = rng(11);
|
||||||
|
for (let i = 0; i < 26; i++) {
|
||||||
|
const e = document.createElement("i");
|
||||||
|
e.style.left = (R2() * 100).toFixed(1) + "%";
|
||||||
|
e.style.animationDuration = (6 + R2() * 7).toFixed(1) + "s";
|
||||||
|
e.style.animationDelay = (-R2() * 12).toFixed(1) + "s";
|
||||||
|
const sz = (2 + R2() * 3).toFixed(1); e.style.width = e.style.height = sz + "px";
|
||||||
|
if (matchMedia("(prefers-reduced-motion: reduce)").matches) e.style.top = (10 + R2() * 80).toFixed(1) + "%";
|
||||||
|
em.appendChild(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawHero();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ overview
|
||||||
|
function stratum(c, prefix) { const e = Object.entries(c.by_stratum).find(([k]) => k.startsWith(prefix)); return e ? e[1] : null; }
|
||||||
|
function dots(k, n, color, total = 100) {
|
||||||
|
const p = n ? k / n : 0, filled = p * total;
|
||||||
|
const cols = 20, r = 4, gap = 11, rows = Math.ceil(total / cols);
|
||||||
|
const svg = el("svg", { viewBox: `0 0 ${cols * gap} ${rows * gap}`, role: "img", "aria-label": `${pct(p, 1)} shown as ${total} dots` });
|
||||||
|
for (let i = 0; i < total; i++) {
|
||||||
|
const x = (i % cols) * gap + gap / 2, y = Math.floor(i / cols) * gap + gap / 2;
|
||||||
|
const on = i < Math.floor(filled), part = i === Math.floor(filled) && filled % 1 > 0.05;
|
||||||
|
el("circle", { cx: x, cy: y, r, fill: on ? color : "none", stroke: on || part ? color : cssVar("--line"), "stroke-width": 1.2, "fill-opacity": part ? 0.35 : 1 }, svg);
|
||||||
|
if (part) el("circle", { cx: x, cy: y, r: r * Math.sqrt(filled % 1), fill: color }, svg);
|
||||||
|
}
|
||||||
|
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: "sitting", Green: "prowling", Blue: "coiled", Black: "resting" };
|
||||||
|
|
||||||
|
let blackP = null;
|
||||||
|
const getBlack = () => blackP || (blackP = fetch("data/black.json").then((r) => r.json()).catch(() => null));
|
||||||
|
const frac = ([k, n]) => `${k.toLocaleString()} of ${n.toLocaleString()}`;
|
||||||
|
// The shadow and the Black: what analysis/black/evidence.py found (data/black.json; the full write-up is BLACK.md).
|
||||||
|
function renderBlack(b) {
|
||||||
|
const t2 = $("#truth-history"), box = $("#black-evidence");
|
||||||
|
if (!b) { if (t2) t2.innerHTML = '<h3>Your first attempt is different</h3><p class="small muted">The shadow evidence could not be loaded.</p>'; return; }
|
||||||
|
const ff = b.form_first, fl = b.form_later, sr = b.same_route, as = b.after_shadow, gaze = as.answers["held its gaze"];
|
||||||
|
if (t2) t2.innerHTML = `<h3>Your first attempt is different</h3><p class="small">Among riders who helped their squadmate and climbed the tree, the shadow came in <b>${frac(ff)}</b> first attempts (${pct(ff[0] / ff[1], 1)}) and <b>${frac(fl)}</b> later ones. On the very same routes, first attempts saw it about ${Math.round(sr.first_shadows / Math.max(sr.expected, 1) * 10) / 10}× as often as chance would give. The shadow is not a dice roll you can repeat.</p>`;
|
||||||
|
const steps = $("#black-steps");
|
||||||
|
if (steps) steps.innerHTML = `How it breaks down: the shadow came in ${frac(ff)} reported first attempts (over-reported); after it, ${as.reached_black} riders reached the Black and <b>${as.bonded_black}</b> bonded (${pct(as.bonded_black / Math.max(as.reached_black, 1))}).`;
|
||||||
|
if (!box) return;
|
||||||
|
const br = b.best_route;
|
||||||
|
box.hidden = false;
|
||||||
|
box.innerHTML = `<h3>The Black is not dice</h3>
|
||||||
|
<p class="small">The game's author has said the Black is not luck, and the runs agree. The shadow at the tree needs three things: you <b>investigated and helped</b> your squadmate, you <b>climbed the tree</b>, and it is (almost always) your <b>first attempt</b>. ${b.shadow_routes.runs} shadow runs came from ${b.shadow_routes.routes} different routes, so no single route is the trick; only ${b.shadow_routes.off_gate} were logged off that path.</p>
|
||||||
|
<ul class="small">
|
||||||
|
<li>Best-logged route (${esc(br.route.join(" → "))}): shadow in <b>${frac(br.first)}</b> first attempts, <b>${frac(br.later)}</b> later ones.</li>
|
||||||
|
<li>After the shadow, ${as.reached_black} riders reached the Black and <b>${as.bonded_black}</b> bonded it; ${as.died_at_blue} were burned by the Blue first.</li>
|
||||||
|
${gaze ? `<li>At the Black, riders who held its gaze bonded in <b>${frac(gaze)}</b> logged answers.</li>` : ""}
|
||||||
|
<li>The bot has made ${b.bot.attempts.toLocaleString()} attempts on ${b.bot.accounts} accounts, ${b.bot.gated_tree} on the gated path, and seen the shadow ${b.bot.shadows} times: none of them was a first attempt${b.bot.earliest_attempt ? ` (its earliest was attempt ${b.bot.earliest_attempt})` : ""}, which fits.</li>
|
||||||
|
</ul>
|
||||||
|
<p class="small"><b>Why the Black's odds are uncertain.</b> The Black comes only after the shadow, and every logged shadow comes from riders who chose to post their run. Riders are much more likely to post a run with a shadow than one without, and no complete log (the bot, bulk logs) has a first attempt with a shadow yet, so the estimate assumes riders over-report the shadow as much as the meadow Blue. Fresh accounts the bot plays to the tree on their first attempt will replace that assumption; until then the odds are a range, not a figure.</p>
|
||||||
|
<p class="small muted">Method and every table: <code>analysis/reports/BLACK.md</code>; the numbers: <a href="data/black.json">data/black.json</a>.</p>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) => {
|
||||||
|
// the Black only comes after the shadow, and the shadow (almost) only on a first attempt: show that attempt
|
||||||
|
const first = c === "Black" && lb.targets[c].firstAttempt;
|
||||||
|
const src = first ? lb.targets[c].firstAttempt.thisAttempt : lb.targets[c].eventually;
|
||||||
|
const srcAll = first && all.targets[c].firstAttempt ? all.targets[c].firstAttempt.thisAttempt : all.targets[c].eventually;
|
||||||
|
return { c, first: !!first, p: src.pX.mean, pAll: srcAll.pX.mean, lo: src.pX.lo, hi: src.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)", dark: c === "Black" })}</svg>` : "";
|
||||||
|
$("#odds-colours").innerHTML = cols.map(({ c, first, p, pAll, lo, hi }) => {
|
||||||
|
const e = enc(c);
|
||||||
|
// The Black rests on one roll no complete log has measured (the shadow on a first attempt): a range, not a figure
|
||||||
|
if (first) return `<a class="odd odd-colour odd-low" href="#valley/${c.toLowerCase()}" style="--c: var(${DV[c]})">${art(c)}
|
||||||
|
<span class="pill warn">Low evidence</span>
|
||||||
|
<span class="big">about 1 in ${oneIn(p)}</span><span class="what">first attempts end bonded to a Black, on the best route</span>
|
||||||
|
${dots(Math.round(p * 1000), 1000, cssVar(DV[c]))}
|
||||||
|
<span class="how">Somewhere between <b>1 in ${oneIn(hi)}</b> and <b>1 in ${oneIn(lo)}</b> (95%). Later attempts: no shadow has ever been logged, so effectively never.${Math.abs(pAll - p) / p > 0.25 ? ` All form posts suggest about 1 in ${oneIn(pAll)}.` : ""} Every logged shadow comes from riders who chose to post their run, so this rests on an assumption until complete first-attempt logs exist. <span id="black-steps"></span></span>
|
||||||
|
<span class="go">See the route →</span></a>`;
|
||||||
|
return `<a class="odd odd-colour" href="#valley/${c.toLowerCase()}" style="--c: var(${DV[c]})">${art(c)}
|
||||||
|
<span class="big">${p >= 0.5 ? pct(p) : `1 in ${oneIn(p)}`}</span><span class="what">${p >= 0.5 ? "of runs" : "runs"} end bonded to ${/^[AEIOU]/.test(c) ? "an" : "a"} ${c}, on the best route${first ? ", on your first attempt" : ""}</span>
|
||||||
|
${dots(Math.round(p * 1000), 1000, cssVar(DV[c]))}
|
||||||
|
<span class="how"><b>${pct(p, p < 0.1 ? 1 : 0)}</b> ${first ? "on a first attempt" : "per attempt"} (95% ${pct(lo, 1)}–${pct(hi, 1)}), from riders who logged every run${first ? "; later attempts almost never see the shadow" : ""}${Math.abs(pAll - p) / p > 0.25 ? `; all form posts suggest ${pct(pAll, 1)}` : ""}. At ${ENC_LABEL[ENC_OF[c]]}, <b>${e.k} of ${e.n}</b> genuine attempts bonded.</span>
|
||||||
|
<span class="go">See the route →</span></a>`;
|
||||||
|
}).join("");
|
||||||
|
getBlack().then(renderBlack);
|
||||||
|
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;
|
||||||
|
const bulkB = stratum(cb, "Bulk");
|
||||||
|
const tag = (txt) => `<span class="how">${txt}</span>`;
|
||||||
|
// A cadet who walks in and either dies or bonds. Deliberate deaths are left out: a rider burned at a bonding
|
||||||
|
// encounter they did not genuinely attempt (they were after another colour and planned to seek Malek). Runs with
|
||||||
|
// no recorded outcome are left out too. Same rule the route model uses for encounter odds (precomputed in Python).
|
||||||
|
const O = state.P.overview;
|
||||||
|
const cadets = { length: O.cadets }, nDeliberate = O.deliberate, bonded = O.bonded, dead = O.dead, earlyDeaths = O.early_deaths;
|
||||||
|
const cards = [
|
||||||
|
{ c: "--accent", big: pct(bonded / cadets.length), what: "become a rider", how: `${bonded.toLocaleString()} of ${cadets.length.toLocaleString()} cadets bonded a dragon. ${pct(1 - earlyDeaths / cadets.length)} made it to the tree-or-valley choice alive.`, w: { k: bonded, n: cadets.length } },
|
||||||
|
{ c: "--death", big: dead.toLocaleString(), what: "riders sent to Malek", how: `${pct(dead / cadets.length)} of cadets were burned or killed. Deliberate deaths (${nDeliberate.toLocaleString()} runs where the rider chose to die and try again) are not counted.`, w: { k: dead, n: cadets.length }, 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>${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 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: "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: "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 depends on what you did before: the shadow comes only to first-attempt riders who helped and climbed. 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. The Odds page leans 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.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tooltip shared with app.js
|
||||||
|
const tipEl = $("#tip");
|
||||||
|
function tip(e, html) {
|
||||||
|
tipEl.innerHTML = html; tipEl.hidden = false;
|
||||||
|
const r = tipEl.getBoundingClientRect();
|
||||||
|
tipEl.style.left = Math.min(window.innerWidth - r.width - 8, e.clientX + 14) + "px";
|
||||||
|
tipEl.style.top = Math.min(window.innerHeight - r.height - 8, e.clientY + 14) + "px";
|
||||||
|
}
|
||||||
|
const hideTip = () => (tipEl.hidden = true);
|
||||||
|
|
||||||
|
window.AtlasUI = {
|
||||||
|
render(state) {
|
||||||
|
renderOverview(state);
|
||||||
|
if (window.ValleyExplorer) window.ValleyExplorer.setStats(state.P, state.stats && state.stats.paths);
|
||||||
|
},
|
||||||
|
showTab,
|
||||||
|
};
|
||||||
|
if (window.ThreshAtlas && window.ThreshAtlas.state && window.ThreshAtlas.state.res) window.AtlasUI.render(window.ThreshAtlas.state);
|
||||||
|
})();
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
/* valley.js — the watercolour valley map.
|
||||||
|
* Places, the painted ground, and their names; explorer.js draws routes and traffic on top. How many riders
|
||||||
|
* reached each place and walked each step is counted in Python (analysis/stats/site_stats.py). */
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
const $ = (q, el = document) => el.querySelector(q);
|
||||||
|
const $$ = (q, el = document) => [...el.querySelectorAll(q)];
|
||||||
|
const NS = "http://www.w3.org/2000/svg";
|
||||||
|
const cssVar = (n) => getComputedStyle(document.documentElement).getPropertyValue(n).trim();
|
||||||
|
const esc = (x) => String(x ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ }[c]));
|
||||||
|
const pct = (p, d = 0) => (p === null || p === undefined || isNaN(p) ? "–" : (p * 100).toFixed(d) + "%");
|
||||||
|
const DV = { Red: "--dr-red", Green: "--dr-green", Orange: "--dr-orange", Brown: "--dr-brown", Blue: "--dr-blue", Black: "--dr-black" };
|
||||||
|
// painted-map dragon inks (darker than the UI tones so they read on gold paper)
|
||||||
|
// chosen so every pair stays distinguishable under common colour-vision deficiencies (docs/COLOURS.md)
|
||||||
|
const INK = { Red: "#cc3346", Green: "#2f8f6f", Orange: "#e08a2a", Brown: "#4e3020", Blue: "#2a58b8", Black: "#22182a" };
|
||||||
|
const PAPER = { ink: "#3b2416", halo: "#f6e6c4", trailLow: "#8a6446", death: "#c4471c" };
|
||||||
|
function el(tag, attrs = {}, parent) {
|
||||||
|
const e = document.createElementNS(NS, tag);
|
||||||
|
for (const [k, v] of Object.entries(attrs)) if (v !== null && v !== undefined) e.setAttribute(k, v);
|
||||||
|
if (parent) parent.appendChild(e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
function rgb(c) {
|
||||||
|
c = (c || "").trim();
|
||||||
|
if (c.startsWith("#")) { const h = c.length === 4 ? [...c.slice(1)].map((x) => x + x).join("") : c.slice(1); return [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16)); }
|
||||||
|
const m = c.match(/\d+(\.\d+)?/g); return m ? m.slice(0, 3).map(Number) : [128, 128, 128];
|
||||||
|
}
|
||||||
|
const mix = (a, b, t) => { const A = rgb(a), B = rgb(b); return `rgb(${A.map((v, i) => Math.round(v + (B[i] - v) * t)).join(",")})`; };
|
||||||
|
function rng(seed) { let s = seed >>> 0; return () => ((s = (s * 1664525 + 1013904223) >>> 0) / 4294967296); }
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ places
|
||||||
|
// kind: start | way (a choice point) | dragon (a dragon is met here) | small (a choice made here)
|
||||||
|
const L = {
|
||||||
|
"comp:Alone": { x: 500, y: 736, name: "Alone", kind: "start", lab: "below", desc: "Enter the valley alone. The most common start, and the one that survives most often." },
|
||||||
|
"comp:1 Squadmate": { x: 380, y: 740, name: "One squadmate", kind: "start", lab: "below", desc: "Enter with one squadmate. You can later leave them and go on alone." },
|
||||||
|
"comp:2 Squadmates": { x: 620, y: 740, name: "Two squadmates", kind: "start", lab: "below", desc: "Enter with two squadmates. The first dragon is often deadlier for a group." },
|
||||||
|
"dir:West": { x: 190, y: 662, name: "West", sub: "toward the scent", kind: "way", lab: "left", desc: "Follow a scent west. A Brown, Green or Red finds you first." },
|
||||||
|
"dir:Center": { x: 500, y: 668, name: "Forest centre", kind: "way", lab: "right", desc: "Straight into the forest. Alone, a Red or a Brown finds you first." },
|
||||||
|
"dir:East": { x: 810, y: 662, name: "East", sub: "toward the roar", kind: "way", lab: "right", desc: "Toward the roar. Alone, a Red or an Orange finds you first. With one squadmate, a Green or an Orange." },
|
||||||
|
// first sightings (game roll)
|
||||||
|
"see:West:Red": { x: 110, y: 598, colour: "Red", kind: "dragon", first: true },
|
||||||
|
"see:West:Brown": { x: 185, y: 584, colour: "Brown", kind: "dragon", first: true },
|
||||||
|
"see:West:Green": { x: 262, y: 598, colour: "Green", kind: "dragon", first: true },
|
||||||
|
"see:Center:Red": { x: 448, y: 600, colour: "Red", kind: "dragon", first: true },
|
||||||
|
"see:Center:Brown": { x: 552, y: 600, colour: "Brown", kind: "dragon", first: true },
|
||||||
|
"see:East:Red": { x: 738, y: 598, colour: "Red", kind: "dragon", first: true },
|
||||||
|
"see:East:Orange": { x: 815, y: 584, colour: "Orange", kind: "dragon", first: true },
|
||||||
|
"see:East:Green": { x: 892, y: 598, colour: "Green", kind: "dragon", first: true },
|
||||||
|
scream: { x: 500, y: 512, name: "The scream", kind: "way", lab: "right", desc: "A scream in the trees. Help the squadmate fighting two cadets, walk away, or ignore it." },
|
||||||
|
bully: { x: 318, y: 462, name: "The bully fight", kind: "way", lab: "left", desc: "A squadmate is cornered by two cadets. Assess, even the numbers, or put yourself in the middle." },
|
||||||
|
"res:Killed the bullies yourself": { x: 222, y: 410, name: "Kill them", kind: "small", lab: "left", desc: "End the bullies yourself." },
|
||||||
|
"res:Squadmate's revenge": { x: 312, y: 398, name: "Squadmate's revenge", kind: "small", lab: "above", desc: "Let your squadmate take revenge." },
|
||||||
|
"res:Left bullies to the dragons": { x: 404, y: 410, name: "Dragons decide", kind: "small", lab: "right", desc: "Leave the bullies to the dragons." },
|
||||||
|
away: { x: 500, y: 440, name: "Walked away", kind: "small", lab: "right", desc: "Investigated the scream, then left them to it." },
|
||||||
|
wounded: { x: 684, y: 462, name: "The wounded cadet", kind: "way", lab: "right", desc: "Ignore the scream and you trip over a cadet missing a leg." },
|
||||||
|
"res:Tourniquet": { x: 616, y: 410, name: "Tourniquet", kind: "small", lab: "left", desc: "Use their belt as a tourniquet." },
|
||||||
|
"res:Left injured cadet": { x: 690, y: 398, name: "Leave them", kind: "small", lab: "above", desc: "Leave them to die." },
|
||||||
|
"res:Took their weapons": { x: 780, y: 410, name: "Take their weapons", kind: "small", lab: "right", desc: "Take their weapons and go." },
|
||||||
|
"fork:West": { x: 196, y: 336, name: "West fork", kind: "way", lab: "left", desc: "After the fight, the path splits: west." },
|
||||||
|
"fork:Forest": { x: 318, y: 318, name: "Deeper in", kind: "way", lab: "above", desc: "After the fight: deeper into the forest. Most recorded shadows came after this choice." },
|
||||||
|
"fork:East": { x: 432, y: 336, name: "East fork", kind: "way", lab: "right", desc: "After the fight, the path splits: east." },
|
||||||
|
hour: { x: 520, y: 272, name: "An hour's walk", sub: "the thorn", kind: "way", lab: "right", desc: "An hour of walking, and a thorn draws blood. No dragon bonds before this point." },
|
||||||
|
tree: { x: 316, y: 204, name: "The tallest tree", kind: "way", lab: "right", desc: "Climb for a view: a Red below, two Greens in a clearing and, very rarely, a shadow moving west." },
|
||||||
|
valley: { x: 694, y: 204, name: "Valley centre", kind: "way", lab: "left", desc: "Walk on to the valley centre." },
|
||||||
|
treeRed: { x: 168, y: 250, name: "The Red below", colour: "Red", kind: "dragon", lab: "left", desc: "Descend quickly onto a Red prowling under the tree. The hardest bond in the game." },
|
||||||
|
greens: { x: 124, y: 140, name: "Two Greens", colour: "Green", kind: "dragon", lab: "below", desc: "Two Greens in a clearing test you. A wrong answer sometimes brings an Orange or Brown to the rescue." },
|
||||||
|
stream: { x: 372, y: 142, name: "The shadow", sub: "a stream, a claw print", kind: "way", lab: "right", desc: "The rare third option at the tree. Follow the shadow west, past a stream and a claw print." },
|
||||||
|
redwood: { x: 452, y: 84, name: "Blue at the redwood", colour: "Blue", kind: "dragon", lab: "above", desc: "A Blue coiled around a redwood. Hold still and let it pass to reach the Black." },
|
||||||
|
black: { x: 262, y: 70, name: "Behind you", colour: "Black", kind: "dragon", lab: "left", desc: "A branch snaps behind you. Turn to face the threat." },
|
||||||
|
valleyRed: { x: 846, y: 250, name: "The valley Red", colour: "Red", kind: "dragon", lab: "below", desc: "A Red that has just incinerated another cadet. Most who choose to bond it succeed. Say it isn't your dragon to walk on to the meadow." },
|
||||||
|
meadow: { x: 742, y: 146, name: "The meadow", kind: "way", lab: "below", desc: "A meadow where an Orange and a Brown wait. Sometimes a Blue joins them." },
|
||||||
|
"meadow:Orange": { x: 652, y: 100, name: "Orange", colour: "Orange", kind: "dragon", lab: "left", desc: "The meadow Orange." },
|
||||||
|
"meadow:Brown": { x: 744, y: 80, name: "Brown", colour: "Brown", kind: "dragon", lab: "above", desc: "The meadow Brown." },
|
||||||
|
"meadow:Blue": { x: 836, y: 100, name: "Meadow Blue", colour: "Blue", kind: "dragon", lab: "right", desc: "The rare meadow Blue. Most riders who approach it are burned, even with the community's best answers." },
|
||||||
|
};
|
||||||
|
// routes described by the community that the form does not record
|
||||||
|
// the routes runs take through these places are counted in Python (analysis/stats/site_stats.py, place_path)
|
||||||
|
|
||||||
|
function defs(svg) {
|
||||||
|
const d = el("defs", {}, svg);
|
||||||
|
d.innerHTML = `
|
||||||
|
<linearGradient id="vm-sky" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0" stop-color="#f3d69c"/><stop offset="0.35" stop-color="#e9c88f"/><stop offset="0.7" stop-color="#d9b07a"/><stop offset="1" stop-color="#c8955f"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="vm-sun" cx="0.62" cy="0.12" r="0.55"><stop offset="0" stop-color="#fff3d1" stop-opacity="0.9"/><stop offset="1" stop-color="#fff3d1" stop-opacity="0"/></radialGradient>
|
||||||
|
<radialGradient id="vm-vignette" cx="0.5" cy="0.5" r="0.72"><stop offset="0.6" stop-color="#2a0f1c" stop-opacity="0"/><stop offset="1" stop-color="#2a0f1c" stop-opacity="0.55"/></radialGradient>
|
||||||
|
<filter id="vm-wash" x="-10%" y="-10%" width="120%" height="120%">
|
||||||
|
<feTurbulence type="fractalNoise" baseFrequency="0.022" numOctaves="3" seed="4" result="n"/>
|
||||||
|
<feDisplacementMap in="SourceGraphic" in2="n" scale="16" xChannelSelector="R" yChannelSelector="G" result="d"/>
|
||||||
|
<feGaussianBlur in="d" stdDeviation="0.7"/>
|
||||||
|
</filter>
|
||||||
|
<filter id="vm-wash2" x="-10%" y="-10%" width="120%" height="120%">
|
||||||
|
<feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="2" seed="9" result="n"/>
|
||||||
|
<feDisplacementMap in="SourceGraphic" in2="n" scale="8" xChannelSelector="R" yChannelSelector="G"/>
|
||||||
|
</filter>
|
||||||
|
<filter id="vm-brush" x="-5%" y="-5%" width="110%" height="110%">
|
||||||
|
<feTurbulence type="fractalNoise" baseFrequency="0.09" numOctaves="2" seed="3" result="n"/>
|
||||||
|
<feDisplacementMap in="SourceGraphic" in2="n" scale="4" xChannelSelector="R" yChannelSelector="G"/>
|
||||||
|
</filter>
|
||||||
|
<filter id="vm-paper" x="0" y="0" width="100%" height="100%">
|
||||||
|
<feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2" seed="1" result="g"/>
|
||||||
|
<feColorMatrix in="g" type="matrix" values="0 0 0 0 0.36 0 0 0 0 0.24 0 0 0 0 0.14 0 0 0 0.55 -0.18"/>
|
||||||
|
</filter>
|
||||||
|
<filter id="vm-haze"><feGaussianBlur stdDeviation="10"/></filter>`;
|
||||||
|
}
|
||||||
|
function blob(g, x, y, r, fill, op, R) {
|
||||||
|
// irregular canopy blob from a few overlapping circles
|
||||||
|
for (let i = 0; i < 3; i++) el("circle", { cx: x + (R() - 0.5) * r * 0.9, cy: y + (R() - 0.5) * r * 0.6, r: r * (0.6 + R() * 0.45), fill, "fill-opacity": op }, g);
|
||||||
|
}
|
||||||
|
function paint(svg) {
|
||||||
|
const R = rng(21);
|
||||||
|
el("rect", { x: 0, y: 0, width: 1000, height: 780, fill: "url(#vm-sky)" }, svg);
|
||||||
|
el("rect", { x: 0, y: 0, width: 1000, height: 780, fill: "url(#vm-sun)" }, svg);
|
||||||
|
// far ridge and hazy hills
|
||||||
|
const far = el("g", { filter: "url(#vm-wash)" }, svg);
|
||||||
|
let d = "M-20 120";
|
||||||
|
for (let x = -20; x <= 1020; x += 60) d += ` Q${x + 30} ${40 + R() * 40} ${x + 60} ${90 + R() * 40}`;
|
||||||
|
el("path", { d: d + " L1020 -10 L-20 -10 Z", fill: "#c99a72", "fill-opacity": 0.55 }, far);
|
||||||
|
el("path", { d: "M-20 150 Q200 90 420 140 T820 120 T1020 150 L1020 200 L-20 200 Z", fill: "#d4a677", "fill-opacity": 0.45 }, far);
|
||||||
|
// forest: three depth tiers of canopy washes, kept out of the clearings
|
||||||
|
const clear = [[742, 100, 150, 85], [124, 140, 92, 58], [694, 205, 80, 44], [520, 272, 70, 32], [846, 250, 70, 40], [500, 740, 190, 46], [318, 455, 120, 60], [684, 455, 120, 60], [500, 660, 80, 30]];
|
||||||
|
const inClear = (x, y) => clear.some(([cx, cy, rx, ry]) => ((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2 < 1);
|
||||||
|
const tiers = [
|
||||||
|
{ y0: 120, y1: 330, n: 150, r: [10, 20], cols: ["#b39a63", "#a99158"], op: 0.32 },
|
||||||
|
{ y0: 300, y1: 560, n: 170, r: [12, 24], cols: ["#8e8a54", "#7f7e4b"], op: 0.4 },
|
||||||
|
{ y0: 520, y1: 780, n: 170, r: [14, 30], cols: ["#6c6b40", "#5b5c37", "#6b5a35"], op: 0.45 },
|
||||||
|
];
|
||||||
|
tiers.forEach((t, ti) => {
|
||||||
|
const g = el("g", { filter: "url(#vm-wash)" }, svg);
|
||||||
|
// tall pale trunks, like a sunlit wood
|
||||||
|
for (let i = 0; i < t.n * 0.25; i++) {
|
||||||
|
const x = R() * 1000, y = t.y0 + R() * (t.y1 - t.y0);
|
||||||
|
if (inClear(x, y)) continue;
|
||||||
|
el("rect", { x, y: y - 50 - ti * 10, width: 2 + ti * 1.5, height: 60 + ti * 14, fill: "#7a5c3c", "fill-opacity": 0.18 + ti * 0.07 }, g);
|
||||||
|
}
|
||||||
|
for (let i = 0; i < t.n; i++) {
|
||||||
|
const x = R() * 1000, y = t.y0 + R() * (t.y1 - t.y0);
|
||||||
|
if (inClear(x, y)) continue;
|
||||||
|
blob(g, x, y, t.r[0] + R() * (t.r[1] - t.r[0]), t.cols[Math.floor(R() * t.cols.length)], t.op, R);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// clearings: warm ochre light
|
||||||
|
const cg = el("g", { filter: "url(#vm-wash)" }, svg);
|
||||||
|
clear.forEach(([cx, cy, rx, ry]) => el("ellipse", { cx, cy, rx: rx * 0.85, ry: ry * 0.8, fill: "#f0cf93", "fill-opacity": 0.55 }, cg));
|
||||||
|
// mist bands
|
||||||
|
const mg = el("g", { filter: "url(#vm-haze)" }, svg);
|
||||||
|
[[230, 0.35], [380, 0.2], [560, 0.18]].forEach(([y, o]) => el("rect", { x: -40, y, width: 1080, height: 26, fill: "#fbe9c4", "fill-opacity": o }, mg));
|
||||||
|
// the stream
|
||||||
|
const sg = el("g", { filter: "url(#vm-wash2)" }, svg);
|
||||||
|
const stream = "M560 -10 C 520 40, 470 70, 420 112 S 330 170, 270 150 S 170 120, 110 220 S 40 320, -10 350";
|
||||||
|
el("path", { d: stream, fill: "none", stroke: "#7fa3a6", "stroke-width": 13, "stroke-opacity": 0.65, "stroke-linecap": "round" }, sg);
|
||||||
|
el("path", { d: stream, fill: "none", stroke: "#cfe1dc", "stroke-width": 3, "stroke-opacity": 0.6, "stroke-linecap": "round" }, sg);
|
||||||
|
// rock outcrop for the valley Red, standing stones by the meadow
|
||||||
|
const rk = el("g", { filter: "url(#vm-wash2)" }, svg);
|
||||||
|
el("path", { d: "M800 272 L826 236 L862 230 L892 262 L880 284 L812 288 Z", fill: "#6e5c63", "fill-opacity": 0.75 }, rk);
|
||||||
|
el("path", { d: "M826 236 L862 230 L870 246 L834 252 Z", fill: "#9b8790", "fill-opacity": 0.6 }, rk);
|
||||||
|
// the tallest tree and the redwood
|
||||||
|
const big = el("g", { filter: "url(#vm-wash2)" }, svg);
|
||||||
|
el("rect", { x: 312, y: 150, width: 9, height: 70, fill: "#5a3f28", "fill-opacity": 0.85 }, big);
|
||||||
|
[[316, 150, 30], [302, 172, 22], [332, 168, 22], [316, 124, 22]].forEach(([x, y, r]) => el("circle", { cx: x, cy: y, r, fill: "#46502e", "fill-opacity": 0.75 }, big));
|
||||||
|
el("rect", { x: 446, y: 40, width: 11, height: 56, fill: "#8a4430", "fill-opacity": 0.85 }, big);
|
||||||
|
[[452, 40, 20], [440, 54, 14], [464, 54, 14]].forEach(([x, y, r]) => el("circle", { cx: x, cy: y, r, fill: "#3f4a2b", "fill-opacity": 0.7 }, big));
|
||||||
|
}
|
||||||
|
function overlay(svg) {
|
||||||
|
el("rect", { x: 0, y: 0, width: 1000, height: 780, filter: "url(#vm-paper)", opacity: 0.45, style: "mix-blend-mode:multiply", "pointer-events": "none" }, svg);
|
||||||
|
el("rect", { x: 0, y: 0, width: 1000, height: 780, fill: "url(#vm-vignette)", "pointer-events": "none" }, svg);
|
||||||
|
}
|
||||||
|
// tiny original winged glyph for dragon places
|
||||||
|
const WING = "M50 30 L18 6 L27 21 L3 16 L25 32 Z M50 30 L82 6 L73 21 L97 16 L75 32 Z M37 30 Q50 23 63 30 Q50 37 37 30 Z M63 30 L76 26 L80 28 L73 31 Z M37 30 Q24 37 10 34 Q22 33 36 31 Z";
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ rendering
|
||||||
|
function curve(A, B, bend) {
|
||||||
|
const mx = (A.x + B.x) / 2, my = (A.y + B.y) / 2, dx = B.x - A.x, dy = B.y - A.y;
|
||||||
|
return `M${A.x} ${A.y} Q${mx - dy * bend} ${my + dx * bend} ${B.x} ${B.y}`;
|
||||||
|
}
|
||||||
|
function name(id) {
|
||||||
|
const P = L[id];
|
||||||
|
if (!P) return id;
|
||||||
|
if (P.first) { const [, d, c] = id.split(":"); return `${c} dragon (first sighting, ${d === "Center" ? "forest centre" : d.toLowerCase()})`; }
|
||||||
|
return P.name;
|
||||||
|
}
|
||||||
|
const paintBase = (svg) => { defs(svg); paint(svg); };
|
||||||
|
window.ValleyMap = { places: L, paintBase, finish: overlay, name, curve, INK, PAPER, WING };
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user