The Black is not dice: developer statements, evidence report, and a plan that looks for the rule

- planner/knowledge.yaml: what the game's developer has said (paraphrased, dated, graded), what the Atlas does
  with each statement, and the open questions with the experiment that tests each.
- analysis/black/evidence.py -> analysis/reports/BLACK.md: counts from the runs. On the same recorded route the
  shadow shows on 21 of 79 first attempts and 1 of 80 later ones; no single route; Blue then Black after the shadow.
- game.yaml: the shadow is a guard (not a roll); what follows it is the Blue, then the Black; on-screen text for
  the squad's direction screen.
- planner/experiments.yaml v2: one exact path on every fresh account (fresh-replicate), then one choice changed
  at a time (fresh-ablate); shadow-again, second-attempt-same-path, veteran-repeat, veteran-variety; what the bot
  records about the account; the sequence to follow once the shadow shows.
- solver.js: assign() takes account facts, account offsets and cycled arms; recommendOption() answers the
  squad screen (stay + direction) in one pick.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jqCC2LZ4x1WHQ1V57nTsv
This commit is contained in:
ekcSchiano
2026-11-16 15:24:03 +00:00
co-authored by Claude Fable 5.2
parent 51842e1aa9
commit d01ec46fcc
19 changed files with 1588 additions and 231 deletions
+31 -6
View File
@@ -308,6 +308,14 @@
return { index: i, decision: rec.decision, choice: o, propensity: 1 / on.length, margin: null, options: rec.options, reason: `${rec.label}: ${o} (mapping: 1 of ${on.length} at random)` };
}
}
// With squadmates, staying and the direction are one screen ("Go west with your squadmate", "Convince them to
// head east instead", "Leave your squadmate"): staying is answered with the direction that follows it.
if (rec.decision === "leave" && rec.choice === "Stay together") {
const then = adv.next({ ...h, leave: rec.choice });
const dp = then && then.decision === "direction" ? ((adv.game.bot_text || {}).direction || {})[then.choice] : null;
const di = dp ? texts.findIndex((t) => new RegExp(dp).test(t)) : -1;
if (di >= 0) return { index: di, decision: "leave", choice: rec.choice, also: { direction: then.choice }, propensity: rec.propensity * then.propensity, margin: null, options: rec.options, reason: `${rec.label}: ${rec.choice}, ${then.label}: ${then.choice}` };
}
const pat = pats[rec.choice];
const idx = pat ? texts.findIndex((t) => new RegExp(pat).test(t)) : -1;
const values = Object.values(rec.options).map((v) => v.pX).sort((a, b) => b - a);
@@ -362,18 +370,22 @@
return arms[order[n % k]];
}
/**
* What an attempt is for, under the plan: assign(plan, { accountSeq, attempt }) ->
* What an attempt is for, under the plan: assign(plan, { accountSeq, attempt, facts }) ->
* { experimentId, arm, fix, target, objective, sampling, seed, propensity, burn, planId }, or null when no
* experiment covers the attempt (use the account's own goal).
* accountSeq: the account's number in the order the accounts were made (0, 1, 2, ...), the same for its whole
* life; attempt: the account's attempt number (1 = its first threshing). The answer is the same every time for
* life; attempt: the account's attempt number (1 = its first threshing); facts: what the plan's `when` rules ask
* about the account, e.g. { sawShadowBefore: true }. The answer is the same every time for
* the same plan id, so a restart mid-attempt changes nothing. Pass the result to advisor():
* advisor(policy.samples.all, a.target, a.objective, { attempt, fix: a.fix, sampling: a.sampling, seed: a.seed })
* and log experimentId, arm, planId and the propensity on the run.
*/
function assign(plan, { accountSeq, attempt }) {
function assign(plan, { accountSeq, attempt, facts = {} }) {
const takes = (e) => !e.accounts || ((((accountSeq - (e.accounts.offset || 0)) % e.accounts.every) + e.accounts.every) % e.accounts.every) < e.accounts.take;
// when: facts about the account that must hold (a fact the bot does not pass counts as false)
const holds = (e) => Object.entries(e.when || {}).every(([k, v]) => (facts[k] == null ? false : facts[k]) === v);
let open = (plan.experiments || []).filter((e) => e.status === "running" && attempt >= e.attempts.from && (e.attempts.to == null || attempt <= e.attempts.to)
&& (!e.accounts || (accountSeq % e.accounts.every) < e.accounts.take));
&& takes(e) && holds(e));
if (!open.length) return null;
if (open.some((e) => e.exclusive)) open = open.filter((e) => e.exclusive); // an exclusive experiment takes its attempts whole
const total = open.reduce((s, e) => s + e.share, 0);
@@ -381,8 +393,21 @@
for (const e of open) { if (u < e.share) { exp = e; break; } u -= e.share; }
// the unit that is randomised: the account (one arm for life) or the attempt (blocks within the account)
// (accounts are counted among those the experiment takes, so its blocks stay balanced)
const nth = exp.accounts ? Math.floor(accountSeq / exp.accounts.every) * exp.accounts.take + (accountSeq % exp.accounts.every) : accountSeq;
const arm = exp.unit === "account" ? armFor(exp, nth) : armFor({ ...exp, seed: `${exp.seed || 0}|${accountSeq}` }, attempt - exp.attempts.from);
const off = exp.accounts ? (((accountSeq - (exp.accounts.offset || 0)) % exp.accounts.every) + exp.accounts.every) % exp.accounts.every : 0;
const nth = exp.accounts ? Math.floor(accountSeq / exp.accounts.every) * exp.accounts.take + off : accountSeq;
let arm = exp.unit === "account" ? armFor(exp, nth) : armFor({ ...exp, seed: `${exp.seed || 0}|${accountSeq}` }, attempt - exp.attempts.from);
// cycle: a different combination of these decisions on every attempt of the account, none repeated until all
// are used (the combinations are walked with a step that shares no factor with their number)
if (arm.cycle) {
const keys = Object.keys(arm.cycle), total = keys.reduce((n, k) => n * arm.cycle[k].length, 1);
const gcd = (a, b) => (b ? gcd(b, a % b) : a), h = hash(`${exp.seed || 0}|${exp.id}|${accountSeq}`);
let step = (h % total) || 1;
while (gcd(step, total) !== 1) step = (step % total) + 1;
let i = ((h >>> 8) + (attempt - exp.attempts.from) * step) % total;
const combo = {};
for (const k of keys) { combo[k] = arm.cycle[k][i % arm.cycle[k].length]; i = Math.floor(i / arm.cycle[k].length); }
arm = { id: keys.map((k) => `${k}=${combo[k]}`).join(" / "), fix: { ...arm.fix, ...combo } };
}
return { experimentId: exp.id, arm: arm.id, fix: arm.fix || null, target: exp.target, objective: exp.objective || "eventually",
sampling: exp.sampling || "best", seed: hash(`${plan.seed || 0}|${exp.id}|${accountSeq}|${attempt}`),
propensity: (exp.share / total) / exp.arms.length, burn: exp.burn || null, planId: plan.id };