From 73a6f5d355b2ad970348ff02cc1d08bab56b139e Mon Sep 17 00:00:00 2001 From: ekcSchiano Date: Mon, 16 Nov 2026 18:22:21 +0000 Subject: [PATCH] Site repairs: first-attempt Black, shadow evidence, author's statements - analysis/black/evidence.py also writes data/public/black.json (--check covers both) - Odds: the Black card shows first-attempt odds; new "The Black is not dice" panel from black.json - "Earlier choices barely change who waits" card replaced by the first-attempt finding - Journey eyebrow and bonding step no longer call the rolls pure luck - Footer, lore line and Reddit post: the author's statements (no roll worse than 1 in 20, the Black is not luck) replace the "10% chaos" claim - Report tab: the community Google Form first (no account needed), the Gitea form second; register listed as a source - register.js: snapshot label reads raw.source (was undefined) - build.js copies black.json, tree.json and experiments.json Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ --- analysis/black/evidence.py | 31 ++++++-- data/public/black.json | 147 +++++++++++++++++++++++++++++++++++++ site/atlas/app.js | 2 +- site/atlas/index.html | 20 ++--- site/atlas/register.js | 2 +- site/atlas/ui.js | 43 +++++++++-- site/build.js | 2 +- 7 files changed, 221 insertions(+), 26 deletions(-) create mode 100644 data/public/black.json diff --git a/analysis/black/evidence.py b/analysis/black/evidence.py index 604c154..ca2baea 100644 --- a/analysis/black/evidence.py +++ b/analysis/black/evidence.py @@ -20,6 +20,7 @@ sys.path.insert(0, str(ROOT / "core")) from atlas import runs as runs_io # noqa: E402 OUT = ROOT / "analysis/reports/BLACK.md" +OUT_JSON = ROOT / "data/public/black.json" # the same numbers, for the page ROUTE = ["company", "direction", "combat_first", "combat_second", "resolution", "post_path"] ROUTE_NAMES = "company, first direction, first move in the fight, the dagger, the bullies' fate, the fork" @@ -97,8 +98,10 @@ def blue_mistake(note): def build(): + """(the report as Markdown, its key numbers as a dict for the page).""" runs = runs_io.read() G = [r for r in runs if gated_tree(r)] + facts = {"schema": 1, "by_attempt": {}} L = ["# The Black dragon: what the runs show", "", "Written by `analysis/black/evidence.py` from `data/public/runs_clean.csv`. Counts only; nothing is fitted. " "\"Gated tree runs\" investigated the scream, helped the squadmate and climbed the tree, the two gates the " @@ -114,6 +117,7 @@ def build(): for g in ("form", "bulk logs", "bot"): rs = [r for r in G if group(r) == g and r["attempt"] and lo <= r["attempt"] <= hi] cells.append(frac(sum(bool(r["saw_shadow"]) for r in rs), len(rs))) + facts["by_attempt"].setdefault(g, {})[name] = [sum(bool(r["saw_shadow"]) for r in rs), len(rs)] L.append(f"| {name} | " + " | ".join(cells) + " |") cells = [] for g in ("form", "bulk logs", "bot"): @@ -136,6 +140,10 @@ def build(): c[i] += bool(r["saw_shadow"]) c[i + 1] += 1 orr, obs, exp, z = mantel_haenszel(by.values()) + facts["same_route"] = {"routes": len(by), "first_shadows": round(obs), "expected": round(exp, 1), + "odds_ratio": round(orr, 1), "z": round(z, 1)} + facts["form_first"] = [sum(c[0] for c in by.values()), sum(c[1] for c in by.values())] + facts["form_later"] = [sum(c[2] for c in by.values()), sum(c[3] for c in by.values())] L += ["## 2. The same route on a first attempt and on a later one", "", f"If the shadow depended only on the choices the form records ({ROUTE_NAMES}), a route would do as well on a " "later attempt as on a first. It does not.", "", @@ -151,6 +159,7 @@ def build(): # 3. is it decided by route + cadet assignment? best_key, best = max(((k, v) for k, v in by.items() if v[1] >= 20), key=lambda kv: kv[1][0] / kv[1][1]) + facts["best_route"] = {"route": list(best_key), "first": [best[0], best[1]], "later": [best[2], best[3]]} B = [r for r in F if r["attempt"] == 1 and tuple(r[k] for k in ROUTE) == best_key] cells = tally(B, lambda r: (r["wing"], r["section"], r["squad"])) multi = {k: v for k, v in cells.items() if v[1] >= 2} @@ -178,6 +187,7 @@ def build(): t = collections.Counter(r[col] for r in S1) L.append(f"- **{label}:** " + ", ".join(f"{k} {v}" for k, v in t.most_common())) outside = [r for r in runs if r["saw_shadow"] and not (r["scream"] == "Investigate & help" and r["hour"] == "Tree")] + facts["shadow_routes"] = {"runs": len(S1), "routes": len({tuple(r[k] for k in ROUTE) for r in S1}), "off_gate": len(outside)} L += ["", f"Shadows reported without both gates: {len(outside)} (likely mis-entered).", ""] # 5. after the shadow @@ -190,6 +200,9 @@ def build(): ans[a][0] += r["outcome"] == "Bonded" ans[a][1] += 1 blue_dead = [r for r in SH if r["enc_Blue"] == "Incinerated"] + facts["after_shadow"] = {"reached_black": len(black), "bonded_black": sum(r["outcome"] == "Bonded" for r in black), + "died_at_blue": len(blue_dead), + "answers": {k: [y, n] for k, (y, n) in sorted(ans.items(), key=lambda kv: -kv[1][1])}} mis = collections.Counter(blue_mistake((r["bond_note"] or "") + " " + (r["death_note"] or "")) for r in blue_dead) L += ["## 5. After the shadow: the Blue, then the Black", "", "The riders' notes describe one sequence: follow the shadow, a Blue lands and burns another cadet, the Blue " @@ -224,6 +237,9 @@ def build(): cur = cur + 1 if s is not None and s == prev else (1 if s is not None else 0) prev, streak = s, max(streak, cur) botg = [r for r in G if group(r) == "bot"] + facts["bot"] = {"attempts": len(seen), "accounts": len(acc), "gated_tree": len(botg), + "shadows": sum(bool(r["saw_shadow"]) for r in botg), + "earliest_attempt": min((min(v) for v in acc.values() if v), default=0)} routes = collections.Counter(tuple(r[k] for k in ROUTE) for r in botg) L += [f"{len(seen)} attempts on {len(acc)} accounts; the earliest attempt logged on any account is number " f"{min((min(v) for v in acc.values() if v), default=0)}. Gated tree runs: {len(botg)}, shadows " @@ -231,21 +247,24 @@ def build(): f"(the commonest {routes.most_common(1)[0][1] if routes else 0} times). The bot has not played a first attempt, " "so it has not yet tested the one situation where riders report the shadow. The most times any account has " f"repeated one route in a row is {streak}.", ""] - return "\n".join(L) + "\n" + return "\n".join(L) + "\n", facts def main(argv=None): ap = argparse.ArgumentParser(description=__doc__) ap.add_argument("--check", action="store_true") a = ap.parse_args(argv) - text = build() + text, facts = build() + data = json.dumps(facts, ensure_ascii=False, indent=1) + "\n" if a.check: - if not OUT.exists() or OUT.read_text(encoding="utf-8") != text: - print(f"{OUT} is out of date (run python analysis/black/evidence.py)", file=sys.stderr) - return 1 + for path, want in ((OUT, text), (OUT_JSON, data)): + if not path.exists() or path.read_text(encoding="utf-8") != want: + print(f"{path} is out of date (run python analysis/black/evidence.py)", file=sys.stderr) + return 1 return 0 OUT.write_text(text, encoding="utf-8") - print(f"wrote {OUT.relative_to(ROOT)}") + OUT_JSON.write_text(data, encoding="utf-8") + print(f"wrote {OUT.relative_to(ROOT)} and {OUT_JSON.relative_to(ROOT)}") return 0 diff --git a/data/public/black.json b/data/public/black.json new file mode 100644 index 0000000..ca390ba --- /dev/null +++ b/data/public/black.json @@ -0,0 +1,147 @@ +{ + "schema": 1, + "by_attempt": { + "form": { + "1": [ + 89, + 879 + ], + "2": [ + 0, + 288 + ], + "3": [ + 0, + 184 + ], + "4-10": [ + 0, + 506 + ], + "11-30": [ + 0, + 573 + ], + "31 or more": [ + 1, + 610 + ] + }, + "bulk logs": { + "1": [ + 0, + 28 + ], + "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, + 54 + ] + } + }, + "same_route": { + "routes": 321, + "first_shadows": 85, + "expected": 36.4, + "odds_ratio": 626.3, + "z": 11.9 + }, + "form_first": [ + 89, + 879 + ], + "form_later": [ + 1, + 2161 + ], + "best_route": { + "route": [ + "Alone", + "West", + "Assess the situation", + "Engage the smaller cadet", + "Squadmate's revenge", + "West" + ], + "first": [ + 22, + 88 + ], + "later": [ + 0, + 89 + ] + }, + "shadow_routes": { + "runs": 93, + "routes": 46, + "off_gate": 3 + }, + "after_shadow": { + "reached_black": 76, + "bonded_black": 55, + "died_at_blue": 15, + "answers": { + "held its gaze": [ + 30, + 42 + ], + "lowered eyes": [ + 0, + 7 + ], + "ignored the sound": [ + 0, + 1 + ] + } + }, + "bot": { + "attempts": 415, + "accounts": 14, + "gated_tree": 236, + "shadows": 0, + "earliest_attempt": 2 + } +} diff --git a/site/atlas/app.js b/site/atlas/app.js index b494c3c..5794df8 100644 --- a/site/atlas/app.js +++ b/site/atlas/app.js @@ -588,7 +588,7 @@ 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 author has said there's a ~10% chaos roll, so nothing is guaranteed.*`); + 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")); diff --git a/site/atlas/index.html b/site/atlas/index.html index 6ab0587..5d59a5e 100644 --- a/site/atlas/index.html +++ b/site/atlas/index.html @@ -461,11 +461,12 @@ a { color: var(--accent); text-underline-offset: 2px; }
- Seven steps, two of them pure luck + Seven steps, and the rolls remember what you did

How a run unfolds

-

In the books, first-years who survive to Threshing walk into a valley of unbonded dragons, and the dragons do the choosing. The Dragonkind site recreates that: every choice can end with you incinerated, and the author has said there is a 10% chance of that no matter what you pick.

+ +

In the books, first-years who survive to Threshing walk into a valley of unbonded dragons, and the dragons do the choosing. The Dragonkind 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.

@@ -691,22 +692,23 @@ adjusted OR = exp(βⱼ), 95% CI = exp(βⱼ ± 1.96·SEⱼ)
Every run helps

Report a run

Every run anyone logs ends up in the Atlas's open data, runs_clean.csv, 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.

-

Report it on the Atlas

-

A short form with the game's own choices: an issue on the Atlas's repository at {{host}}, so you need an account there. Reports show up in the data the next day with the source reported. Everyone who can see the repository can read reports: please leave out your account name.

-

Report a run

-
-

Or use the community form

-

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 reddit spreadsheet), so a run logged there is counted here too.

+

Use the community form

+

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 reddit spreadsheet), so a run logged there is counted here.

Threshing Routes form The responses spreadsheet The megathread

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.

+

Or report it on the Atlas

+

A short form with the game's own choices: an issue on the Atlas's repository at {{host}}, so you need an account there. Reports show up in the data the next day with the source reported. Everyone who can see the repository can read reports: please leave out your account name.

+

Report a run on {{host}}

+

Where the Atlas's runs come from

+ @@ -718,7 +720,7 @@ adjusted OR = exp(βⱼ), 95% CI = exp(βⱼ ± 1.96·SEⱼ) +

Unofficial fan analysis, not affiliated with Dragonkind or its authors. The 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.

diff --git a/site/atlas/register.js b/site/atlas/register.js index df4b34c..1cce2b9 100644 --- a/site/atlas/register.js +++ b/site/atlas/register.js @@ -197,7 +197,7 @@ } 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_file}, exported ${raw.exported})`); }) + 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.")); } diff --git a/site/atlas/ui.js b/site/atlas/ui.js index b933f6e..e1db45e 100644 --- a/site/atlas/ui.js +++ b/site/atlas/ui.js @@ -150,25 +150,52 @@ 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" }; + 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 = '

Your first attempt is different

The shadow evidence could not be loaded.

'; 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 = `

Your first attempt is different

Among riders who helped their squadmate and climbed the tree, the shadow came in ${frac(ff)} first attempts (${pct(ff[0] / ff[1], 1)}) and ${frac(fl)} 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.

`; + if (!box) return; + const br = b.best_route; + box.hidden = false; + box.innerHTML = `

The Black is not dice

+

The game's author has said the Black is not luck, and the runs agree. The shadow at the tree needs three things: you investigated and helped your squadmate, you climbed the tree, and it is (almost always) your first attempt. ${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.

+
    +
  • Best-logged route (${esc(br.route.join(" → "))}): shadow in ${frac(br.first)} first attempts, ${frac(br.later)} later ones.
  • +
  • After the shadow, ${as.reached_black} riders reached the Black and ${as.bonded_black} bonded it; ${as.died_at_blue} were burned by the Blue first.
  • + ${gaze ? `
  • At the Black, riders who held its gaze bonded in ${frac(gaze)} logged answers.
  • ` : ""} +
  • 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.
  • +
+

Method and every table: analysis/reports/BLACK.md; the numbers: data/black.json.

`; + } + function renderColourOdds(policy) { if (!policy) { $("#odds-colours").innerHTML = '

The route model could not be loaded.

'; return; } const lb = policy.samples.lowBias, all = policy.samples.all; const cols = ["Red", "Green", "Orange", "Brown", "Blue", "Black"] - .map((c) => ({ c, p: lb.targets[c].eventually.pX.mean, pAll: all.targets[c].eventually.pX.mean, lo: lb.targets[c].eventually.pX.lo, hi: lb.targets[c].eventually.pX.hi })) + .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 ? `` : ""; - $("#odds-colours").innerHTML = cols.map(({ c, p, pAll, lo, hi }) => { + $("#odds-colours").innerHTML = cols.map(({ c, first, p, pAll, lo, hi }) => { const e = enc(c); return `${art(c)} - ${p >= 0.5 ? pct(p) : `1 in ${oneIn(p)}`}${p >= 0.5 ? "of runs" : "runs"} end bonded to ${/^[AEIOU]/.test(c) ? "an" : "a"} ${c}, on the best route + ${p >= 0.5 ? pct(p) : `1 in ${oneIn(p)}`}${p >= 0.5 ? "of runs" : "runs"} end bonded to ${/^[AEIOU]/.test(c) ? "an" : "a"} ${c}, on the best route${first ? ", on your first attempt" : ""} ${dots(Math.round(p * 1000), 1000, cssVar(DV[c]))} - ${pct(p, p < 0.1 ? 1 : 0)} per attempt (95% ${pct(lo, 1)}–${pct(hi, 1)}), from riders who logged every run${Math.abs(pAll - p) / p > 0.25 ? `; all form posts suggest ${pct(pAll, 1)}` : ""}. At ${ENC_LABEL[ENC_OF[c]]}, ${e.k} of ${e.n} genuine attempts bonded. + ${pct(p, p < 0.1 ? 1 : 0)} ${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]]}, ${e.k} of ${e.n} genuine attempts bonded. See the route →`; }).join(""); - const meadowAlpha = all.model.alphas.meadow, shadowAlpha = all.model.alphas.shadow; - const t2 = $("#truth-history"); - if (t2) t2.innerHTML = `

Earlier choices barely change who waits

${meadowAlpha >= 10000 ? "Which dragon waits in the meadow shows no link to anything you chose before." : "Which dragon waits in the meadow depends only a little on earlier choices."} ${shadowAlpha >= 500 ? "The shadow at the tree depends on them only weakly." : "The shadow at the tree shows some dependence on earlier choices, but the evidence is thin."} The model lets every roll depend on your history, and measured how much it does. Choices the form doesn't record (what you answered inside an encounter) might still matter.

`; + 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); @@ -207,7 +234,7 @@ { 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 is partly luck. Then every answer is a test.", v: greens.green_encounters ? `At the two Greens, ${pct((greens.rescued_orange + greens.rescued_brown) / greens.green_encounters)} were rescued by an Orange or Brown.` : "", roll: true }, + { 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) => `
${["I", "II", "III", "IV", "V", "VI", "VII"][i]}${esc(s.t)}${esc(s.d)}${s.v ? `${esc(s.v)}` : ""}
`).join(""); diff --git a/site/build.js b/site/build.js index cdfaaa8..2518af2 100644 --- a/site/build.js +++ b/site/build.js @@ -27,7 +27,7 @@ for (const f of fs.readdirSync(path.join(root, "site/atlas"))) copy(`site/atlas/ copy("core/graph.js", "graph.js"); copy("core/solver.js", "solver.js"); // The numbers the page shows (all computed in Python) and the published data -for (const f of ["stats.json", "register.json", "graph.json", "policy.json"]) copy(`data/public/${f}`, `data/${f}`); +for (const f of ["stats.json", "register.json", "graph.json", "policy.json", "black.json", "tree.json", "experiments.json"]) copy(`data/public/${f}`, `data/${f}`); copy("data/public/runs_clean.csv", "data/runs_clean.csv"); for (const f of ["croissant.json", "dictionary.yaml"]) copy(`data/${f}`, `data/${f}`); // Source files shown in the page's "view the code" panel -- 2.54.0
SourceWhat it is
reddit spreadsheetThe community form and spreadsheet linked from the r/fourthwing megathreads.
reportedRuns reported here, with "Report a run".
registerThe Unofficial Dragon Register: which dragon each rider bonded (no route).
reddit threadDragonkind result pages posted in the megathreads (the dragon is known, the route is not).
botRuns logged by the DragonKind bot.
reddit pdfThe community route PDF: a map of the choices, used to check the game's routes (it holds no runs).