Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
986cdd9c0a | ||
|
|
70d0542ce8 | ||
|
|
57839fcc87 | ||
|
|
7ef8a58a0e | ||
|
|
27ba5fbcbc | ||
|
|
8152c1da0a | ||
|
|
40f068abe5 | ||
|
|
ef14ecaaa5 | ||
|
|
6467ce86a7 | ||
|
|
a9836c3191 |
@@ -10,7 +10,7 @@ Written by `analysis/black/evidence.py` from `data/public/runs_clean.csv`. Count
|
||||
| 2 | 0 / 296 (0.0%) | 0 / 21 (0.0%) | 0 / 4 (0.0%) |
|
||||
| 3 | 0 / 193 (0.0%) | 0 / 14 (0.0%) | 0 / 5 (0.0%) |
|
||||
| 4-10 | 0 / 538 (0.0%) | 0 / 102 (0.0%) | 0 / 36 (0.0%) |
|
||||
| 11-30 | 0 / 626 (0.0%) | 0 / 57 (0.0%) | 0 / 137 (0.0%) |
|
||||
| 11-30 | 0 / 627 (0.0%) | 0 / 57 (0.0%) | 0 / 137 (0.0%) |
|
||||
| 31 or more | 0 / 694 (0.0%) | 0 / 0 | 0 / 333 (0.0%) |
|
||||
| not given | 0 / 1581 (0.0%) | 0 / 149 (0.0%) | 0 / 0 |
|
||||
|
||||
|
||||
@@ -88,3 +88,17 @@ presets:
|
||||
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]
|
||||
|
||||
@@ -399,7 +399,7 @@ def place_path(r):
|
||||
s.append("bully")
|
||||
if "res:" + r["resolution"] in L:
|
||||
s.append("res:" + r["resolution"])
|
||||
if r["resolution"].startswith("DIED"):
|
||||
if (r.get("resolution") or "").startswith("DIED"):
|
||||
return s
|
||||
if r.get("post_path") in ("Forest", "West", "East"):
|
||||
s.append("fork:" + r["post_path"])
|
||||
@@ -452,17 +452,51 @@ def valley(runs):
|
||||
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")]
|
||||
|
||||
def deliberate(r):
|
||||
if r["outcome"] != "Incinerated":
|
||||
return False
|
||||
v = model.prepare_run(r)
|
||||
return bool(v.get("encCtx")) and not model.genuine_attempt(r, v["encCtx"])
|
||||
|
||||
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),
|
||||
@@ -483,7 +517,7 @@ def clean(o):
|
||||
return o
|
||||
|
||||
|
||||
def build(runs, rows, exported=None):
|
||||
def build(runs, rows, exported=None, every_run=None):
|
||||
global PLACES
|
||||
PLACES = place_ids()
|
||||
th = M["route_thresholds"]
|
||||
@@ -506,6 +540,8 @@ def build(runs, rows, exported=None):
|
||||
"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)
|
||||
|
||||
|
||||
@@ -515,7 +551,7 @@ def main(argv=None):
|
||||
ap.add_argument("--out", default=str(ROOT / "data/public/stats.json"))
|
||||
a = ap.parse_args(argv)
|
||||
runs = runs_io.read(a.data, sources=M["sources"])
|
||||
out = build(runs, len(runs), exported())
|
||||
out = build(runs, len(runs), exported(), every_run=runs_io.read(a.data))
|
||||
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")
|
||||
|
||||
|
||||
+12
-12
@@ -93,8 +93,8 @@
|
||||
"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": "c5b7302bee16c063a400548e8bdf95256df50acbc00f2c6e9813eed7f50c42d4",
|
||||
"contentSize": "3680593 B"
|
||||
"sha256": "ce944619f3a8ca03e67e05438a630d632d6dbe10c13e557e9fcc2fa897cdc932",
|
||||
"contentSize": "3685124 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
@@ -103,8 +103,8 @@
|
||||
"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": "319f6217e0a431454114a67276f429379ec383cd6ed2666443b48b8f48c66490",
|
||||
"contentSize": "12623695 B"
|
||||
"sha256": "3a3322da84274416880d87a400b06e44e0ed97feaf93df839b5269bdaa1badad",
|
||||
"contentSize": "12640700 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
@@ -123,8 +123,8 @@
|
||||
"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": "d42eb04b9923eb1d2a8e5c356452f52daab78293be5a29a448cfb69c974eab30",
|
||||
"contentSize": "92 B"
|
||||
"sha256": "51510ed7a0b4016501fe4e0324a352842e831a48773a08b084dec6ff7dde2d14",
|
||||
"contentSize": "112 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
@@ -143,8 +143,8 @@
|
||||
"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": "75ed4be2199b2192e904ce7697892eed01abfefc4e897cd3fbeaf0c7ed4c637c",
|
||||
"contentSize": "5461481 B"
|
||||
"sha256": "d2a551e785c8593b442d95338a99ea0710ed7df2cd6c6f3ef341bddff1f3689e",
|
||||
"contentSize": "5475502 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
@@ -153,8 +153,8 @@
|
||||
"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": "8360beabea06d77117ddd10741c4e004cf361f8bd3d6377286bb053d2ba6e1b0",
|
||||
"contentSize": "986194 B"
|
||||
"sha256": "ef607b9a7fbc7f7d0e647f988fbac94a1685109a78218ce8c6f0ada3e62e2ee4",
|
||||
"contentSize": "986552 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
@@ -163,8 +163,8 @@
|
||||
"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": "f4d4d02d5ce0d57de2c706a84874133aab9b5c915c59aeef9760b3141b3044e0",
|
||||
"contentSize": "75584 B"
|
||||
"sha256": "112895b711ade4e0aad8e4b7a61dea5db00f4734e484bc20198740e924c14974",
|
||||
"contentSize": "75580 B"
|
||||
}
|
||||
],
|
||||
"recordSet": [
|
||||
|
||||
+6
-6
@@ -10,18 +10,18 @@
|
||||
"changed": "2026-11-16"
|
||||
},
|
||||
"reddit_spreadsheet": {
|
||||
"sha256": "e3cccdbdf8ce67d7ea8e85156ccd5b5f5e404ab6cd195ee8883ea140249d16a6",
|
||||
"bytes": 5949959,
|
||||
"sha256": "ca06bbb6914483214801b54b58ed08039c21dc858c59347456ea473b1417fbb4",
|
||||
"bytes": 5941127,
|
||||
"changed": "2026-11-19"
|
||||
},
|
||||
"register": {
|
||||
"sha256": "ea9807f6d2391ecce7425888b913d4b618ac85463a459e3908abf1233c888f19",
|
||||
"sha256": "d6e5085f73adbf047163578c150dd034e2387fe37bd91030b36592df46147261",
|
||||
"bytes": 51331,
|
||||
"changed": "2026-11-19"
|
||||
},
|
||||
"reported": {
|
||||
"sha256": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
|
||||
"bytes": 2,
|
||||
"changed": "2026-11-04"
|
||||
"sha256": "8c8721b9c698e155c406da97fb69dda1729a9546290773dc0a044b1cd7eae628",
|
||||
"bytes": 27492,
|
||||
"changed": "2026-11-19"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
],
|
||||
"11-30": [
|
||||
0,
|
||||
626
|
||||
627
|
||||
],
|
||||
"31 or more": [
|
||||
0,
|
||||
@@ -93,7 +93,7 @@
|
||||
],
|
||||
"form_later": [
|
||||
0,
|
||||
2347
|
||||
2348
|
||||
],
|
||||
"best_route": {
|
||||
"route": [
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"source":"Runs reported on the Atlas (\"Report a run\", a GitHub issue form)","reports":[]}
|
||||
{"source":"Runs reported on the Atlas (\"Report a run\", an issue form on the Atlas's repository)","reports":[]}
|
||||
+2375
-2361
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+35
-98
File diff suppressed because one or more lines are too long
+68
-13
@@ -9,7 +9,9 @@
|
||||
* 3 click a choice point on the highlighted route: its other options branch off, each with the chance it gives.
|
||||
* Picking one re-plans the route from there.
|
||||
* 4 "Why this route?" in the side panel: intervals, how often the choice stays best, low-bias numbers, risks.
|
||||
* A toggle adds the community's actual traffic underneath. The URL keeps the selection (#valley/blue/meadow-Blue).
|
||||
* "Show the paths of all riders" adds, underneath, the paths every source logged (one layer each: the sheet's form
|
||||
* posts and bulk logs, runs reported here, the bot, Discord) and the deaths (deliberate and failed), each layer with
|
||||
* its own switch; the counts come from data/stats.json `paths` (analysis/stats/site_stats.py). The URL keeps the selection (#valley/blue/meadow-Blue).
|
||||
*/
|
||||
(function () {
|
||||
"use strict";
|
||||
@@ -39,15 +41,15 @@
|
||||
};
|
||||
const RESCUE = { Orange: "tree-Greens", Brown: "tree-Greens" };
|
||||
const SPOTS = [
|
||||
{ place: "treeRed", enc: "tree-Red", colour: "Red", pose: "prowling", flip: true, sc: 0.36 },
|
||||
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "resting", sc: 0.3, dx: -16 },
|
||||
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "sitting", flip: true, sc: 0.27, dx: 20, dy: -4, twin: true },
|
||||
{ place: "black", enc: "shadow-Black", colour: "Black", pose: "flying", flip: true, sc: 0.38 },
|
||||
{ place: "treeRed", enc: "tree-Red", colour: "Red", pose: "roaring", flip: true, sc: 0.36 },
|
||||
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "prowling", sc: 0.3, dx: -16 },
|
||||
{ place: "greens", enc: "tree-Greens", colour: "Green", pose: "prowling", flip: true, sc: 0.27, dx: 20, dy: -4, twin: true },
|
||||
{ place: "black", enc: "shadow-Black", colour: "Black", pose: "resting", flip: true, sc: 0.38 },
|
||||
{ place: "redwood", enc: "shadow-Blue", colour: "Blue", pose: "coiled", sc: 0.3 },
|
||||
{ place: "valleyRed", enc: "valley-Red", colour: "Red", pose: "roaring", sc: 0.36, dy: -12 },
|
||||
{ place: "meadow:Orange", enc: "meadow-Orange", colour: "Orange", pose: "sitting", flip: true, sc: 0.3 },
|
||||
{ place: "meadow:Brown", enc: "meadow-Brown", colour: "Brown", pose: "resting", sc: 0.32 },
|
||||
{ place: "meadow:Blue", enc: "meadow-Blue", colour: "Blue", pose: "sitting", sc: 0.32 },
|
||||
{ place: "meadow:Orange", enc: "meadow-Orange", colour: "Orange", pose: "flying", flip: true, sc: 0.3 },
|
||||
{ place: "meadow:Brown", enc: "meadow-Brown", colour: "Brown", pose: "sitting", sc: 0.32 },
|
||||
{ place: "meadow:Blue", enc: "meadow-Blue", colour: "Blue", pose: "coiled", sc: 0.32 },
|
||||
];
|
||||
const FIRST_POSE = { Red: "roaring", Brown: "sitting", Green: "prowling", Orange: "flying" };
|
||||
Object.keys(L).filter((k) => k.startsWith("see:")).forEach((k) => {
|
||||
@@ -85,7 +87,7 @@
|
||||
const st = {
|
||||
point: null, // a place picked before any dragon: show the best way from there to every dragon
|
||||
policy: null, runs: null, counts: {}, colour: null, focus: null, expanded: null, over: {},
|
||||
objective: "eventually", sample: "all", traffic: false, cache: new Map(), pendingHash: null, info: null,
|
||||
objective: "eventually", sample: "all", traffic: false, layers: {}, paths: null, cache: new Map(), pendingHash: null, info: null,
|
||||
};
|
||||
const model = () => st.policy.samples[st.sample];
|
||||
function advisorFor(enc, colour = st.colour) {
|
||||
@@ -432,8 +434,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
// "Show the paths of all riders": one ink per source layer (data/stats.json paths.layers; measures.yaml path_layers),
|
||||
// and one line style per way the runs ended
|
||||
const LAYER_INK = { sheet: "#6b4a33", reported: "#7a4f8f", reddit: "#a8792a", bot: "#28588a", discord: "#5865f2" };
|
||||
const KIND = {
|
||||
lived: { dash: null, cap: "round", label: "survived" },
|
||||
chose: { dash: "11 6", cap: "butt", label: "chose to die" },
|
||||
failed: { dash: "0.1 6", cap: "round", label: "died (failed run)" },
|
||||
};
|
||||
const layerOn = (k) => st.layers[k] !== false; // every layer starts on
|
||||
|
||||
function drawTraffic(g) {
|
||||
// how many logged runs went from each place to the next (precomputed in data/stats.json)
|
||||
if (st.paths && st.paths.layers) return drawLayers(g, st.paths.layers);
|
||||
// older stats.json: how many logged runs went from each place to the next (precomputed in data/stats.json)
|
||||
if (!st.edges) return;
|
||||
const max = Math.max(1, ...st.edges.map((e) => e[2]));
|
||||
st.edges.forEach(([a, b, n]) => {
|
||||
@@ -442,6 +455,35 @@
|
||||
});
|
||||
}
|
||||
|
||||
/** Every source layer that is switched on, side by side in its own ink: solid for runs that survived, dashed for
|
||||
* deliberate deaths, dotted for failed runs, and a mark where the deaths happened. */
|
||||
function drawLayers(g, layers) {
|
||||
const shown = layers.filter((l) => l.runs && layerOn(l.key) && l.lines);
|
||||
const all = shown.flatMap((l) => Object.values(l.lines).flatMap((es) => es.map((e) => e[2])));
|
||||
const max = Math.max(1, ...all);
|
||||
shown.forEach((l, i) => {
|
||||
const base = (i - (shown.length - 1) / 2) * 9, ink = LAYER_INK[l.key] || "#6b4a33";
|
||||
["lived", "chose", "failed"].forEach((k, j) => {
|
||||
const off = base + (j - 1) * 3, kd = KIND[k];
|
||||
(l.lines[k] || []).forEach(([a, b, n]) => {
|
||||
if (!L[a] || !L[b]) return;
|
||||
const w = 1.2 + 14 * Math.sqrt(n / max);
|
||||
el("path", { d: curve(L[a], L[b], 0.05, off), fill: "none", stroke: ink, "stroke-opacity": k === "lived" ? 0.36 : 0.6,
|
||||
"stroke-width": k === "failed" ? Math.max(2.2, w) : w, "stroke-linecap": kd.cap, "stroke-dasharray": kd.dash }, g);
|
||||
});
|
||||
});
|
||||
// where the deaths happened: one mark per place, sized by the deaths there
|
||||
const ends = {};
|
||||
["chose", "failed"].forEach((k) => Object.entries((l.ends || {})[k] || {}).forEach(([p, n]) => (ends[p] = (ends[p] || 0) + n)));
|
||||
const emax = Math.max(1, ...Object.values(ends));
|
||||
Object.entries(ends).forEach(([p, n]) => {
|
||||
if (!L[p]) return;
|
||||
const r = 2.5 + 9 * Math.sqrt(n / emax), x = L[p].x + base, y = L[p].y;
|
||||
el("path", { d: `M${x - r * 0.6},${y - r * 0.6}L${x + r * 0.6},${y + r * 0.6}M${x + r * 0.6},${y - r * 0.6}L${x - r * 0.6},${y + r * 0.6}`, stroke: ink, "stroke-width": 2, "stroke-opacity": 0.8 }, g);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function drawRoutes(gRoute, gLab, routes) {
|
||||
const best = Math.max(1e-12, ...routes.map((r) => r.value.x));
|
||||
const onRoute = new Set();
|
||||
@@ -633,8 +675,19 @@
|
||||
|
||||
/* ---------- panel ---------- */
|
||||
const mini = (c, pose = "sitting") => `<svg viewBox="0 0 200 160" aria-hidden="true">${D.svg(pose, { fill: `var(${DV[c]})`, eyeFill: "var(--bg)" })}</svg>`;
|
||||
const POSE_OF = { Red: "roaring", Orange: "flying", Brown: "resting", Green: "prowling", Blue: "coiled", Black: "flying" };
|
||||
const trafficToggle = () => `<label class="ex-toggle"><input type="checkbox" id="ex-traffic"${st.traffic ? " checked" : ""}> Show where riders actually went</label>`;
|
||||
const POSE_OF = { Red: "roaring", Orange: "flying", Brown: "sitting", Green: "prowling", Blue: "coiled", Black: "resting" };
|
||||
const UNROUTED = { "reddit thread": "Reddit result pages", register: "the Dragon Register" };
|
||||
function trafficToggle() {
|
||||
const box = `<label class="ex-toggle"><input type="checkbox" id="ex-traffic"${st.traffic ? " checked" : ""}> Show the paths of all riders</label>`;
|
||||
if (!st.traffic || !st.paths || !st.paths.layers || !st.paths.layers.some((l) => l.lines)) return box;
|
||||
const rows = st.paths.layers.map((l) => `<label class="ex-layer${l.runs ? "" : " none"}"><input type="checkbox" data-layer="${esc(l.key)}"${l.runs && layerOn(l.key) ? " checked" : ""}${l.runs ? "" : " disabled"}>
|
||||
<span class="sw" style="--sw: ${LAYER_INK[l.key] || "#6b4a33"}"></span><span>${esc(l.label)}</span><span class="n">${l.runs ? l.runs.toLocaleString() : "none yet"}</span></label>`).join("");
|
||||
const key = Object.values(KIND).map((kd) => `<span class="ex-kind"><svg viewBox="0 0 34 8" aria-hidden="true"><path d="M3 4H31" stroke="currentColor" stroke-width="2.6" stroke-linecap="${kd.cap}"${kd.dash ? ` stroke-dasharray="${kd.dash === "11 6" ? "8 4" : "0.1 5"}"` : ""}/></svg>${kd.label}</span>`).join("");
|
||||
const un = Object.entries(st.paths.unrouted || {}).filter(([, n]) => n).map(([s, n]) => `${n.toLocaleString()} from ${esc(UNROUTED[s] || s)}`);
|
||||
return `${box}<div class="ex-layers" role="group" aria-label="Which riders' paths to show">${rows}
|
||||
<div class="ex-kinds">${key}</div>
|
||||
<p class="small muted">Each source in its own colour; line width is how many runs took each step, and ✕ marks where runs died.${un.length ? ` Not drawn (they record the dragon, not the route): ${un.join(", ")}.` : ""}</p></div>`;
|
||||
}
|
||||
function chooser() {
|
||||
return `<div class="ex-choose">${COLOURS.map((c) => `<button type="button" class="ex-dchip" data-c="${c}" aria-pressed="${st.colour === c}" style="--c: var(${DV[c]})">${mini(c, POSE_OF[c])}<span>${c}</span></button>`).join("")}</div>`;
|
||||
}
|
||||
@@ -735,6 +788,7 @@
|
||||
$$("[data-o]", p).forEach((b) => b.addEventListener("click", () => { st.objective = b.dataset.o; render(); }));
|
||||
$$("[data-s]", p).forEach((b) => b.addEventListener("click", () => { st.sample = b.dataset.s; render(); }));
|
||||
const tr = $("#ex-traffic", p); if (tr) tr.addEventListener("change", () => { st.traffic = tr.checked; render(); });
|
||||
$$("[data-layer]", p).forEach((b) => b.addEventListener("change", () => { st.layers[b.dataset.layer] = b.checked; render(); }));
|
||||
const cl = $("#ex-clear", p); if (cl) cl.addEventListener("click", () => select(null));
|
||||
$$("[data-pt]", p).forEach((b) => b.addEventListener("click", () => { st.point = b.dataset.pt; writeHash(); render(); }));
|
||||
const cp = $("#ex-clear-point", p); if (cp) cp.addEventListener("click", () => { st.point = null; writeHash(); render(); });
|
||||
@@ -846,7 +900,8 @@
|
||||
}
|
||||
|
||||
/** The runs selected on the page (one preset of data/stats.json): how many reached each place, and each step. */
|
||||
function setStats(P) {
|
||||
function setStats(P, paths) {
|
||||
if (paths) st.paths = paths;
|
||||
st.nRuns = P.analyse.n;
|
||||
st.counts = P.valley.counts;
|
||||
st.edges = P.valley.edges;
|
||||
|
||||
@@ -338,6 +338,14 @@ footer { border-top-color: var(--line); }
|
||||
.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-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); }
|
||||
|
||||
+2
-2
@@ -148,7 +148,7 @@
|
||||
const getPolicy = () => policyP || (policyP = fetch("data/policy.json").then((r) => r.json()).catch(() => null));
|
||||
const ENC_OF = { Red: "valley-Red", Orange: "meadow-Orange", Brown: "meadow-Brown", Green: "tree-Greens", Blue: "meadow-Blue", Black: "shadow-Black" };
|
||||
const ENC_LABEL = { "valley-Red": "the valley Red", "meadow-Orange": "the meadow Orange", "meadow-Brown": "the meadow Brown", "tree-Greens": "the two Greens", "meadow-Blue": "the meadow Blue", "shadow-Black": "the Black after the shadow" };
|
||||
const POSE = { Red: "roaring", Orange: "flying", Brown: "resting", Green: "prowling", Blue: "coiled", Black: "flying" };
|
||||
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));
|
||||
@@ -260,7 +260,7 @@
|
||||
window.AtlasUI = {
|
||||
render(state) {
|
||||
renderOverview(state);
|
||||
if (window.ValleyExplorer) window.ValleyExplorer.setStats(state.P);
|
||||
if (window.ValleyExplorer) window.ValleyExplorer.setStats(state.P, state.stats && state.stats.paths);
|
||||
},
|
||||
showTab,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user