diff --git a/analysis/black/evidence.py b/analysis/black/evidence.py index da6a38a..13b1126 100644 --- a/analysis/black/evidence.py +++ b/analysis/black/evidence.py @@ -141,7 +141,8 @@ def build(): 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)} + "odds_ratio": round(orr, 1) if math.isfinite(orr) else None, # JSON has no Infinity + "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", "", @@ -153,7 +154,7 @@ def build(): L.append(f"| {' / '.join(key)} | {frac(y1, n1)} | {frac(y0, n0)} |") L += ["", f"Across all {len(by)} recorded routes, comparing first and later attempts on the same route: " f"{obs:.0f} first-attempt shadows where {exp:.1f} would be expected if the attempt did not matter " - f"(odds ratio {orr:.1f}, z = {z:.1f}). First and later attempts choose almost the same routes, so the " + f"(odds ratio {f'{orr:.1f}' if math.isfinite(orr) else 'unbounded: no later-attempt shadow at all'}, z = {z:.1f}). First and later attempts choose almost the same routes, so the " "difference is not in the recorded choices: it is something about the account, or a choice the form does " "not record.", ""] @@ -266,7 +267,7 @@ def main(argv=None): ap.add_argument("--check", action="store_true") a = ap.parse_args(argv) text, facts = build() - data = json.dumps(facts, ensure_ascii=False, indent=1) + "\n" + data = json.dumps(facts, ensure_ascii=False, indent=1, allow_nan=False) + "\n" if a.check: for path, want in ((OUT, text), (OUT_JSON, data)): if not path.exists() or path.read_text(encoding="utf-8") != want: diff --git a/analysis/reports/BLACK.md b/analysis/reports/BLACK.md index e90d2a6..9f5427a 100644 --- a/analysis/reports/BLACK.md +++ b/analysis/reports/BLACK.md @@ -31,7 +31,7 @@ If the shadow depended only on the choices the form records (company, first dire | Alone / Center / Assess the situation / Daggers or not (protect squadmate) / Left bullies to the dragons / Forest | 1 / 28 (3.6%) | 0 / 64 (0.0%) | | Alone / Center / Assess the situation / Engage the smaller cadet / Squadmate's revenge / West | 2 / 9 (22.2%) | 0 / 81 (0.0%) | -Across all 326 recorded routes, comparing first and later attempts on the same route: 93 first-attempt shadows where 38.8 would be expected if the attempt did not matter (odds ratio inf, z = 12.5). First and later attempts choose almost the same routes, so the difference is not in the recorded choices: it is something about the account, or a choice the form does not record. +Across all 326 recorded routes, comparing first and later attempts on the same route: 93 first-attempt shadows where 38.8 would be expected if the attempt did not matter (odds ratio unbounded: no later-attempt shadow at all, z = 12.5). First and later attempts choose almost the same routes, so the difference is not in the recorded choices: it is something about the account, or a choice the form does not record. ## 3. On one route, is the shadow decided by the cadet's wing, section and squad? diff --git a/data/public/black.json b/data/public/black.json index 9043012..76ccf8c 100644 --- a/data/public/black.json +++ b/data/public/black.json @@ -84,7 +84,7 @@ "routes": 326, "first_shadows": 93, "expected": 38.8, - "odds_ratio": Infinity, + "odds_ratio": null, "z": 12.5 }, "form_first": [ diff --git a/site/atlas/explorer.js b/site/atlas/explorer.js index 2938c7a..07d58ce 100644 --- a/site/atlas/explorer.js +++ b/site/atlas/explorer.js @@ -92,7 +92,8 @@ const model = () => st.policy.samples[st.sample]; function advisorFor(enc, colour = st.colour) { const k = `${st.sample}|${colour}|${st.objective}|${enc}`; - if (!st.cache.has(k)) st.cache.set(k, S.advisor(model(), colour, st.objective, { only: [enc] })); + // the Black needs the shadow, which (almost) only shows on a first attempt: its routes are solved for that attempt + if (!st.cache.has(k)) st.cache.set(k, S.advisor(model(), colour, st.objective, { only: [enc], attempt: colour === "Black" ? "First attempt" : null })); return st.cache.get(k); } let encParams = null; @@ -530,7 +531,7 @@ }); // destination label const end = pts[pts.length - 1]; - pill(gLab, end.P.x, end.P.y + 30, `${pct(r.value.x)} per attempt`, { edge: tc, strong: rel === 1 }); + pill(gLab, end.P.x, end.P.y + 30, `${pct(r.value.x)} ${st.colour === "Black" ? "on a first attempt" : "per attempt"}`, { edge: tc, strong: rel === 1 }); // choice points on the focused route: one diamond per place, even when several choices are made there // (at the bully fight: help or walk away, your first move, the dagger, then the bullies' fate) if (focus) { @@ -841,7 +842,7 @@ function panelRoutes(routes) { const best = Math.max(1e-12, ...routes.map((r) => r.value.x)); - const T = model().targets[st.colour], b = T[st.objective]; + const T = model().targets[st.colour], first = st.colour === "Black" && T.firstAttempt, b = first ? T.firstAttempt.thisAttempt : T[st.objective]; const focus = routes.find((r) => r.enc === st.focus) || routes[0]; const card = (r) => { const rel = r.value.x / best, o = encOutcome(r.enc), c = encColour(r.enc); @@ -851,7 +852,7 @@ return ``; + ${pct(r.value.x)}${st.colour === "Black" ? "on a first attempt" : "per attempt"} · ${bond}${n < 30 ? ` · only ${n} attempts logged` : ""}${r.value.o > 0.005 ? ` · ends on another dragon ${pct(r.value.o)}` : ""}`; }; const steps = focus.steps.filter((s) => s.kind === "decision" || s.kind === "chance").map((s) => { if (s.kind === "chance") return `
Diamonds on the map are choices: click one to see where the other options lead. ${st.blocked ? "" : `Your choices apply to every route to this dragon. Changed your mind? `}
Best route for any ${st.colour}: ${pct(b.pX.mean)} per attempt (95% interval ${pct(b.pX.lo)}–${pct(b.pX.hi)}), about ${isFinite(b.expectedAttempts.mean) ? Math.round(b.expectedAttempts.mean) : "–"} attempts. Riders who logged every run suggest ${pct(lb.pX.mean)}.
+ ${first ? `Low evidence Best route for the Black, on a first attempt: about 1 in ${Math.round(1 / Math.max(b.pX.mean, 1e-9))}, somewhere between 1 in ${Math.round(1 / Math.max(b.pX.hi, 1e-9))} and 1 in ${Math.round(1 / Math.max(b.pX.lo, 1e-9))} (95%). Later attempts almost never see the shadow. The low-bias sample suggests about 1 in ${Math.round(1 / Math.max(lb.pX.mean, 1e-9))}. Every logged shadow comes from riders who chose to post their run, so the shadow's odds rest on an assumption until complete first-attempt logs exist.
` : `Best route for any ${st.colour}: ${pct(b.pX.mean)} per attempt (95% interval ${pct(b.pX.lo)}–${pct(b.pX.hi)}), about ${isFinite(b.expectedAttempts.mean) ? Math.round(b.expectedAttempts.mean) : "–"} attempts. Riders who logged every run suggest ${pct(lb.pX.mean)}.
`}Each roll's odds may depend on your earlier choices, as far as the data support it. Choices marked "no clear winner" in Deep Dive are within the noise.${risks.length ? ` Risks on this route: ${risks.join(", ")}.` : ""}
The bond chance at each encounter is the community average: the form does not record the answers riders gave there.
diff --git a/site/atlas/index.html b/site/atlas/index.html index 5dcab9d..fda0874 100644 --- a/site/atlas/index.html +++ b/site/atlas/index.html @@ -182,6 +182,8 @@ section h2 { font-family: var(--font-crest); letter-spacing: 0.03em; } .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; } diff --git a/site/atlas/ui.js b/site/atlas/ui.js index 30da379..4b7fe32 100644 --- a/site/atlas/ui.js +++ b/site/atlas/ui.js @@ -159,6 +159,8 @@ if (!b) { if (t2) t2.innerHTML = '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 = `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.
`; + 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 ${as.bonded_black} bonded (${pct(as.bonded_black / Math.max(as.reached_black, 1))}).`; if (!box) return; const br = b.best_route; box.hidden = false; @@ -170,6 +172,7 @@ ${gaze ? `Why the Black's odds are uncertain. 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.
Method and every table: analysis/reports/BLACK.md; the numbers: data/black.json.