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
+45 -7
View File
@@ -19,6 +19,7 @@ import hashlib
import itertools
import json
import random
import re
import sys
from pathlib import Path
@@ -47,10 +48,31 @@ def check_options(where, fixed):
raise ValueError(f"{where}: '{k}' has no option '{o}' (game.yaml: {model.DECISIONS[k]})")
def arms(exp):
"""Every combination of the factors, each with the route held on every arm."""
def arms(exp, routes=None):
"""The arms of an experiment, each with the decisions it holds (`fix`): every combination of the factors, or
the explicit `arms` (one `change` to the route each), or a single arm. A `cycle` arm also carries the decisions
it varies from attempt to attempt."""
route = exp.get("route") or {}
if isinstance(route, str):
if route not in (routes or {}):
raise ValueError(f"{exp['id']}: unknown route '{route}'")
route = routes[route]
check_options(exp["id"] + " route", route)
if exp.get("arms"):
out = []
for a in exp["arms"]:
check_options(f"{exp['id']} arm {a['id']}", a.get("change"))
out.append({"id": a["id"], "change": a.get("change") or {}, "fix": {**route, **(a.get("change") or {})}})
if len({a["id"] for a in out}) != len(out):
raise ValueError(f"{exp['id']}: arm ids must be unique")
return out
if exp.get("cycle"):
for k, opts in exp["cycle"].items():
if k in route:
raise ValueError(f"{exp['id']}: '{k}' is both cycled and part of the route")
for o in opts:
check_options(exp["id"] + " cycle", {k: o})
return [{"id": "all", "fix": dict(route), "cycle": exp["cycle"]}]
factors = exp.get("factors") or {}
for k, opts in factors.items():
if k in route:
@@ -71,6 +93,11 @@ def validate(d):
if len(set(ids)) != len(ids):
raise ValueError("experiment ids must be unique")
for e in d["experiments"]:
if e.get("starts_after") and e["starts_after"] not in ids:
raise ValueError(f"{e['id']}: starts_after names no experiment")
for k in (e.get("when") or {}):
if k not in (d.get("record") or []):
raise ValueError(f"{e['id']}: when.{k} is not something the bot records (`record`)")
if e["target"] not in model.COLOURS:
raise ValueError(f"{e['id']}: unknown target {e['target']}")
if e.get("sampling", "best") not in SAMPLING:
@@ -117,14 +144,16 @@ def build(d=None, log=None):
d = d or design()
validate(d)
log = logged() if log is None else log
exps = []
exps, status_of = [], {}
for e in d["experiments"]:
m = e.get("measures")
a = arms(e)
a = arms(e, d.get("routes"))
tally = {x["id"]: {"runs": 0, "observed": 0, "rare": 0} for x in a}
for exp_id, arm, v in log:
if exp_id != e["id"]:
continue
if a[0].get("cycle"): # a cycled arm is logged under the combination it played: all one arm here
arm = a[0]["id"]
t = tally.setdefault(arm or "?", {"runs": 0, "observed": 0, "rare": 0})
t["runs"] += 1
y = model.OBSERVE[m["roll"]](v) if m and v else None
@@ -138,7 +167,9 @@ def build(d=None, log=None):
total_rare = sum(t["rare"] for t in tally.values())
status, note = "running", None
se = e.get("stop_early")
if not e.get("ongoing") and all(n >= planned for n in done.values()):
if e.get("starts_after") and status_of.get(e["starts_after"]) != "complete":
status, note = "waiting", f"starts when {e['starts_after']} is complete"
elif not e.get("ongoing") and all(n >= planned for n in done.values()):
status, note = "complete", f"every arm has its planned {planned}"
elif se and total_obs >= se["after"] and total_rare <= se["rare_at_most"]:
status = "paused"
@@ -146,18 +177,25 @@ def build(d=None, log=None):
for x in a:
t = tally[x["id"]]
x["progress"] = {**t, "planned": planned, **({"estimate": interval(t["rare"], t["observed"])} if m and t["observed"] else {})}
status_of[e["id"]] = status
exps.append({
"id": e["id"], "status": status, **({"note": note} if note else {}),
"question": e["question"], "attempts": {"from": e["attempts"]["from"], "to": e["attempts"].get("to")},
"unit": e["unit"], "share": e["share"], **({"accounts": e["accounts"]} if e.get("accounts") else {}),
**({"exclusive": True} if e.get("exclusive") else {}),
**({"when": e["when"]} if e.get("when") else {}),
"target": e["target"], "objective": e.get("objective", "eventually"), "sampling": e.get("sampling", "best"),
"seed": d["seed"], "measures": m, "burn": e.get("burn"), "arms": a,
"progress": {"runs": sum(t["runs"] for t in tally.values()), "observed": total_obs, "rare": total_rare,
**({"estimate": interval(total_rare, total_obs)} if m and total_obs else {}),
"unknownArms": sorted(k for k in tally if k not in {x["id"] for x in a})},
})
plan = {"schema": 1, "seed": d["seed"], "lifecycle": d["lifecycle"], "experiments": exps}
for s in (d.get("scripts") or {}).values():
for st in s:
for k in ("take", "never"):
re.compile(st.get(k) or "")
plan = {"schema": 2, "seed": d["seed"], "lifecycle": d["lifecycle"], "record": d.get("record") or [],
"scripts": d.get("scripts") or {}, "experiments": exps}
plan["id"] = hashlib.sha1(json.dumps(plan, sort_keys=True, separators=(",", ":")).encode()).hexdigest()[:12]
return plan
@@ -171,7 +209,7 @@ def summary(plan):
for e in plan["experiments"]:
p = e["progress"]
est = p.get("estimate")
L.append(f" {e['id']:<22} {e['status']:<9} {p['observed']} observed, {p['rare']} rare"
L.append(f" {e['id']:<26} {e['status']:<9} {p['observed']} observed, {p['rare']} rare"
+ (f" ({100 * est['rate']:.1f}%, 90% range {100 * est['lo']:.1f}-{100 * est['hi']:.1f})" if est else "")
+ (f" [{e['note']}]" if e.get("note") else ""))
return "\n".join(L)