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:
ekcSchiano
2026-11-03 21:12:34 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent cc86343668
commit 963b08c522
15 changed files with 974 additions and 926 deletions
+8 -9
View File
@@ -102,7 +102,8 @@
const v = { company: DECISIONS.company.includes(r.company) ? r.company : null,
direction: DECISIONS.direction.includes(r.direction) ? r.direction : null,
fs: ["Red", "Brown", "Green", "Orange"].includes(r.first_sighting) ? r.first_sighting : null };
v.left = v.company === "Alone" ? ALONE : v.company ? (String(r.left_squadmates) === "true" || r.left_squadmates === true ? "Leave them" : "Stay together") : null;
const leftKnown = r.left_squadmates != null && r.left_squadmates !== "";
v.left = v.company === "Alone" ? ALONE : v.company && leftKnown ? (String(r.left_squadmates) === "true" || r.left_squadmates === true ? "Leave them" : "Stay together") : null;
v.react = DECISIONS.react.includes(r.sighting_action) ? r.sighting_action : null;
v.diedSight = r.scream === "DIED at first sighting";
if (v.diedSight) return v;
@@ -128,12 +129,8 @@
if (v.hour === "Tree" && b) {
v.shadow = b === "Shadow (rare)";
if (v.shadow) { v.shadowColour = r.enc_Black ? "Black" : "Blue"; v.encCtx = "shadow-" + v.shadowColour; }
else if (b === "Descend quickly: Red") {
v.descend = "Quickly (Red)";
// a rider who let the Red pass and met the Greens instead
if (r.enc_Red === "Changed my mind" && r.enc_Green) { v.red = "Let it pass (two Greens)"; v.encCtx = "tree-Greens"; }
else { v.red = "Jump onto the Red"; v.encCtx = "tree-Red"; }
}
else if (b === "Descend quickly: Red") { v.descend = "Quickly (Red)"; v.red = "Jump onto the Red"; v.encCtx = "tree-Red"; }
else if (b === "Descend quickly: let the Red pass") { v.descend = "Quickly (Red)"; v.red = "Let it pass (two Greens)"; v.encCtx = "tree-Greens"; }
else if (b === "Descend slowly: two Greens") { v.descend = "Slowly (two Greens)"; v.encCtx = "tree-Greens"; }
} else if (v.hour === "Valley" && b) {
if (b === "Valley Red") { v.valley = "Face the Red"; v.encCtx = "valley-Red"; }
@@ -620,7 +617,8 @@
descend: { "Quickly (Red)": /^descend quickly/, "Slowly (two Greens)": /^climb down slowly/ },
resolution: {
"Killed the bullies yourself": /^end the lives of the bullies/, "Squadmate's revenge": /^allow your squadmate to exact/,
"Left bullies to the dragons": /^leave the bullies alive/, "Tourniquet": /tourniquet/, "Took their weapons": /weapon/,
"Left bullies to the dragons": /^leave the bullies alive/, "Tourniquet": /tourniquet/,
"Left injured cadet": /leave (them|him|her) to die/, "Took their weapons": /take (their|his|her) weapons?/,
},
scream: { "Investigate the scream": /^investigate the scream/, "Keep walking": /^keep walking/ },
clearing: { "Help your squadmate": /^help your squadmate/, "Walk away": /^play it safe and leave them/ },
@@ -659,7 +657,8 @@
if (DECISIONS.post.includes(vars.post_path)) h.post = vars.post_path;
else if (h.cadet && !HELP[h.cadet]) h.post = "(no fork)";
if (DECISIONS.hour.includes(vars.hour)) h.hour = vars.hour;
if (vars.branch === "Descend quickly: Red") h.descend = "Quickly (Red)";
if (vars.branch === "Descend quickly: Red" || vars.branch === "Descend quickly: let the Red pass") h.descend = "Quickly (Red)";
if (vars.branch === "Descend quickly: let the Red pass" && !h.red) h.red = "Let it pass (two Greens)";
if (DECISIONS.red.includes(vars.red)) h.red = vars.red;
if (vars.branch === "Descend slowly: two Greens") h.descend = "Slowly (two Greens)";
if (vars.branch === "Valley Red") h.valley = "Face the Red";