Coding rules for the redesigned community form; import the new data

The Threshing Routes form was redesigned (5,651 responses). Both implementations
(engine.js and clean.py) now read either version:
- one direction question + one colour question, with the older per-direction
  columns used only to fill gaps and cross-check
- cadet encounter as an action path (scream, first and second combat move)
  plus a separate outcome
- new fields: sighting_action, combat_second, rare_reported, malek_intent,
  left_squadmates, tail; "Why are you doing this run?" mapped onto the goal
  ("Blue or Black" for rare chasers)
- the rare-dragon question feeds saw_blue_meadow / saw_shadow and the branch
The old export still codes identically. JS/Python parity: all match.

Data: form 2,573 -> 5,651 rows, Dragon Register 216 -> 273, new route PDF
fingerprint. Supersedes the automated pull request #2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-01 22:10:51 +00:00
co-authored by Claude Opus 5.5
parent 9c0e35423a
commit 46ee08a56b
8 changed files with 5911 additions and 5707 deletions
+4 -3
View File
@@ -203,7 +203,8 @@
} }
const FACTOR_LABEL = { company: "Company", direction: "Direction", first_sighting: "First sighting", scream: "Scream choice", resolution: "Cadet encounter", 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", combat_first: "First combat move", post_path: "Fork in the road", hour: "After an hour", wing: "Wing", squad: "Squad",
attempt_group: "Attempt", source: "Data source", goal: "Chasing", attempt: "Attempt", period: "Date", }; attempt_group: "Attempt", 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; const labelFactor = (f) => FACTOR_LABEL[f] || f;
// ------------------------------------------------------------ route map // ------------------------------------------------------------ route map
@@ -480,7 +481,7 @@
} }
// ------------------------------------------------------------ rare section // ------------------------------------------------------------ rare section
const STRATUM_ORDER = ["Bulk logs (imports)", "Form: other/blank goal", "Form: chasing Black", "Form: chasing Blue"]; const STRATUM_ORDER = ["Bulk logs (imports)", "Form: other/blank goal", "Form: chasing Black", "Form: chasing Blue", "Form: chasing Blue or Black"];
function renderRare() { function renderRare() {
const r = state.res; const r = state.res;
const blueCol = dragonColor("Blue"), blackCol = dragonColor("Black"); const blueCol = dragonColor("Blue"), blackCol = dragonColor("Black");
@@ -616,7 +617,7 @@
<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 drop them 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>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 drop them 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> <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>
<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((r.n - (m.sources["Form"] || 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>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((r.n - (m.sources["Form"] || 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">How you reacted to the first dragon, whether you assessed or charged the bullies (asked only on later forms: ${r.factors.reach_hour.rows.filter((x) => x.factor === "combat_first" && x.level !== "(not recorded)").reduce((a, x) => a + x.n, 0)} rows), and most choices inside encounters. Theories that rely on those choices cannot be confirmed or refuted here.</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>`;
} }
function sourceRate(outKey, source) { function sourceRate(outKey, source) {
const O = E.OUTCOMES[outKey]; const O = E.OUTCOMES[outKey];
+1 -1
View File
@@ -167,7 +167,7 @@
const chase = stratum(cb, "Form: chasing Blue"); const chase = stratum(cb, "Form: chasing Blue");
$("#truths").innerHTML = ` $("#truths").innerHTML = `
<div class="truth"><h3>Lucky runs get shared</h3><p class="small">Riders hunting a Blue logged one 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.</p></div> <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.</p></div>
<div class="truth"><h3>No secret route to the Blue, so far</h3><p class="small">${routeSig.length ? `A few recorded choices showed a link: ${esc(routeSig.map((t) => t.term).join(", "))}.` : "Once that reporting bias is accounted for, none of the recorded choices (direction, first dragon, the cadets, company) changed how often the Blue appeared."} Choices the form doesn't record might still matter.</p></div> <div class="truth"><h3>No secret route to the Blue, so far</h3><p class="small">${routeSig.length ? `A few recorded choices showed a link: ${esc(routeSig.map((t) => t.term).join(", "))}.` : "Once that reporting bias is accounted for, none of the recorded choices (direction, first dragon, the cadets, company) changed how often the Blue appeared."} Choices the form doesn't record might still matter.</p></div>
<div class="truth"><h3>The right answer can still burn</h3><p class="small">Only ${pct(encB.p)} of Blue attempts bonded, about what the community's step-by-step odds predict. One death with the "right" answer doesn't mean the answer was wrong. Try again in four hours.</p></div>`; <div class="truth"><h3>The right answer can still burn</h3><p class="small">Only ${pct(encB.p)} of Blue attempts bonded, about what the community's step-by-step odds predict. One death with the "right" answer doesn't mean the answer was wrong. Try again in four hours.</p></div>`;
$("#hero-tagline").textContent = `Every path through the valley, mapped from ${r.n.toLocaleString()} runs riders logged.`; $("#hero-tagline").textContent = `Every path through the valley, mapped from ${r.n.toLocaleString()} runs riders logged.`;
+5652 -5652
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+130 -27
View File
@@ -48,15 +48,32 @@
bond_note: ["those who bonded"], bond_note: ["those who bonded"],
goal: ["colour dragon are you trying"], goal: ["colour dragon are you trying"],
combat: ["combat choice"], combat: ["combat choice"],
// Questions added in the redesigned form (late October 2026). "!x" means the header must NOT contain x.
first_dir: ["what was your first direction"],
first_colour: ["colour was your initial dragon sighting", "!["],
leg_West: ["colour was your initial dragon sighting", "[west"],
leg_Center: ["colour was your initial dragon sighting", "[forest center"],
sighting_action: ["action did you take during the first dragon sighting"],
cadet_actions: ["during your cadet encounter"],
goal_v2: ["why are you doing this run"],
malek: ["seek malek"],
rare: ["encounter a rare dragon"],
tail: ["what tail does your dragon have"],
}; };
// A key is only reported missing when neither it nor its replacement in the other form version was found.
const ALTERNATIVE = {
dir_East: "first_dir", dir_West: "first_dir", dir_Center: "first_dir", first_dir: "dir_Center", first_colour: "dir_Center",
goal: "goal_v2", goal_v2: "goal", combat: "cadet_actions", cadet_actions: "combat",
};
const OPTIONAL = new Set(["leg_West", "leg_Center", "sighting_action", "malek", "rare", "tail"]);
function findColumns(headers) { function findColumns(headers) {
const C = {}; const C = {};
for (const [key, words] of Object.entries(COLUMN_KEYS)) { for (const [key, words] of Object.entries(COLUMN_KEYS)) {
const hit = headers.find((h) => words.every((w) => String(h).toLowerCase().includes(w))); const hit = headers.find((h) => words.every((w) => w[0] === "!" ? !String(h).toLowerCase().includes(w.slice(1)) : String(h).toLowerCase().includes(w)));
if (hit !== undefined) C[key] = hit; if (hit !== undefined) C[key] = hit;
} }
const missing = Object.keys(COLUMN_KEYS).filter((k) => !(k in C)); const missing = Object.keys(COLUMN_KEYS).filter((k) => !(k in C) && !OPTIONAL.has(k) && !(ALTERNATIVE[k] in C));
return { C, missing }; return { C, missing };
} }
@@ -79,6 +96,45 @@
"Bullies > Put yourself in the middle (Rushed the bigger cadet attacking your squadmate)": "Bullies > Put yourself in the middle (Rushed the bigger cadet attacking your squadmate)":
"Put yourself in the middle (bigger cadet)", "Put yourself in the middle (bigger cadet)",
}; };
// Redesigned form: the cadet encounter is asked as a path of actions plus a separate outcome.
// value: [scream, first combat move, second combat move, resolution (when the action decides it)]
const 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"],
};
const 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",
};
const DIRECTION_MAP = { "Forest Center": "Center", "West / Scent": "West", "East / Roar": "East" };
const 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)",
};
const SIGHTING_ACTION = {
"Hold Ground / Stay Still": "Hold still", "Respect / Face it": "Respect / face it",
"Retreat / Run / Back Away": "Retreat / run", "Hide / Duck": "Hide", "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",
};
const RARE_MAP = { "Yes - A blue dragon in the valley": "Blue (valley)", "Yes - Shadow!!!": "Shadow", "No": "No" };
const RARE_GOALS = ["Blue", "Black", "Blue or Black"];
const isRareGoal = (goal) => RARE_GOALS.includes(goal);
const HOUR_MAP = { const HOUR_MAP = {
"Continued to Valley Centre": "Valley", "Continued to Valley Centre": "Valley",
"Climbed the tallest tree": "Tree", "Climbed the tallest tree": "Tree",
@@ -143,25 +199,61 @@
const section = wings.length === 1 ? g("wing_" + wings[0]) : null; const section = wings.length === 1 ? g("wing_" + wings[0]) : null;
if (wings.length > 1) flags.push("multiple wings"); if (wings.length > 1) flags.push("multiple wings");
const dirs = ["East", "West", "Center"].filter((d) => g("dir_" + d));
let direction, first; let direction, first;
if (dirs.length === 1) { if ("first_dir" in C) {
direction = dirs[0]; // Redesigned form: one direction question and one colour question. The older per-direction colour
first = g("dir_" + dirs[0]); // columns are still in the sheet for some rows and are used only to fill gaps and to cross-check.
direction = DIRECTION_MAP[g("first_dir")] || null;
first = g("first_colour");
const legacy = ["West", "Center"].filter((d) => g("leg_" + d));
if (!direction && legacy.length === 1) {
direction = legacy[0];
flags.push("direction taken from the older sighting column");
}
const leg = direction ? g("leg_" + direction) : null;
if (!first && leg) first = leg;
else if (first && leg && first !== leg && first !== "Unsure" && leg !== "Unsure")
flags.push("first sighting differs between the old and new columns");
if (!direction) {
direction = "Unknown";
flags.push("direction missing");
}
} else { } else {
direction = dirs.length ? "Multiple" : "Unknown"; const dirs = ["East", "West", "Center"].filter((d) => g("dir_" + d));
first = null; if (dirs.length === 1) {
flags.push("direction " + (dirs.length ? "multiple" : "missing")); direction = dirs[0];
first = g("dir_" + dirs[0]);
} else {
direction = dirs.length ? "Multiple" : "Unknown";
first = null;
flags.push("direction " + (dirs.length ? "multiple" : "missing"));
}
} }
const company = g("company") || "Unknown"; const companyRaw = g("company") || "Unknown";
const pool = SIGHTING_POOL[company + "|" + direction]; const leftSquad = / > Left them$/.test(companyRaw);
if (first && first !== "Unsure" && pool && !pool.includes(first)) const company = leftSquad ? companyRaw.replace(/ > Left them$/, "") : companyRaw;
// Leaving your squadmates sends you into the solo pools, so either pool is plausible.
const pool = (SIGHTING_POOL[company + "|" + direction] || []).concat(leftSquad ? SIGHTING_POOL["Alone|" + direction] || [] : []);
if (first && first !== "Unsure" && pool.length && !pool.includes(first))
flags.push(`first sighting ${first} not in documented pool for ${company}/${direction}`); flags.push(`first sighting ${first} not in documented pool for ${company}/${direction}`);
const cadetRaw = g("cadet"); const cadetRaw = g("cadet");
const [scream, resolution] = CADET_MAP[cadetRaw] || ["Unknown", "Unknown"]; let scream, resolution, combat = null, combat2 = null;
if (cadetRaw && !CADET_MAP[cadetRaw]) flags.push("unrecognised cadet answer"); if ("cadet_actions" in C) {
const combat = g("combat") ? COMBAT_MAP[g("combat")] || null : null; const act = g("cadet_actions");
const a = CADET_ACTIONS[act] || ["Unknown", null, null, "Unknown"];
if (act && !CADET_ACTIONS[act]) flags.push("unrecognised cadet answer");
[scream, combat, combat2] = a;
const out = CADET_OUTCOME[cadetRaw] || null;
if (a[3] !== null) {
resolution = a[3];
if (out === "DIED in combat" && !resolution.startsWith("DIED")) flags.push("died in combat on a path without combat");
} else resolution = out || "Unknown";
} else {
[scream, resolution] = CADET_MAP[cadetRaw] || ["Unknown", "Unknown"];
if (cadetRaw && !CADET_MAP[cadetRaw]) flags.push("unrecognised cadet answer");
combat = g("combat") ? COMBAT_MAP[g("combat")] || null : null;
}
const postRaw = g("post"); const postRaw = g("post");
let post = null; let post = null;
@@ -176,12 +268,13 @@
const enc = {}; const enc = {};
for (const c of COLORS) enc[c] = g("enc_" + c); for (const c of COLORS) enc[c] = g("enc_" + c);
const rare = RARE_MAP[g("rare")] || null;
const bonded = COLORS.filter((c) => enc[c] === "Bonded!"); const bonded = COLORS.filter((c) => enc[c] === "Bonded!");
const burned = COLORS.filter((c) => enc[c] === "Incinerated"); const burned = COLORS.filter((c) => enc[c] === "Incinerated");
let branch = null; let branch = null;
if (hour === "Tree") { if (hour === "Tree") {
if (enc.Blue || enc.Black) branch = "Shadow (rare)"; if (enc.Blue || enc.Black || rare === "Shadow") branch = "Shadow (rare)";
else if (enc.Green) branch = "Descend slowly: two Greens"; else if (enc.Green) branch = "Descend slowly: two Greens";
else if (enc.Red) branch = "Descend quickly: Red"; else if (enc.Red) branch = "Descend quickly: Red";
else if (enc.Orange || enc.Brown) { else if (enc.Orange || enc.Brown) {
@@ -190,7 +283,7 @@
} }
} else if (hour === "Valley") { } else if (hour === "Valley") {
if (enc.Green) flags.push("Green recorded on a Valley run (no Greens in the valley)"); if (enc.Green) flags.push("Green recorded on a Valley run (no Greens in the valley)");
const meadow = ["Orange", "Brown", "Blue"].some((c) => enc[c]); const meadow = ["Orange", "Brown", "Blue"].some((c) => enc[c]) || rare === "Blue (valley)";
if (meadow || enc.Red === "Changed my mind") branch = "Passed the Red: meadow"; if (meadow || enc.Red === "Changed my mind") branch = "Passed the Red: meadow";
else if (enc.Red) branch = "Valley Red"; else if (enc.Red) branch = "Valley Red";
} }
@@ -212,17 +305,26 @@
const rescued = enc.Green === "Saved by another" && outcome === "Bonded" && ["Orange", "Brown"].includes(outcomeColor); const rescued = enc.Green === "Saved by another" && outcome === "Bonded" && ["Orange", "Brown"].includes(outcomeColor);
const attempt = parseAttempt(g("attempt")); const attempt = parseAttempt(g("attempt"));
if ((rare === "Blue (valley)" && hour === "Tree") || (rare === "Shadow" && hour === "Valley"))
flags.push("rare-dragon answer does not match the path");
const goalRaw = g("goal_v2");
const goal = g("goal") || (goalRaw && goalRaw !== "Unknown" ? GOAL_V2[goalRaw] || goalRaw : null) || "(not asked/blank)";
return { return {
source, date, wing, section, squad: g("squad") || "Unknown", attempt, source, date, wing, section, squad: g("squad") || "Unknown", attempt,
attempt_group: attempt === 1 ? "First attempt" : attempt > 1 ? "Later attempt" : "Unknown/lost count", attempt_group: attempt === 1 ? "First attempt" : attempt > 1 ? "Later attempt" : "Unknown/lost count",
goal: g("goal") || "(not asked/blank)", company, direction, first_sighting: first || "Unknown", goal, company, left_squadmates: leftSquad, direction, first_sighting: first || "Unknown",
scream, resolution, combat_first: combat || "(not recorded)", post_path: post, hour, branch, sighting_action: "sighting_action" in C ? SIGHTING_ACTION[g("sighting_action")] || g("sighting_action") || "Unknown" : "(not asked)",
scream, resolution, combat_first: combat || "(not recorded)", combat_second: combat2 || "(not recorded)",
post_path: post, hour, branch,
enc_Red: enc.Red, enc_Green: enc.Green, enc_Orange: enc.Orange, enc_Brown: enc.Brown, enc_Red: enc.Red, enc_Green: enc.Green, enc_Orange: enc.Orange, enc_Brown: enc.Brown,
enc_Blue: enc.Blue, enc_Black: enc.Black, enc_Blue: enc.Blue, enc_Black: enc.Black,
outcome, outcome_color: outcomeColor, rescued, outcome, outcome_color: outcomeColor, rescued,
saw_blue_meadow: !!(hour === "Valley" && enc.Blue), saw_blue_meadow: !!(hour === "Valley" && (enc.Blue || rare === "Blue (valley)")),
saw_shadow: !!(hour === "Tree" && (enc.Blue || enc.Black)), saw_shadow: !!(hour === "Tree" && (enc.Blue || enc.Black || rare === "Shadow")),
rare_reported: "rare" in C ? rare || "Unknown" : "(not asked)",
malek_intent: "malek" in C ? g("malek") || "Unknown" : "(not asked)",
tail: g("tail"),
data_flags: flags.join("; "), data_flags: flags.join("; "),
death_note: redact(g("death_note")), bond_note: redact(g("bond_note")), death_note: redact(g("death_note")), bond_note: redact(g("bond_note")),
}; };
@@ -396,8 +498,9 @@
const sortedKeys = (o) => Object.keys(o).sort(); const sortedKeys = (o) => Object.keys(o).sort();
const stratum = (r) => r.source !== "Form" ? "Bulk logs (imports)" : const stratum = (r) => r.source !== "Form" ? "Bulk logs (imports)" :
r.goal === "Blue" ? "Form: chasing Blue" : r.goal === "Black" ? "Form: chasing Black" : "Form: other/blank goal"; r.goal === "Blue" ? "Form: chasing Blue" : r.goal === "Black" ? "Form: chasing Black" :
const goal2 = (r) => ["Blue", "Black"].includes(r.goal) ? r.goal : r.goal === "(not asked/blank)" ? "Blank/not asked" : "Other colour/any"; r.goal === "Blue or Black" ? "Form: chasing Blue or Black" : "Form: other/blank goal";
const goal2 = (r) => isRareGoal(r.goal) ? r.goal : r.goal === "(not asked/blank)" ? "Blank/not asked" : "Other colour/any";
// Denominators for each outcome ("who could have had this outcome?") // Denominators for each outcome ("who could have had this outcome?")
const OUTCOMES = { const OUTCOMES = {
@@ -423,7 +526,7 @@
} }
const FACTORS = ["company", "direction", "first_sighting", "scream", "resolution", "combat_first", const FACTORS = ["company", "direction", "first_sighting", "scream", "resolution", "combat_first",
"post_path", "hour", "wing", "squad", "attempt_group", "source", "goal"]; "post_path", "hour", "wing", "squad", "attempt_group", "source", "goal", "sighting_action", "combat_second", "malek_intent"];
// Encounter contexts: which recorded dragon attempt belongs to which in-game encounter. // Encounter contexts: which recorded dragon attempt belongs to which in-game encounter.
const CONTEXTS = [ const CONTEXTS = [
@@ -441,8 +544,8 @@
return runs.filter((r) => { return runs.filter((r) => {
if (f.source === "form" && r.source !== "Form") return false; if (f.source === "form" && r.source !== "Form") return false;
if (f.source === "bulk" && r.source === "Form") return false; if (f.source === "bulk" && r.source === "Form") return false;
if (f.goal === "exclude_rare" && ["Blue", "Black"].includes(r.goal)) return false; if (f.goal === "exclude_rare" && isRareGoal(r.goal)) return false;
if (f.goal === "only_rare" && !["Blue", "Black"].includes(r.goal)) return false; if (f.goal === "only_rare" && !isRareGoal(r.goal)) return false;
if (f.excludeFlagged && r.data_flags) return false; if (f.excludeFlagged && r.data_flags) return false;
return true; return true;
}); });
@@ -540,7 +643,7 @@
res.encounters = CONTEXTS.map(([name, where, col, color]) => { res.encounters = CONTEXTS.map(([name, where, col, color]) => {
const A = runs.filter((r) => where(r) && ["Bonded!", "Incinerated"].includes(r[col])); const A = runs.filter((r) => where(r) && ["Bonded!", "Incinerated"].includes(r[col]));
const win = (r) => r[col] === "Bonded!"; const win = (r) => r[col] === "Bonded!";
const intent = A.filter((r) => r.goal === color || r.goal.startsWith("Any")); const intent = A.filter((r) => r.goal === color || r.goal.startsWith("Any") || (r.goal === "Blue or Black" && (color === "Blue" || color === "Black")));
const byS = groupBy(A, stratum); const byS = groupBy(A, stratum);
return { return {
context: name, color, overall: rate(A, win), intent_matched: rate(intent, win), context: name, color, overall: rate(A, win), intent_matched: rate(intent, win),
+2 -2
View File
@@ -16,7 +16,7 @@ from stats_core import Z95, bh, logistic_ridge, odds_ratio, p_from_z, wilson
COLORS = ["Red", "Green", "Orange", "Brown", "Blue", "Black"] COLORS = ["Red", "Green", "Orange", "Brown", "Blue", "Black"]
FACTORS = ["company", "direction", "first_sighting", "scream", "resolution", "combat_first", FACTORS = ["company", "direction", "first_sighting", "scream", "resolution", "combat_first",
"post_path", "hour", "wing", "squad", "attempt_group", "source", "goal"] "post_path", "hour", "wing", "squad", "attempt_group", "source", "goal", "sighting_action", "combat_second", "malek_intent"]
def W(k, n): def W(k, n):
@@ -89,7 +89,7 @@ def model(d, key, factors, lam=1.0):
def goal2(r): def goal2(r):
if r.goal in ("Blue", "Black"): if r.goal in ("Blue", "Black", "Blue or Black"):
return r.goal return r.goal
return "Blank/not asked" if r.goal == "(not asked/blank)" else "Other colour/any" return "Blank/not asked" if r.goal == "(not asked/blank)" else "Other colour/any"
+120 -20
View File
@@ -52,7 +52,24 @@ COLUMN_KEYS = {
"bond_note": ["those who bonded"], "bond_note": ["those who bonded"],
"goal": ["colour dragon are you trying"], "goal": ["colour dragon are you trying"],
"combat": ["combat choice"], "combat": ["combat choice"],
# Questions added in the redesigned form (late October 2026). "!x" means the header must NOT contain x.
"first_dir": ["what was your first direction"],
"first_colour": ["colour was your initial dragon sighting", "!["],
"leg_West": ["colour was your initial dragon sighting", "[west"],
"leg_Center": ["colour was your initial dragon sighting", "[forest center"],
"sighting_action": ["action did you take during the first dragon sighting"],
"cadet_actions": ["during your cadet encounter"],
"goal_v2": ["why are you doing this run"],
"malek": ["seek malek"],
"rare": ["encounter a rare dragon"],
"tail": ["what tail does your dragon have"],
} }
# A key is only reported missing when neither it nor its replacement in the other form version was found.
ALTERNATIVE = {
"dir_East": "first_dir", "dir_West": "first_dir", "dir_Center": "first_dir", "first_dir": "dir_Center",
"first_colour": "dir_Center", "goal": "goal_v2", "goal_v2": "goal", "combat": "cadet_actions", "cadet_actions": "combat",
}
OPTIONAL = {"leg_West", "leg_Center", "sighting_action", "malek", "rare", "tail"}
CADET_MAP = { CADET_MAP = {
"Bullies > You dealt with them": ("Investigate & help", "Killed the bullies yourself"), "Bullies > You dealt with them": ("Investigate & help", "Killed the bullies yourself"),
@@ -71,6 +88,43 @@ COMBAT_MAP = {
"Bullies > Even the numbers (Rushed the smaller cadet)": "Even the numbers (smaller cadet)", "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)", "Bullies > Put yourself in the middle (Rushed the bigger cadet attacking your squadmate)": "Put yourself in the middle (bigger cadet)",
} }
# Redesigned form: the cadet encounter is asked as a path of actions plus a separate outcome.
# value: (scream, first combat move, second combat move, resolution when the action decides it)
CADET_ACTIONS = {
"Bullies > Assess > Unknown": ("Investigate & help", "Assess the situation", None, None),
"Bullies > Assess > Smaller Cadet": ("Investigate & help", "Assess the situation", "Engage the smaller cadet", None),
"Bullies > Assess > Daggers or not": ("Investigate & help", "Assess the situation", "Daggers or not (protect squadmate)", None),
"Bullies > Unknown": ("Investigate & help", None, None, None),
"Bullies > Smaller Cadet (Did not assess)": ("Investigate & help", "Even the numbers (smaller cadet)", None, None),
"Bullies > Bigger Cadet (Did not assess)": ("Investigate & help", "Put yourself in the middle (bigger cadet)", None, None),
"Injured Cadet > Tourniquet": ("Ignore the scream", None, None, "Tourniquet"),
"Injured Cadet > Left them there": ("Ignore the scream", None, None, "Left injured cadet"),
"Injured Cadet > Took their weapons": ("Ignore the scream", None, None, "Took their weapons"),
"Avoided combat (Investigated scream > Left them to it)": ("Investigate & leave", None, None, "Left them to it"),
"N/A - You died with initial dragon sighting": ("DIED at first sighting", None, None, "DIED at first sighting"),
"Unsure": ("Unknown", None, None, "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_MAP = {"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)",
}
SIGHTING_ACTION = {
"Hold Ground / Stay Still": "Hold still", "Respect / Face it": "Respect / face it",
"Retreat / Run / Back Away": "Retreat / run", "Hide / Duck": "Hide", "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_MAP = {"Yes - A blue dragon in the valley": "Blue (valley)", "Yes - Shadow!!!": "Shadow", "No": "No"}
HOUR_MAP = { HOUR_MAP = {
"Continued to Valley Centre": "Valley", "Continued to Valley Centre": "Valley",
"Climbed the tallest tree": "Tree", "Climbed the tallest tree": "Tree",
@@ -95,10 +149,10 @@ def find_columns(cols):
out = {} out = {}
low = {c: str(c).lower() for c in cols} low = {c: str(c).lower() for c in cols}
for key, words in COLUMN_KEYS.items(): for key, words in COLUMN_KEYS.items():
hits = [c for c in cols if all(w in low[c] for w in words)] 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: if hits:
out[key] = hits[0] out[key] = hits[0]
missing = [k for k in COLUMN_KEYS if k not in out] missing = [k for k in COLUMN_KEYS if k not in out and k not in OPTIONAL and ALTERNATIVE.get(k) not in out]
return out, missing return out, missing
@@ -168,23 +222,59 @@ def code_row(r, C):
if len(wings) > 1: if len(wings) > 1:
flags.append("multiple wings") flags.append("multiple wings")
dirs = [d for d in ("East", "West", "Center") if g("dir_" + d)] if "first_dir" in C:
if len(dirs) == 1: # Redesigned form: one direction question and one colour question. The older per-direction colour
direction, first = dirs[0], g("dir_" + dirs[0]) # columns are still in the sheet for some rows and are used only to fill gaps and to cross-check.
direction = DIRECTION_MAP.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: else:
direction, first = ("Multiple" if dirs else "Unknown"), None dirs = [d for d in ("East", "West", "Center") if g("dir_" + d)]
flags.append("direction " + ("multiple" if dirs else "missing")) 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 = g("company") or "Unknown" company_raw = g("company") or "Unknown"
if first and first != "Unsure" and (company, direction) in SIGHTING_POOL: left_squad = company_raw.endswith(" > Left them")
if first not in SIGHTING_POOL[(company, direction)]: company = company_raw[: -len(" > Left them")] if left_squad else company_raw
flags.append(f"first sighting {first} not in documented pool for {company}/{direction}") # Leaving your squadmates sends you into the solo pools, so either pool is plausible.
pool = list(SIGHTING_POOL.get((company, direction), [])) + (list(SIGHTING_POOL.get(("Alone", 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") cadet_raw = g("cadet")
scream, resolution = CADET_MAP.get(cadet_raw, ("Unknown", "Unknown")) combat = combat2 = None
if cadet_raw and cadet_raw not in CADET_MAP: if "cadet_actions" in C:
flags.append("unrecognised cadet answer") act = g("cadet_actions")
combat = COMBAT_MAP.get(g("combat")) if g("combat") else None a = CADET_ACTIONS.get(act, ("Unknown", None, None, "Unknown"))
if act and act not in CADET_ACTIONS:
flags.append("unrecognised cadet answer")
scream, combat, combat2 = a[0], a[1], a[2]
out = 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 = CADET_MAP.get(cadet_raw, ("Unknown", "Unknown"))
if cadet_raw and cadet_raw not in CADET_MAP:
flags.append("unrecognised cadet answer")
combat = COMBAT_MAP.get(g("combat")) if g("combat") else None
post_raw = g("post") post_raw = g("post")
if scream == "Investigate & help" and not resolution.startswith("DIED"): if scream == "Investigate & help" and not resolution.startswith("DIED"):
@@ -204,13 +294,14 @@ def code_row(r, C):
hour = "Unknown" hour = "Unknown"
enc = {c: g("enc_" + c) for c in COLORS} enc = {c: g("enc_" + c) for c in COLORS}
rare = RARE_MAP.get(g("rare"))
bonded = [c for c in COLORS if enc[c] == "Bonded!"] bonded = [c for c in COLORS if enc[c] == "Bonded!"]
burned = [c for c in COLORS if enc[c] == "Incinerated"] burned = [c for c in COLORS if enc[c] == "Incinerated"]
# Which encounter branch did the run take after the hour? # Which encounter branch did the run take after the hour?
branch = None branch = None
if hour == "Tree": if hour == "Tree":
if enc["Blue"] or enc["Black"]: if enc["Blue"] or enc["Black"] or rare == "Shadow":
branch = "Shadow (rare)" branch = "Shadow (rare)"
elif enc["Green"]: elif enc["Green"]:
branch = "Descend slowly: two Greens" branch = "Descend slowly: two Greens"
@@ -223,7 +314,7 @@ def code_row(r, C):
if enc["Green"]: if enc["Green"]:
flags.append("Green recorded on a Valley run (no Greens in the valley)") flags.append("Green recorded on a Valley run (no Greens in the valley)")
red_passed = enc["Red"] in ("Changed my mind",) red_passed = enc["Red"] in ("Changed my mind",)
meadow = [c for c in ("Orange", "Brown", "Blue") if enc[c]] meadow = [c for c in ("Orange", "Brown", "Blue") if enc[c]] or rare == "Blue (valley)"
if meadow or red_passed: if meadow or red_passed:
branch = "Passed the Red: meadow" branch = "Passed the Red: meadow"
elif enc["Red"]: elif enc["Red"]:
@@ -254,18 +345,27 @@ def code_row(r, C):
rescued = enc["Green"] == "Saved by another" and outcome == "Bonded" and outcome_color in ("Orange", "Brown") rescued = enc["Green"] == "Saved by another" and outcome == "Bonded" and outcome_color in ("Orange", "Brown")
attempt = parse_attempt(g("attempt")) 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 (GOAL_V2.get(goal_raw, goal_raw) if goal_raw and goal_raw != "Unknown" else None) or "(not asked/blank)"
return { return {
"source": source, "date": date, "wing": wing, "section": section, "source": source, "date": date, "wing": wing, "section": section,
"squad": g("squad") or "Unknown", "attempt": attempt, "squad": g("squad") or "Unknown", "attempt": attempt,
"attempt_group": "First attempt" if attempt == 1 else ("Later attempt" if attempt and attempt > 1 else "Unknown/lost count"), "attempt_group": "First attempt" if attempt == 1 else ("Later attempt" if attempt and attempt > 1 else "Unknown/lost count"),
"goal": g("goal") or "(not asked/blank)", "company": company, "goal": goal, "company": company, "left_squadmates": left_squad,
"direction": direction, "first_sighting": first or "Unknown", "direction": direction, "first_sighting": first or "Unknown",
"sighting_action": (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)", "scream": scream, "resolution": resolution, "combat_first": combat or "(not recorded)",
"combat_second": combat2 or "(not recorded)",
"post_path": post, "hour": hour, "branch": branch, "post_path": post, "hour": hour, "branch": branch,
**{"enc_" + c: enc[c] for c in COLORS}, **{"enc_" + c: enc[c] for c in COLORS},
"outcome": outcome, "outcome_color": outcome_color, "rescued": rescued, "outcome": outcome, "outcome_color": outcome_color, "rescued": rescued,
"saw_blue_meadow": bool(hour == "Valley" and enc["Blue"]), "saw_blue_meadow": bool(hour == "Valley" and (enc["Blue"] or rare == "Blue (valley)")),
"saw_shadow": bool(hour == "Tree" and (enc["Blue"] or enc["Black"])), "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), "data_flags": "; ".join(flags),
"death_note": redact(g("death_note")), "bond_note": redact(g("bond_note")), "death_note": redact(g("death_note")), "bond_note": redact(g("bond_note")),
} }
+1 -1
View File
@@ -16,7 +16,7 @@ def stage(r):
return " › ".join(v if isinstance(v, str) and v else "—" for v in [r.company, r.direction, fs, cad, r.post_path, hour]) return " › ".join(v if isinstance(v, str) and v else "—" for v in [r.company, r.direction, fs, cad, r.post_path, hour])
def stratum(r): def stratum(r):
if r.source != "Form": return "bulk" if r.source != "Form": return "bulk"
return {"Blue": "blue", "Black": "black"}.get(r.goal, "other") return {"Blue": "blue", "Black": "black", "Blue or Black": "blue-or-black"}.get(r.goal, "other")
d["route"] = d.apply(stage, axis=1); d["stratum"] = d.apply(stratum, axis=1) d["route"] = d.apply(stage, axis=1); d["stratum"] = d.apply(stratum, axis=1)
d["branch"] = d.branch.where(d.branch.notna(), None) d["branch"] = d.branch.where(d.branch.notna(), None)
T = {"see_Blue": (lambda x: x.branch == "Passed the Red: meadow", lambda x: x.saw_blue_meadow), T = {"see_Blue": (lambda x: x.branch == "Passed the Red: meadow", lambda x: x.saw_blue_meadow),