Core: fix three coding bugs from the core review, with rule tests (#11)
1. Letting the Red pass. Only climbing down quickly puts you above the Red, so a tree run that passed on the Red and then met the Greens let it pass. Those 16 runs were coded as slow descents; they are now "Descend quickly: let the Red pass" and count for the Greens' encounter, so the route model's "let it pass" option rests on its own runs. A tree run with both the Red and the Greens attempted (impossible in one run) is now flagged. 2. Leaving your squadmates. The form only offered "> Left them" from 2026-10-27 (0 of 504 squad runs before chose it, 40 of 144 after). Earlier and undated squad runs are now unknown rather than "stayed together" (form.yaml: left_squadmates_asked_from). 3. Bot text. The wounded cadet's other two choices map onto the form; a test checks every choice the bot has logged maps onto a form variable (encounter answers excepted, not modelled yet). Each rule has a test in tests/core/test_coding.py. Data rebuilt (runs, graph, policy, report); the headline odds move by at most 0.02 points. The Methods tab describes both rules. Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cc86343668
commit
963b08c522
+12
-4
@@ -239,6 +239,8 @@
|
||||
const companyRaw = g("company") || "Unknown";
|
||||
const leftSquad = / > Left them$/.test(companyRaw);
|
||||
const company = leftSquad ? companyRaw.replace(/ > Left them$/, "") : companyRaw;
|
||||
// "left them" was only offered from 2026-10-27 (core/spec/form.yaml): earlier and undated squad runs are unknown
|
||||
const leftKnown = leftSquad || !["1 Squadmate", "2 Squadmates"].includes(company) || (date && date >= "2026-10-27");
|
||||
// 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))
|
||||
@@ -282,7 +284,11 @@
|
||||
let branch = null;
|
||||
if (hour === "Tree") {
|
||||
if (enc.Blue || enc.Black || rare === "Shadow") branch = "Shadow (rare)";
|
||||
else if (enc.Green) branch = "Descend slowly: two Greens";
|
||||
else if (enc.Red === "Changed my mind" && enc.Green) branch = "Descend quickly: let the Red pass";
|
||||
else if (enc.Green) {
|
||||
branch = "Descend slowly: two Greens";
|
||||
if (enc.Red) flags.push("tree run with both the Red and the two Greens attempted");
|
||||
}
|
||||
else if (enc.Red) branch = "Descend quickly: Red";
|
||||
else if (enc.Orange || enc.Brown) {
|
||||
branch = "Descend slowly: two Greens";
|
||||
@@ -321,7 +327,7 @@
|
||||
source, date, wing, section, squad: g("squad") || "Unknown", attempt,
|
||||
// "I've lost count" means many attempts, so it is a later attempt, not missing
|
||||
attempt_group: attempt === 1 ? "First attempt" : attempt > 1 || /lost count/i.test(g("attempt") || "") ? "Later attempt" : "Unknown",
|
||||
goal, company, left_squadmates: leftSquad, direction, first_sighting: first || "Unknown",
|
||||
goal, company, left_squadmates: leftKnown ? leftSquad : null, direction, first_sighting: first || "Unknown",
|
||||
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,
|
||||
@@ -536,10 +542,12 @@
|
||||
const FACTORS = ["company", "direction", "first_sighting", "scream", "resolution", "combat_first",
|
||||
"post_path", "hour", "wing", "squad", "attempt_group", "source", "goal", "sighting_action", "combat_second", "malek_intent"];
|
||||
|
||||
// the two Greens are met by climbing down slowly, or by climbing down quickly and letting the Red pass
|
||||
const GREENS = (r) => r.branch === "Descend slowly: two Greens" || r.branch === "Descend quickly: let the Red pass";
|
||||
// Encounter contexts: which recorded dragon attempt belongs to which in-game encounter.
|
||||
const CONTEXTS = [
|
||||
["Red (tree, descend quickly)", (r) => r.hour === "Tree" && r.branch === "Descend quickly: Red", "enc_Red", "Red"],
|
||||
["Green (two Greens)", (r) => r.hour === "Tree" && r.branch === "Descend slowly: two Greens", "enc_Green", "Green"],
|
||||
["Green (two Greens)", (r) => r.hour === "Tree" && GREENS(r), "enc_Green", "Green"],
|
||||
["Blue (shadow)", (r) => r.hour === "Tree" && r.branch === "Shadow (rare)", "enc_Blue", "Blue"],
|
||||
["Black (shadow)", (r) => r.hour === "Tree" && r.branch === "Shadow (rare)", "enc_Black", "Black"],
|
||||
["Red (valley)", (r) => r.hour === "Valley" && r.branch === "Valley Red", "enc_Red", "Red"],
|
||||
@@ -659,7 +667,7 @@
|
||||
by_stratum: Object.fromEntries(sortedKeys(byS).map((s) => [s, rate(byS[s], win)])),
|
||||
};
|
||||
});
|
||||
const greens = runs.filter((r) => r.hour === "Tree" && r.branch === "Descend slowly: two Greens" && r.enc_Green);
|
||||
const greens = runs.filter((r) => r.hour === "Tree" && GREENS(r) && r.enc_Green);
|
||||
res.green_rescue = {
|
||||
green_encounters: greens.length,
|
||||
bonded_green: greens.filter((r) => r.enc_Green === "Bonded!").length,
|
||||
|
||||
Reference in New Issue
Block a user