Route model: every logged choice; map keeps your choices on every route
Solver: adds leaving your squadmates, your reaction to the first dragon (options offered per dragon, from the form's categories) and, below the tree, jumping onto the Red or letting it pass to the two Greens. Bot crosswalk and option patterns map the game's text for each. Map: a choice you make now holds for every route to that dragon, together with the earlier steps of the path you were looking at, so a later choice never sends the route back through another place. Routes your choices rule out are hidden; choosing an option closes its card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c2dcaee16f
commit
83bc19521e
@@ -87,6 +87,11 @@
|
||||
[/^head west toward the scent/, "direction", "West"],
|
||||
[/^head toward the center of the forest/, "direction", "Center"],
|
||||
[/^keep walking the cadets are just as dangerous/, "scream", "Ignore the scream"],
|
||||
[/^run and hope/, "sighting_action", "Retreat / run"],
|
||||
[/hold still/, "sighting_action", "Hold still"],
|
||||
[/lower your eyes in respect|lower your eyes and turn to face it/, "sighting_action", "Respect / face it"],
|
||||
[/meeting its gaze/, "sighting_action", "Meet its gaze"],
|
||||
[/^hide behind a tree/, "sighting_action", "Hide"],
|
||||
[/^investigate the scream/, "scream_investigate", true],
|
||||
[/^help your squadmate/, "scream", "Investigate & help"],
|
||||
[/^play it safe and leave them/, "scream", "Investigate & leave"],
|
||||
@@ -105,7 +110,9 @@
|
||||
[/^continue toward the center of the valley/, "hour", "Valley"],
|
||||
[/^find the tallest tree/, "hour", "Tree"],
|
||||
[/^descend quickly/, "branch", "Descend quickly: Red"],
|
||||
[/^climb down slowly to pursue the green/, "branch", "Descend slowly: two Greens"]
|
||||
[/^climb down slowly to pursue the green/, "branch", "Descend slowly: two Greens"],
|
||||
[/^reds are too hot tempered/, "red", "Let it pass (two Greens)"],
|
||||
[/^jump (now|in a few seconds)/, "red", "Jump onto the Red"]
|
||||
];
|
||||
|
||||
/** Map one bot trajectory onto the form's decision variables. Unmapped choices are listed, not guessed. */
|
||||
@@ -127,7 +134,7 @@
|
||||
|
||||
/** A coded community-form run (engine.codeRow output) in the same shape. */
|
||||
function formRunVariables(run) {
|
||||
const keep = ["company", "direction", "first_sighting", "scream", "combat_first", "combat_second", "resolution", "post_path", "hour", "branch", "outcome", "outcome_color"];
|
||||
const keep = ["company", "left_squadmates", "direction", "first_sighting", "sighting_action", "scream", "combat_first", "combat_second", "resolution", "post_path", "hour", "branch", "outcome", "outcome_color"];
|
||||
const vars = {};
|
||||
for (const k of keep) vars[k] = run[k] == null ? null : run[k];
|
||||
return vars;
|
||||
|
||||
+82
-25
@@ -43,7 +43,11 @@
|
||||
const clearingOf = (h) => h.clearing || (cadetOf(h) && !IGNORE[cadetOf(h)] ? (cadetOf(h) === "Left them to it" ? "Walk away" : "Help your squadmate") : null);
|
||||
const DECISIONS = {
|
||||
company: ["Alone", "1 Squadmate", "2 Squadmates"],
|
||||
// entering with squadmates, you can later leave them and go on alone
|
||||
leave: ["Stay together", "Leave them"],
|
||||
direction: ["East", "West", "Center"],
|
||||
// how you react when the first dragon appears (the form's categories; which ones are offered depends on the dragon)
|
||||
react: ["Hold still", "Respect / face it", "Retreat / run", "Hide", "Weapon", "Meet its gaze", "Protect squadmate"],
|
||||
cadet: ["Killed the bullies yourself", "Squadmate's revenge", "Left bullies to the dragons",
|
||||
"Tourniquet", "Left injured cadet", "Took their weapons", "Left them to it"],
|
||||
// the cadet encounter, in the game's own order: the scream, then (if you investigate) the clearing, then the
|
||||
@@ -58,11 +62,13 @@
|
||||
post: ["Forest", "West", "East"],
|
||||
hour: ["Tree", "Valley"],
|
||||
descend: ["Quickly (Red)", "Slowly (two Greens)"],
|
||||
// descending quickly puts you above a Red: jump onto it, or let it pass and go on to the two Greens
|
||||
red: ["Jump onto the Red", "Let it pass (two Greens)"],
|
||||
valley: ["Face the Red", "Pass the Red (meadow)"],
|
||||
encounter: ["Attempt the bond", "Die on purpose"],
|
||||
};
|
||||
const LABEL = {
|
||||
company: "Company", direction: "First direction", fs: "First dragon", dieSight: "Survive the first dragon",
|
||||
company: "Company", leave: "Your squadmates", direction: "First direction", react: "Facing the first dragon", red: "The Red below the tree", fs: "First dragon", dieSight: "Survive the first dragon",
|
||||
cadet: "Cadet encounter", scream: "The scream", clearing: "The clearing (your squadmate vs two bullies)",
|
||||
fight: "The fight: your first move", dagger: "The smaller cadet's dagger", fate: "The bullies' fate", wounded: "The wounded cadet", dieCombat: "Survive the fight", post: "Fork in the road", dieHour: "Survive the hour",
|
||||
hour: "After an hour", shadow: "Shadow at the tree", shadowColour: "Shadow dragon", descend: "Climb down",
|
||||
@@ -75,6 +81,8 @@
|
||||
const NO_DAGGER = "(no dagger choice)";
|
||||
// the fight moves in a history; a run that charged straight in never faces the dagger
|
||||
const daggerAfter = (fight, dagger) => (fight == null ? null : fight === "Pause to assess" ? dagger || null : NO_DAGGER);
|
||||
const ALONE = "(alone)";
|
||||
const leftOf = (h) => (h.company === "Alone" ? ALONE : h.left || null);
|
||||
const encColour = (ctx) => (ctx === "tree-Greens" ? "Green" : ctx.split("-")[1]);
|
||||
|
||||
/** The colour (or colours) a rider's stated goal commits them to, for deciding whether an attempt was genuine. */
|
||||
@@ -94,6 +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;
|
||||
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;
|
||||
const res = r.resolution;
|
||||
@@ -118,7 +128,12 @@
|
||||
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)"; v.encCtx = "tree-Red"; }
|
||||
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 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"; }
|
||||
@@ -142,8 +157,8 @@
|
||||
|
||||
// ctx: earlier variables the probability may depend on, most important first. Back-off drops from the end.
|
||||
const CHANCE = {
|
||||
fs: { cats: ["Red", "Brown", "Green", "Orange"], ctx: ["direction", "company"], get: (v) => v.fs },
|
||||
dieSight: { cats: ["die", "live"], ctx: ["fs", "direction", "company"], get: (v) => (v.fs ? (v.diedSight ? "die" : "live") : null) },
|
||||
fs: { cats: ["Red", "Brown", "Green", "Orange"], ctx: ["direction", "company", "left"], get: (v) => v.fs },
|
||||
dieSight: { cats: ["die", "live"], ctx: ["fs", "direction", "company", "left", "react"], get: (v) => (v.fs ? (v.diedSight ? "die" : "live") : null) },
|
||||
dieCombat: { cats: ["die", "live"], ctx: ["fight", "dagger", "fs", "direction"], get: (v) => (v.help ? (v.diedCombat ? "die" : "live") : null) },
|
||||
dieHour: { cats: ["die", "live"], ctx: ["cadet", "post"], get: (v) => (v.survivedCadets ? (v.diedHour ? "die" : "live") : null) },
|
||||
shadow: { cats: ["yes", "no"], ctx: ["cadet", "post", "fs", "direction", "company"], get: (v) => (v.shadow === undefined ? null : v.shadow ? "yes" : "no") },
|
||||
@@ -309,6 +324,7 @@
|
||||
function solve(params, X, { lam = 0, support = DECISIONS, record = false, only = null } = {}) {
|
||||
// only: bond only at these encounters (e.g. ["meadow-Blue"]); everywhere else the rider dies on purpose
|
||||
const encOptions = (ctx) => (only && !only.includes(ctx) ? ["Die on purpose"] : support.encounter);
|
||||
const reactOptions = (fs) => support["react:" + fs] || DECISIONS.react;
|
||||
const score = (v) => (1 - lam) * v.x - lam * v.o + 1e-9 * v.x - 1e-12 * v.o;
|
||||
const memo = new Map();
|
||||
const choices = new Map();
|
||||
@@ -341,7 +357,9 @@
|
||||
});
|
||||
const tree = (h) => mix(params.chance("shadow", h), (s) => s === "yes"
|
||||
? mix(params.chance("shadowColour", h), (c) => encounter({ ...h, shadow: "yes" }, "shadow-" + c))
|
||||
: best("descend", { ...h, shadow: "no" }, support.descend, (o) => encounter({ ...h, shadow: "no", descend: o }, o.startsWith("Quickly") ? "tree-Red" : "tree-Greens")));
|
||||
: best("descend", { ...h, shadow: "no" }, support.descend, (o) => o.startsWith("Quickly")
|
||||
? best("red", { ...h, shadow: "no", descend: o }, support.red, (rd) => encounter({ ...h, shadow: "no", descend: o, red: rd }, rd.startsWith("Jump") ? "tree-Red" : "tree-Greens"))
|
||||
: encounter({ ...h, shadow: "no", descend: o }, "tree-Greens")));
|
||||
const valley = (h) => best("valley", h, support.valley, (o) => o === "Face the Red"
|
||||
? encounter({ ...h, valley: o }, "valley-Red")
|
||||
: mix(params.chance("meadow", h), (c) => encounter({ ...h, valley: o, meadow: c }, "meadow-" + c)));
|
||||
@@ -360,12 +378,16 @@
|
||||
: combat({ ...h2, fight: f, dagger: NO_DAGGER }));
|
||||
});
|
||||
});
|
||||
// the first dragon: which one appears (chance), how you react (decision), whether you survive (chance).
|
||||
// Leaving your squadmates and your reaction only matter here, so the rest of the history leaves them out.
|
||||
const sighting = (h) => mix(params.chance("fs", h), (c) => {
|
||||
const h2 = { ...h, fs: c };
|
||||
return mix(params.chance("dieSight", h2), (s) => (s === "die" ? die() : cadet(h2)));
|
||||
const h2 = { ...h, fs: c }, rest = { company: h.company, direction: h.direction, fs: c };
|
||||
return best("react", h2, reactOptions(c), (re) =>
|
||||
mix(params.chance("dieSight", { ...h2, react: re }), (s) => (s === "die" ? die() : cadet(rest))));
|
||||
});
|
||||
const root = best("company", {}, support.company, (c) =>
|
||||
best("direction", { company: c }, support.direction, (d) => sighting({ company: c, direction: d })));
|
||||
const company = (c, f) => (c === "Alone" ? f({ company: c, left: ALONE }) : best("leave", { company: c }, support.leave, (l) => f({ company: c, left: l })));
|
||||
const root = best("company", {}, support.company, (c) => company(c, (hc) =>
|
||||
best("direction", hc, support.direction, (d) => sighting({ ...hc, direction: d }))));
|
||||
|
||||
memo.clear(); // the values are no longer needed; posterior draws keep only their choices
|
||||
const decide = (name, h) => choices.get(name + "@" + JSON.stringify(h));
|
||||
@@ -399,7 +421,9 @@
|
||||
});
|
||||
const tree = (h) => mix(params.chance("shadow", h), (s) => s === "yes"
|
||||
? mix(params.chance("shadowColour", h), (c) => encounter({ ...h, shadow: "yes" }, "shadow-" + c))
|
||||
: pick("descend", { ...h, shadow: "no" }, (o) => encounter({ ...h, shadow: "no", descend: o }, o.startsWith("Quickly") ? "tree-Red" : "tree-Greens")));
|
||||
: pick("descend", { ...h, shadow: "no" }, (o) => o.startsWith("Quickly")
|
||||
? pick("red", { ...h, shadow: "no", descend: o }, (rd) => encounter({ ...h, shadow: "no", descend: o, red: rd }, rd.startsWith("Jump") ? "tree-Red" : "tree-Greens"))
|
||||
: encounter({ ...h, shadow: "no", descend: o }, "tree-Greens")));
|
||||
const valley = (h) => pick("valley", h, (o) => o === "Face the Red"
|
||||
? encounter({ ...h, valley: o }, "valley-Red")
|
||||
: mix(params.chance("meadow", h), (c) => encounter({ ...h, valley: o, meadow: c }, "meadow-" + c)));
|
||||
@@ -419,10 +443,11 @@
|
||||
});
|
||||
});
|
||||
const sighting = (h) => mix(params.chance("fs", h), (c) => {
|
||||
const h2 = { ...h, fs: c };
|
||||
return mix(params.chance("dieSight", h2), (s) => (s === "die" ? ZERO : cadet(h2)));
|
||||
const h2 = { ...h, fs: c }, rest = { company: h.company, direction: h.direction, fs: c };
|
||||
return pick("react", h2, (re) => mix(params.chance("dieSight", { ...h2, react: re }), (s) => (s === "die" ? ZERO : cadet(rest))));
|
||||
});
|
||||
return pick("company", {}, (c) => pick("direction", { company: c }, (d) => sighting({ company: c, direction: d })));
|
||||
const company = (c, f) => (c === "Alone" ? f({ company: c, left: ALONE }) : pick("leave", { company: c }, (l) => f({ company: c, left: l })));
|
||||
return pick("company", {}, (c) => company(c, (hc) => pick("direction", hc, (d) => sighting({ ...hc, direction: d }))));
|
||||
}
|
||||
|
||||
/* ---------- 5. The published policy tree ---------- */
|
||||
@@ -456,7 +481,9 @@
|
||||
({ type: "end", what: `encounter: ${ctx}`, outcomes: params.encounter(ctx) }));
|
||||
const tree = (h) => chance("shadow", params.chance("shadow", h), (s) => s === "yes"
|
||||
? chance("shadowColour", params.chance("shadowColour", h), (c) => encounter({ ...h, shadow: "yes" }, "shadow-" + c))
|
||||
: decision("descend", { ...h, shadow: "no" }, (o) => encounter({ ...h, shadow: "no", descend: o }, o.startsWith("Quickly") ? "tree-Red" : "tree-Greens")));
|
||||
: decision("descend", { ...h, shadow: "no" }, (o) => o.startsWith("Quickly")
|
||||
? decision("red", { ...h, shadow: "no", descend: o }, (rd) => encounter({ ...h, shadow: "no", descend: o, red: rd }, rd.startsWith("Jump") ? "tree-Red" : "tree-Greens"))
|
||||
: encounter({ ...h, shadow: "no", descend: o }, "tree-Greens")));
|
||||
const valley = (h) => decision("valley", h, (o) => o === "Face the Red"
|
||||
? encounter({ ...h, valley: o }, "valley-Red")
|
||||
: chance("meadow", params.chance("meadow", h), (c) => encounter({ ...h, valley: o, meadow: c }, "meadow-" + c)));
|
||||
@@ -476,10 +503,11 @@
|
||||
});
|
||||
});
|
||||
const sighting = (h) => chance("fs", params.chance("fs", h), (c) => {
|
||||
const h2 = { ...h, fs: c };
|
||||
return chance("dieSight", params.chance("dieSight", h2), (s) => (s === "die" ? end("incinerated at the first sighting") : cadet(h2)));
|
||||
const h2 = { ...h, fs: c }, rest = { company: h.company, direction: h.direction, fs: c };
|
||||
return decision("react", h2, (re) => chance("dieSight", params.chance("dieSight", { ...h2, react: re }), (s) => (s === "die" ? end("incinerated at the first sighting") : cadet(rest))));
|
||||
});
|
||||
return decision("company", {}, (c) => decision("direction", { company: c }, (d) => sighting({ company: c, direction: d })));
|
||||
const company = (c, f) => (c === "Alone" ? f({ company: c, left: ALONE }) : decision("leave", { company: c }, (l) => f({ company: c, left: l })));
|
||||
return decision("company", {}, (c) => company(c, (hc) => decision("direction", hc, (d) => sighting({ ...hc, direction: d }))));
|
||||
}
|
||||
|
||||
const quantile = (xs, q) => {
|
||||
@@ -495,6 +523,8 @@
|
||||
const bump = (k, o) => { n[k] = n[k] || {}; n[k][o] = (n[k][o] || 0) + 1; };
|
||||
for (const v of prepared) {
|
||||
for (const k of ["company", "direction", "cadet", "hour", "descend", "valley"]) if (v[k]) bump(k, v[k]);
|
||||
if (v.left && v.left !== ALONE) bump("leave", v.left);
|
||||
if (v.fs && v.react) bump("react:" + v.fs, v.react);
|
||||
if (v.post && v.post !== "(no fork)") bump("post", v.post);
|
||||
// the cadet encounter's steps, including riders killed in the fight (they chose to help)
|
||||
if (v.help || v.cadet) {
|
||||
@@ -509,12 +539,19 @@
|
||||
}
|
||||
}
|
||||
const s = { encounter: DECISIONS.encounter };
|
||||
for (const k of ["company", "direction", "cadet", "scream", "clearing", "fight", "dagger", "fate", "wounded", "post", "hour", "descend", "valley"])
|
||||
for (const k of ["company", "leave", "direction", "cadet", "scream", "clearing", "fight", "dagger", "fate", "wounded", "post", "hour", "descend", "valley"])
|
||||
{
|
||||
s[k] = DECISIONS[k].filter((o) => ((n[k] || {})[o] || 0) >= min);
|
||||
// a step the data never record (e.g. the fight moves in an old export) is not restricted
|
||||
if (!s[k].length) s[k] = DECISIONS[k].slice();
|
||||
}
|
||||
// reactions to the first dragon, per dragon (each dragon offers its own options)
|
||||
for (const fs of ["Red", "Brown", "Green", "Orange"]) {
|
||||
const k = "react:" + fs, ok = DECISIONS.react.filter((o) => ((n[k] || {})[o] || 0) >= min);
|
||||
s[k] = ok.length ? ok : DECISIONS.react.slice();
|
||||
}
|
||||
// letting the Red pass is rarely logged, but its outcome is the two Greens' encounter, which has plenty of data
|
||||
s.red = DECISIONS.red.slice();
|
||||
return { support: s, counts: n };
|
||||
}
|
||||
|
||||
@@ -590,6 +627,9 @@
|
||||
fight: { "Pause to assess": /^pause to assess/, "Charge the smaller cadet": /^charge the other cadet/,
|
||||
"Charge between the bigger cadet and your squadmate": /^unsheathe your weapon/ },
|
||||
dagger: { "Engage the smaller cadet": /^engage the smaller cadet/, "Charge the bigger cadet anyway": /^daggers or not/ },
|
||||
react: { "Hold still": /hold still/, "Respect / face it": /in respect|turn to face it/, "Retreat / run": /^run and hope/,
|
||||
"Hide": /^hide/, "Meet its gaze": /meeting its gaze/ },
|
||||
red: { "Jump onto the Red": /^jump/, "Let it pass (two Greens)": /^reds are too hot tempered/ },
|
||||
};
|
||||
const norm = (t) => String(t || "").toLowerCase().replace(/[‘’']/g, "'").replace(/[–—-]/g, " ").replace(/[^a-z0-9'\s]/g, " ").replace(/\s+/g, " ").trim();
|
||||
|
||||
@@ -601,7 +641,9 @@
|
||||
function solverHistory(vars, seen = {}) {
|
||||
const h = {};
|
||||
if (DECISIONS.company.includes(vars.company)) h.company = vars.company;
|
||||
if (h.company && h.company !== "Alone" && vars.left_squadmates != null) h.left = vars.left_squadmates === true || vars.left_squadmates === "true" ? "Leave them" : "Stay together";
|
||||
if (DECISIONS.direction.includes(vars.direction)) h.direction = vars.direction;
|
||||
if (DECISIONS.react.includes(vars.sighting_action)) h.react = vars.sighting_action;
|
||||
if (["Red", "Brown", "Green", "Orange"].includes(vars.first_sighting)) h.fs = vars.first_sighting;
|
||||
if (vars.scream === "Ignore the scream") h.scream = "Keep walking";
|
||||
else if (vars.scream === "Investigate & help" || vars.scream === "Investigate & leave" || vars.scream_investigate) h.scream = "Investigate the scream";
|
||||
@@ -618,6 +660,7 @@
|
||||
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 (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";
|
||||
if (vars.branch === "Passed the Red: meadow") h.valley = "Pass the Red (meadow)";
|
||||
@@ -652,10 +695,14 @@
|
||||
*/
|
||||
function nextDecision(h) {
|
||||
if (!h.company) return ["company", {}];
|
||||
if (!h.direction) return ["direction", { company: h.company }];
|
||||
const left = leftOf(h);
|
||||
if (!left) return ["leave", { company: h.company }];
|
||||
if (!h.direction) return ["direction", { company: h.company, left }];
|
||||
if (!h.fs) return null;
|
||||
const a = { company: h.company, direction: h.direction, fs: h.fs };
|
||||
const sc = screamOf(h), cad = cadetOf(h);
|
||||
// a history past the first dragon without a recorded reaction: no advice is needed for it any more
|
||||
if (!h.react && !sc) return ["react", { company: h.company, left, direction: h.direction, fs: h.fs }];
|
||||
if (!sc) return ["scream", a];
|
||||
const h1 = { ...a, scream: sc };
|
||||
let c;
|
||||
@@ -686,7 +733,11 @@
|
||||
if (!h.shadow) return null;
|
||||
if (h.shadow === "yes") return h.shadowColour ? ["encounter", { ...d, shadow: "yes", enc: "shadow-" + h.shadowColour }] : null;
|
||||
if (!h.descend) return ["descend", { ...d, shadow: "no" }];
|
||||
return ["encounter", { ...d, shadow: "no", descend: h.descend, enc: h.descend.startsWith("Quickly") ? "tree-Red" : "tree-Greens" }];
|
||||
if (h.descend.startsWith("Quickly")) {
|
||||
if (!h.red) return ["red", { ...d, shadow: "no", descend: h.descend }];
|
||||
return ["encounter", { ...d, shadow: "no", descend: h.descend, red: h.red, enc: h.red.startsWith("Jump") ? "tree-Red" : "tree-Greens" }];
|
||||
}
|
||||
return ["encounter", { ...d, shadow: "no", descend: h.descend, enc: "tree-Greens" }];
|
||||
}
|
||||
if (!h.valley) return ["valley", d];
|
||||
if (h.valley === "Face the Red") return ["encounter", { ...d, valley: h.valley, enc: "valley-Red" }];
|
||||
@@ -715,12 +766,15 @@
|
||||
*/
|
||||
function step(h) {
|
||||
if (!h.company) return dec("company", {});
|
||||
if (!h.direction) return dec("direction", { company: h.company });
|
||||
const a0 = { company: h.company, direction: h.direction };
|
||||
const left = leftOf(h);
|
||||
if (!left) return dec("leave", { company: h.company });
|
||||
if (!h.direction) return dec("direction", { company: h.company, left });
|
||||
const a0 = { company: h.company, left, direction: h.direction };
|
||||
if (!h.fs) return cha("fs", a0);
|
||||
const a = { ...a0, fs: h.fs };
|
||||
const riskSight = params.chance("dieSight", a).die;
|
||||
const sc = screamOf(h), cad = cadetOf(h);
|
||||
if (!h.react && !sc) return dec("react", { ...a0, fs: h.fs });
|
||||
const riskSight = params.chance("dieSight", { ...a0, fs: h.fs, react: h.react || undefined }).die;
|
||||
const a = { company: h.company, direction: h.direction, fs: h.fs };
|
||||
if (!sc) return dec("scream", a, { risk: { label: "Killed at the first sighting", p: riskSight } });
|
||||
const h1 = { ...a, scream: sc };
|
||||
let c;
|
||||
@@ -756,7 +810,10 @@
|
||||
enc = "shadow-" + h.shadowColour; key = { ...d, shadow: "yes", enc };
|
||||
} else {
|
||||
if (!h.descend) return dec("descend", { ...d, shadow: "no" });
|
||||
enc = h.descend.startsWith("Quickly") ? "tree-Red" : "tree-Greens"; key = { ...d, shadow: "no", descend: h.descend, enc };
|
||||
if (h.descend.startsWith("Quickly")) {
|
||||
if (!h.red) return dec("red", { ...d, shadow: "no", descend: h.descend });
|
||||
enc = h.red.startsWith("Jump") ? "tree-Red" : "tree-Greens"; key = { ...d, shadow: "no", descend: h.descend, red: h.red, enc };
|
||||
} else { enc = "tree-Greens"; key = { ...d, shadow: "no", descend: h.descend, enc }; }
|
||||
}
|
||||
} else {
|
||||
if (!h.valley) return dec("valley", d);
|
||||
|
||||
Reference in New Issue
Block a user