Author SHA1 Message Date
ekcSchiano 75f11378e2 data: keep main's route model (Reddit comment runs are not a model source yet)
CI / test (pull_request) Successful in 2m13s
2026-11-19 09:45:17 -05:00
kathleenandClaude Opus 5.5 b82ef16a9f data: croissant checksum for the rebuilt runs_clean.csv
CI / test (pull_request) Successful in 2m2s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
2026-11-19 14:14:50 +00:00
kathleenandClaude Opus 5.5 e30825ec84 data: rebuild the Reddit comment runs with the game-rule checks from #37
CI / test (pull_request) Failing after 9s
6 of the 82 runs now carry rule flags (Brown/Red at the shadow, Green after
jumping on the Red, Red in the meadow, Orange first for Alone/Center, fight
answers on an ignored scream). Only their data_flags change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
2026-11-19 14:14:16 +00:00
kathleen 93dab0b963 Merge branch 'main' into data/reddit-comments
CI / test (pull_request) Failing after 1m22s
2026-11-19 14:10:13 +00:00
kathleen fdb603f5a4 Merge pull request 'Game-rule checks for runs answered through "Report a run"' (#37) from data/report-rule-checks into main
CI / test (push) Successful in 41s
2026-11-19 14:10:08 +00:00
kathleen e06fd46e15 Merge pull request 'Known answers for the bot: the guide's encounter answers and the bot's own results, by choice text' (#39) from atlas/known-answers into main
Send the route model to the bot / send (push) Successful in 7s
CI / test (push) Successful in 1m58s
2026-11-19 14:00:17 +00:00
kschianoandClaude Opus 5.5 0f4430f6f5 Game-rule checks for runs answered through "Report a run"
CI / test (pull_request) Successful in 2m0s
Reported and Reddit-comment runs now get the checks the community form
gets in core/atlas/coding.py, as data_flags (the run is kept):
- first dragon outside the documented pool for the company/direction
- a bond or burn by a dragon the encounter does not have (new
  encounter_colours table in core/spec/form.yaml; Orange/Brown after the
  two Greens allowed, as a Green's rescue)
- a Green on a valley run
- a cadet outcome off its scream path, fight answers or a post-fight path
  on a run that did not help, a second fight move without assessing
- died before the hour, yet reached the tree/valley or an encounter

planner/policy.yaml drop_flagged: flagged runs of sources read from free
text (reddit comment) stay out of the route model; provenance notes do not
count as flags. No effect today: the source is not in `sources` yet.

On the first 82 scraped runs: 6 flagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 08:46:57 -05:00
ekcSchianoandClaude Opus 5.5 e10312ab02 Known answers for the bot: the guide's encounter answers and the bot's own results, by choice text (#35)
CI / test (pull_request) Successful in 2m3s
analysis/known/build_known.py writes data/public/known_answers.json from pdf_encounters.json and tree.json;
solver.js knownAnswer(known, offered, { target, sceneColour }) matches a screen's choices against it (the guide's
paraphrases by their words, the bot's texts exactly) and returns a pick when one choice is clearly on the guide's
recommended path to the target, plus the evidence for every choice to hand to Clef. Rebuilt daily, checked in CI,
and sent to the bot with the route model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
2026-11-19 13:32:09 +00:00
15 changed files with 2677 additions and 21 deletions
+4 -3
View File
@@ -1,6 +1,6 @@
# When the route model changes on main, send it to the bot: open (or update) a pull request on the bot's repo,
# DragonKind/DragonKind, that replaces vendor/threshing-atlas/{policy.json,solver.js,graph.js} with this repo's
# data/public/policy.json, core/solver.js and core/graph.js. The three always travel together, so the policy and the
# DragonKind/DragonKind, that replaces vendor/threshing-atlas/{policy.json,solver.js,graph.js,known_answers.json} with
# this repo's data/public/policy.json, core/solver.js, core/graph.js and data/public/known_answers.json. They always travel together, so the policy and the
# solver that reads it never get out of step. Ken reviews and merges it; the running bot reloads the files after a pull.
#
# Secrets: ATLAS_BOT_TOKEN (repository: read and write, with write access to DragonKind/DragonKind).
@@ -12,6 +12,7 @@ on:
- data/public/policy.json
- core/solver.js
- core/graph.js
- data/public/known_answers.json
workflow_dispatch:
jobs:
send:
@@ -34,7 +35,7 @@ jobs:
GIT_CONFIG_VALUE_0="AUTHORIZATION: token $ATLAS_BOT_TOKEN"
git clone --quiet --depth 1 https://git.kenschiano.net/DragonKind/DragonKind.git "$dst"
mkdir -p "$dst/vendor/threshing-atlas"
cp data/public/policy.json core/solver.js core/graph.js "$dst/vendor/threshing-atlas/"
cp data/public/policy.json core/solver.js core/graph.js data/public/known_answers.json "$dst/vendor/threshing-atlas/"
id=$(python3 -c "import json; print(json.load(open('data/public/policy.json')).get('id', ''))")
sha=$(git rev-parse --short HEAD)
cd "$dst"
+131
View File
@@ -0,0 +1,131 @@
"""Known answers: what the Atlas knows about every answer the bot can be offered, for screens its other sources don't
cover (issue #35). The bot looks the screen's choices up here first (solver.js `knownAnswer`), and passes what it finds
to Clef as evidence when nothing is certain.
python analysis/known/build_known.py [--check] -> data/public/known_answers.json
Two sources, keyed by the answer text normalised exactly as the bot does (collection/etl/transform/bot.py normalize):
guide every answer in the community route PDF's encounter trees (data/public/pdf_encounters.json): the
encounter, how it ends there (or "continues"), the guide's rate, whether the guide marks it unconfirmed,
and `on_path`: the colours whose recommended path in the guide goes through it
bot every answer in the bot's screen tree (data/public/tree.json): times played, times it died straight
after, and the bonds the runs that took it ended in
"""
import argparse
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from collection.etl.transform.bot import normalize # noqa: E402
GUIDE = ROOT / "data/public/pdf_encounters.json"
TREE = ROOT / "data/public/tree.json"
OUT = ROOT / "data/public/known_answers.json"
# the colours each of the guide's encounters can end in a bond with (the two Greens can also end with an Orange or a
# Brown swooping in), and the encounter a colour's route continues to from there (the shadow leads on to the Black)
ENC_COLOURS = {"valley-Red": ["Red"], "tree-Red": ["Red"], "tree-Greens": ["Green", "Brown", "Orange"],
"meadow-Orange": ["Orange"], "meadow-Brown": ["Brown"], "meadow-Blue": ["Blue"],
"shadow": ["Black", "Blue"], "black": ["Black"]}
ONWARD = {("shadow", "Black"): "Black"}
def is_goal(end, colour, onward):
end = end or ""
if onward:
return end.startswith(f"On to the {onward}")
if not (end.startswith("Bonded") or "Bonded (" in end):
return False
return "(" not in end or colour in end
def leads_to(o, colour, onward):
if "end" in o:
return is_goal(o["end"], colour, onward)
return any(not c.get("roll") and leads_to(c, colour, onward) for c in o.get("then", []))
def guide_path(options, colour, onward):
"""The guide's recommended answers toward `colour` (the same walk as the page's encounter panel)."""
out, opts = [], options
while opts:
live = [o for o in opts if not o.get("roll")]
pick = next((o for o in live if o.get("best") and leads_to(o, colour, onward)), None) \
or next((o for o in live if leads_to(o, colour, onward)), None)
if not pick:
break
out.append(id(pick))
if "end" in pick:
break
opts = pick.get("then", [])
return out
def walk(options, enc, on_path, out):
"""Every answer of an encounter, with its colours (where it happens) and on_path (whose recommended path)."""
for o in options:
if o.get("roll"):
continue
entry = {"encounter": enc, "colours": ENC_COLOURS.get(enc, []), "end": o.get("end", "continues")}
if o.get("pct"):
entry["pct"] = o["pct"]
if o.get("best"):
entry["best"] = True
if o.get("unconfirmed"):
entry["unconfirmed"] = True
cols = sorted(c for c, ids in on_path.items() if id(o) in ids)
if cols:
entry["on_path"] = cols
for text in [s.strip() for s in o["say"].split(", or ")]: # "Jump on its back, or jump to land…"
out.setdefault(normalize(text), {"text": text, "guide": []})["guide"].append(entry)
walk(o.get("then", []), enc, on_path, out)
def build():
g = json.loads(GUIDE.read_text(encoding="utf-8"))
out = {}
for enc, E in g["encounters"].items():
on_path = {c: set(guide_path(E["options"], c, ONWARD.get((enc, c)))) for c in ENC_COLOURS.get(enc, [])}
walk(E["options"], enc, on_path, out)
t = json.loads(TREE.read_text(encoding="utf-8")) if TREE.exists() else {"screens": {}}
for sc in t["screens"].values():
for o in sc["options"].values():
if not o.get("n"):
continue
k = normalize(o["text"])
e = out.setdefault(k, {"text": o["text"], "guide": []})
b = e.setdefault("bot", {"n": 0, "died": 0, "bonded": {}})
b["n"] += o["n"]
for dest, d in o.get("to", {}).items():
if dest == "DIED":
b["died"] += d["n"]
elif dest.startswith("BONDED:"):
c = dest.split(":", 1)[1]
b["bonded"][c] = b["bonded"].get(c, 0) + d["n"]
for e in out.values():
if not e["guide"]:
del e["guide"]
src = g["source"]
return {"schema": 1, "guide": {"title": src["title"], "version": src["version"], "link": src["link"]},
"bot": {"runs": (t.get("builtFrom") or {}).get("runs")}, "answers": dict(sorted(out.items()))}
def main(argv=None):
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--check", action="store_true")
a = ap.parse_args(argv)
text = json.dumps(build(), ensure_ascii=False, indent=1) + "\n"
if a.check:
if not OUT.exists() or OUT.read_text(encoding="utf-8") != text:
print(f"{OUT.relative_to(ROOT)} is out of date (run python analysis/known/build_known.py)", file=sys.stderr)
return 1
return 0
OUT.write_text(text, encoding="utf-8")
print(f"wrote {OUT.relative_to(ROOT)}")
return 0
if __name__ == "__main__":
sys.exit(main())
+1
View File
@@ -87,6 +87,7 @@ def rebuild():
_step("experiment plan", [py, "planner/build_experiments.py"])
_step("what the runs show about the Black", [py, "analysis/black/evidence.py"])
_step("screen tree", [py, "analysis/tree/build_tree.py"])
_step("known answers for the bot (guide + screen tree)", [py, "analysis/known/build_known.py"])
try:
import scipy # noqa: F401
_step("statistics", [py, "analysis/stats/site_stats.py"])
+52
View File
@@ -191,11 +191,63 @@ def answers_row(run_id, source, date, answers, flags=None):
row["saw_blue_meadow"] = True
if row["outcome"] == "Bonded" and not row["outcome_color"]:
flags.append("bonded, colour not given")
flags += rule_flags(row)
encounter_columns(row)
row["data_flags"] = "; ".join(flags)
return row
# the scream answer each cadet outcome follows (a run cannot end the encounter on another path)
CADET_PATH = {
"Killed the bullies yourself": "Investigate & help", "Squadmate's revenge": "Investigate & help",
"Left bullies to the dragons": "Investigate & help", "DIED in combat": "Investigate & help",
"Tourniquet": "Ignore the scream", "Left injured cadet": "Ignore the scream", "Took their weapons": "Ignore the scream",
"Left them to it": "Investigate & leave",
}
REACHED = ("Tree", "Valley")
@functools.lru_cache(maxsize=1)
def _form_rules():
from atlas import spec as atlas_spec
f = atlas_spec.form()
return f["sighting_pool"], {k: set(v) for k, v in f["encounter_colours"].items()}
def rule_flags(row):
"""The game's own rules, for runs answered through "Report a run": the checks core/atlas/coding.py makes on
the community form (first-dragon pools, Greens in the valley) plus the encounter's dragons and the cadet path.
Each broken rule is a flag; the run is kept."""
pools, enc_colours = _form_rules()
flags = []
company, direction, first = row["company"], row["direction"], row["first_sighting"]
if company in pools and direction in pools[company] and first in COLOURS:
pool = list(pools[company][direction]) + (list(pools["Alone"][direction]) if row["left_squadmates"] is True else [])
if first not in pool:
flags.append(f"first sighting {first} not in documented pool for {company}/{direction}")
colour, branch = row["outcome_color"], row["branch"]
if row["outcome"] in ("Bonded", "Incinerated") and colour:
if branch in enc_colours and colour not in enc_colours[branch]:
flags.append(f"{colour} at the {branch} encounter, which has only {'/'.join(sorted(enc_colours[branch]))}")
if row["hour"] == "Valley" and colour == "Green":
flags.append("Green recorded on a Valley run (no Greens in the valley)")
scream, res = row["scream"], row["resolution"]
if scream in ("Investigate & help", "Ignore the scream", "Investigate & leave"):
if res in CADET_PATH and CADET_PATH[res] != scream:
flags.append(f"cadet outcome {res!r} does not follow {scream!r}")
if scream != "Investigate & help" and (row["combat_first"] not in (None, "(not recorded)")
or row["combat_second"] not in (None, "(not recorded)")):
flags.append("fight answers on a run that did not help")
if scream != "Investigate & help" and row["post_path"] in ("Forest", "West", "East"):
flags.append("a path after the fight on a run without a fight")
if row["combat_second"] not in (None, "(not recorded)") and row["combat_first"] != "Assess the situation":
flags.append("a second fight move without pausing to assess")
died_early = (scream or "").startswith("DIED") or (res or "").startswith("DIED")
if died_early and (row["hour"] in REACHED or row["outcome"] in ("Bonded", "Incinerated")):
flags.append("died before the hour, yet reached the tree, the valley or a bonding encounter")
return flags
def _norm(text):
from .transform.bot import normalize
return normalize(text)
+64 -1
View File
@@ -15,6 +15,9 @@
* shadow odds), `fix` (hold some decisions to given options: an experiment arm) and sampling "uniform" (mapping);
* assign(plan, { accountSeq, attempt }) reads the experiment plan (experiments.json) and says what an attempt is for;
* screenPick(tree, sceneId, offered, { mode }) picks from the screen tree (tree.json): least-tried, or Thompson.
* knownAnswer(known, offered, { target, sceneColour }) looks a screen's choices up in known_answers.json (the guide's
* encounter answers and the bot's own results) for screens nothing else covers: a pick when the evidence is clear,
* and the evidence for every choice either way, to hand to Clef (issue #35).
* UMD: window.ThreshSolver in the browser, module.exports in Node. No dependencies.
*/
(function (root, factory) {
@@ -446,8 +449,68 @@
reason: mode === "thompson" ? `survived ${pick.survived} of ${pick.n} so far` : `played ${pick.n} times, the fewest on this screen` };
}
/* ---------- known answers (analysis/known/build_known.py -> data/public/known_answers.json) ---------- */
const STOP = new Set("a an the to and or of your you its it is for at in on with this that be".split(" "));
const words = (t) => norm(t).split(" ").filter((w) => w && !STOP.has(w));
/** The guide labels a game text carries: the guide paraphrases ("Touch its talon"), the game says it in full ("Reach a
* hand slowly to touch its talon"), so a label matches when every word of it that matters is in the text. Labels of
* fewer than two such words ("Is your dragon") only match a text that is exactly the label. */
function guideMatches(known, text) {
const n = norm(text), have = new Set(words(text)), out = [];
for (const [k, e] of Object.entries(known.answers || {})) {
if (!e.guide) continue;
const w = words(e.text);
const exact = k === n;
if (exact || (w.length >= 2 && w.every((x) => have.has(x)))) e.guide.forEach((g) => out.push({ ...g, label: e.text, exact }));
}
return out;
}
/**
* A screen nothing else covers: what the Atlas knows about each choice, and a pick when it is clear.
* known data/public/known_answers.json
* offered the choice texts on screen, in order
* target the colour the account is after ("Blue"); sceneColour: the colour of this scene's dragon, if the
* bot knows it (only the guide's answers for that dragon's encounters are used then)
* Returns { pick, confidence, reason, choices }: pick is the index to take (null if nothing is clear), confidence
* "strong" (exactly one choice is on the guide's recommended path toward the target, and the bot's own runs don't
* contradict it) or "weak" (several fit, or only the bot's own record speaks for it). choices[i].verdict is "good",
* "bad" (the guide ends it in incineration, or the bot died on it at least 3 times in 4) or "unknown", with the
* evidence behind it. Anything weak or unknown goes to Clef with this evidence; a pick never skips the bot's guard.
*/
function knownAnswer(known, offered, { target, sceneColour = null } = {}) {
const T = target ? target[0].toUpperCase() + target.slice(1).toLowerCase() : null;
const choices = offered.map((text, index) => {
const e = (known.answers || {})[norm(text)] || {};
const bot = e.bot || null;
const guide = guideMatches(known, text).filter((g) => !sceneColour || (g.colours || []).includes(sceneColour));
const onPath = guide.filter((g) => T && (g.on_path || []).includes(T));
const botBad = bot && bot.n >= 2 && bot.died / bot.n >= 0.75;
const botGood = bot && bot.n >= 3 && bot.died === 0;
const guideBad = guide.length > 0 && guide.every((g) => /^Incinerated/.test(g.end));
const verdict = onPath.length && !botBad ? "good" : guideBad || botBad ? "bad" : "unknown";
return { index, text, verdict, guide, bot, onPath: onPath.length > 0, botGood: !!botGood };
});
const good = choices.filter((c) => c.verdict === "good");
let pick = null, confidence = null, reason = "nothing the Atlas knows covers these choices";
if (good.length === 1) {
pick = good[0].index; confidence = "strong";
reason = `on the guide's recommended path to the ${T} ("${good[0].onPath && good[0].guide.find((g) => (g.on_path || []).includes(T)).label}")`;
} else if (good.length > 1) {
const best = good.find((c) => c.botGood) || good[0];
pick = best.index; confidence = "weak"; reason = `${good.length} choices are on the guide's paths; the bot's record favours none clearly`;
} else {
const safe = choices.filter((c) => c.botGood && c.verdict !== "bad");
if (safe.length) {
const b = safe.reduce((x, y) => (y.bot.n > x.bot.n ? y : x));
pick = b.index; confidence = "weak"; reason = `the bot got through it ${b.bot.n} of ${b.bot.n} times`;
}
}
return { pick, confidence, reason, choices };
}
return Object.assign(api, {
advisor, recommendOption, solverHistory, norm, assign, armFor, givenFor, screenPick,
advisor, recommendOption, solverHistory, norm, assign, armFor, givenFor, screenPick, knownAnswer,
makeParams: (T, { alphas, game } = {}) => makeParams(T, { alphas, game: game || api.game }),
/** remember the game of a policy sample (sets ENCOUNTERS) without solving anything */
useGame(sample) { api.game = sample.model.game; api.ENCOUNTERS = api.game.by_colour; return api.game; },
+11
View File
@@ -153,6 +153,17 @@ sighting_pool:
1 Squadmate: { East: [Green, Orange, Red], West: [Red, Brown, Green], Center: [Red, Brown] }
2 Squadmates: { East: [Red, Orange], West: [Green, Brown, Red], Center: [Red, Brown] }
# The dragons each bonding encounter can end with (bond or burn), from the community PDF. Only used to FLAG runs
# answered through "Report a run" (reported, reddit comment) that end with a dragon the encounter does not have.
# Orange and Brown after the two Greens: a Green's rescue, then the Orange or Brown.
encounter_colours:
"Shadow (rare)": [Blue, Black]
"Descend quickly: Red": [Red]
"Descend quickly: let the Red pass": [Green]
"Descend slowly: two Greens": [Green, Orange, Brown]
"Valley Red": [Red]
"Passed the Red: meadow": [Orange, Brown, Blue]
# First-sighting answers that are not a single colour: coded as this colour, and the row is flagged with the
# original answer (data_flags), so nothing is lost.
first_sighting_alias:
+4 -4
View File
@@ -93,8 +93,8 @@
"description": "Every run from every source, one per row, coded into the same columns (collection/etl/runs.py; the form's rules are core/spec/form.yaml). The `source` column says where each run came from.",
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/runs_clean.csv",
"encodingFormat": "text/csv",
"sha256": "c4bdba6736380ed0f066ffaffe0d40adeb8eee034fbb170bc31062b982872c28",
"contentSize": "3747530 B"
"sha256": "657da20e614160d2a44d8854937270c7867fb9ae470509de1e12516f07d2af23",
"contentSize": "3748021 B"
},
{
"@type": "cr:FileObject",
@@ -153,8 +153,8 @@
"description": "The route model: the game (core/spec/game.yaml), the count tables behind every roll, and the best decision tree for every dragon colour under two goals, with posterior intervals (planner/build_policy.py).",
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/policy.json",
"encodingFormat": "application/json",
"sha256": "7af3f5ec0c23fc3067979b03bb030a1ecbbfb88ed2b41cc49d5995e246f3b611",
"contentSize": "987412 B"
"sha256": "f65aaebb23cb3f56dad0387a94113857eb44c4ba077cfe5fc6215c202546588c",
"contentSize": "987411 B"
},
{
"@type": "cr:FileObject",
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -9599,7 +9599,7 @@ comment-pdjiliu,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked
comment-pdjjp1e,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,True,Unknown,Unknown,Unknown,Investigate & help,Squadmate's revenge,(not recorded),(not recorded),Unknown,Tree,Descend slowly: two Greens,,Incinerated,,,,,Incinerated,Green,,,False,(not asked),(not asked),Daggertail,"read from a Reddit comment automatically, not checked by hand",,
comment-pdjq69x,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Ignore the scream,Tourniquet,(not recorded),(not recorded),Unknown,DIED before the hour,,,,,,,,Died before the hour,,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdjr7gm,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Investigate & help,Squadmate's revenge,(not recorded),(not recorded),Unknown,Valley,Passed the Red: meadow,,,,Bonded!,,,Bonded,Brown,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdjwbor,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Hold still,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Descend quickly: Red,,Bonded!,,,,,Bonded,Green,,,False,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdjwbor,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Hold still,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Descend quickly: Red,,Bonded!,,,,,Bonded,Green,,,False,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand; Green at the Descend quickly: Red encounter, which has only Red",,
comment-pdk7mvv,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Ignore the scream,Tourniquet,(not recorded),(not recorded),Unknown,Unknown,,Bonded!,,,,,,Bonded,Red,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdk9i0o,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Ignore the scream,Took their weapons,(not recorded),(not recorded),Unknown,Unknown,,,,,,Incinerated,,Incinerated,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdkgyrf,reddit comment,,,2026-10-03,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Descend slowly: two Greens,,,Bonded!,,,,Bonded,Orange,,,False,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
@@ -9625,7 +9625,7 @@ comment-pdtu6ls,reddit comment,,,2026-10-04,Unknown,,Unknown,1,First attempt,(no
comment-pdtv0ow,reddit comment,,,2026-10-04,Unknown,,Unknown,2,Later attempt,(not asked/blank),Alone,,West,Green,Unknown,Investigate & help,Unknown,(not recorded),(not recorded),Unknown,Unknown,,,,,Bonded!,,,Bonded,Brown,,,,(not asked),(not asked),Swordtail,"read from a Reddit comment automatically, not checked by hand",,
comment-pduqz9x-1,reddit comment,,,2026-10-04,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,West,Unknown,Unknown,Investigate & help,Unknown,(not recorded),(not recorded),Unknown,Unknown,,,,,,Incinerated,,Incinerated,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pduqz9x-2,reddit comment,,,2026-10-04,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,West,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Valley,,,,,,Incinerated,,Incinerated,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdvkjqs,reddit comment,,,2026-10-04,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,Bonded!,,,Bonded,Brown,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pdvkjqs,reddit comment,,,2026-10-04,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,Bonded!,,,Bonded,Brown,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand; Brown at the Shadow (rare) encounter, which has only Black/Blue",,
comment-pe0gyqi,reddit comment,,,2026-10-05,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Center,Red,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Unknown,,Incinerated,,,,,,Incinerated,Red,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pe0id6k,reddit comment,,,2026-10-05,Unknown,,Unknown,,Unknown,(not asked/blank),Alone,,Center,Red,Meet its gaze,Investigate & help,Squadmate's revenge,Assess the situation,(not recorded),West,Unknown,,,,,Bonded!,,,Bonded,Brown,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pe0kwol,reddit comment,,,2026-10-05,Unknown,,Unknown,,Unknown,(not asked/blank),Alone,,West,Unknown,Unknown,Investigate & help,Squadmate's revenge,(not recorded),(not recorded),Forest,Tree,,,,,,,Bonded!,Bonded,Black,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
@@ -9640,12 +9640,12 @@ comment-pe5o1sx,reddit comment,,,2026-10-06,Unknown,,Unknown,,Unknown,(not asked
comment-pe9z1u1,reddit comment,,,2026-10-06,Unknown,,Unknown,2,Later attempt,(not asked/blank),Alone,,Center,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Unknown,,,,,Bonded!,,,Bonded,Brown,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pea2ha6,reddit comment,,,2026-10-06,Unknown,,Unknown,,Unknown,(not asked/blank),Alone,,Center,Unknown,Unknown,Ignore the scream,Unknown,(not recorded),(not recorded),Unknown,Unknown,,,,,,Bonded!,,Bonded,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pec5k9m,reddit comment,,,2026-10-07,Unknown,,Unknown,1,First attempt,(not asked/blank),Alone,,West,Unknown,Unknown,Unknown,Unknown,Even the numbers (smaller cadet),(not recorded),West,Unknown,,,,,,Incinerated,,Incinerated,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pecco10,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,Blue,Alone,,Center,Orange,Unknown,Investigate & help,Unknown,Assess the situation,(not recorded),Unknown,Unknown,,,,,,Bonded!,,Bonded,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-peckg7u,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,Bonded!,,,Bonded,Brown,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pecco10,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,Blue,Alone,,Center,Orange,Unknown,Investigate & help,Unknown,Assess the situation,(not recorded),Unknown,Unknown,,,,,,Bonded!,,Bonded,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand; first sighting Orange not in documented pool for Alone/Center",,
comment-peckg7u,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,Bonded!,,,Bonded,Brown,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand; Brown at the Shadow (rare) encounter, which has only Black/Blue",,
comment-pefrzyp,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Center,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Valley,,Bonded!,,,,,,Bonded,Red,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-peg9ove,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,(not asked/blank),2 Squadmates,,Center,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Unknown,,Bonded!,,,,,,Bonded,Red,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pei8c2d,reddit comment,,,2026-10-07,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,East,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Valley,,,,Bonded!,,,,Bonded,Orange,,,,(not asked),(not asked),Scorpiontail,"read from a Reddit comment automatically, not checked by hand",,
comment-pekeccv,reddit comment,,,2026-10-08,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Center,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Valley,Passed the Red: meadow,Incinerated,,,,,,Incinerated,Red,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pekeccv,reddit comment,,,2026-10-08,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Center,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Valley,Passed the Red: meadow,Incinerated,,,,,,Incinerated,Red,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand; Red at the Passed the Red: meadow encounter, which has only Blue/Brown/Orange",,
comment-pemrjhj,reddit comment,,,2026-10-08,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Descend slowly: two Greens,,Incinerated,,,,,Incinerated,Green,,,False,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-peuv3i2,reddit comment,,,2026-10-09,Unknown,,Unknown,,Unknown,Blue,Alone,,West,Unknown,Unknown,Investigate & help,Unknown,Assess the situation,Engage the smaller cadet,Forest,Valley,Passed the Red: meadow,,,Bonded!,,,,Bonded,Orange,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-pev3uge,reddit comment,,,2026-10-09,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Investigate & help,Killed the bullies yourself,(not recorded),(not recorded),Unknown,Valley,Passed the Red: meadow,,,,,Incinerated,,Incinerated,Blue,,True,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
@@ -9668,7 +9668,7 @@ comment-pgzz9hc,reddit comment,,,2026-10-15,Unknown,,Unknown,,Unknown,(not asked
comment-ph1hedk,reddit comment,,,2026-10-16,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,,,Bonded!,Bonded,Black,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-19rel13734hsy,reddit comment,,,2026-10-20,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Ignore the scream,Tourniquet,(not recorded),(not recorded),Unknown,Unknown,,,,,,Bonded!,,Bonded,Blue,,,,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-19rf49thaysdd,reddit comment,,,2026-10-21,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,East,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,,Bonded!,,Bonded,Blue,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-19rgusco0p4bo,reddit comment,,,2026-10-22,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,East,Red,Hide,Ignore the scream,Tourniquet,Even the numbers (smaller cadet),(not recorded),East,Tree,Shadow (rare),Bonded!,,,,,,Bonded,Red,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-19rgusco0p4bo,reddit comment,,,2026-10-22,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,East,Red,Hide,Ignore the scream,Tourniquet,Even the numbers (smaller cadet),(not recorded),East,Tree,Shadow (rare),Bonded!,,,,,,Bonded,Red,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand; Red at the Shadow (rare) encounter, which has only Black/Blue; fight answers on a run that did not help; a path after the fight on a run without a fight",,
comment-19rjhp6b7kz6r,reddit comment,,,2026-10-23,Unknown,,Unknown,,Unknown,(not asked/blank),Alone,,West,Unknown,Unknown,Investigate & help,Squadmate's revenge,Assess the situation,Engage the smaller cadet,West,Tree,Shadow (rare),,,,,,Bonded!,Bonded,Black,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-19rlnakulqgbp,reddit comment,,,2026-10-24,Unknown,,Unknown,1,First attempt,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,,,Bonded!,Bonded,Black,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
comment-19s5unmw28lr7,reddit comment,,,2026-11-05,Unknown,,Unknown,,Unknown,(not asked/blank),Unknown,,Unknown,Unknown,Unknown,Unknown,Unknown,(not recorded),(not recorded),Unknown,Tree,Shadow (rare),,,,,,Bonded!,Bonded,Black,,,True,(not asked),(not asked),,"read from a Reddit comment automatically, not checked by hand",,
Can't render this file because it is too large.
+3 -3
View File
@@ -6,11 +6,11 @@
"scripts": {
"build": "node site/build.js",
"dev": "node site/build.js && python3 -m http.server 8000 -d dist",
"test:py": "python3 -m collection build --check && python3 planner/build_experiments.py --check && python3 analysis/black/evidence.py --check && python3 analysis/tree/build_tree.py --check && PYTHONPATH=core python3 -m unittest discover -s tests/core -p 'test_*.py' && python3 -m unittest discover -s tests/collection -p 'test_*.py'",
"test:unit": "node --test tests/core/graph.test.js tests/core/advisor.test.js",
"test:py": "python3 -m collection build --check && python3 planner/build_experiments.py --check && python3 analysis/black/evidence.py --check && python3 analysis/tree/build_tree.py --check && python3 analysis/known/build_known.py --check && PYTHONPATH=core python3 -m unittest discover -s tests/core -p 'test_*.py' && python3 -m unittest discover -s tests/collection -p 'test_*.py'",
"test:unit": "node --test tests/core/graph.test.js tests/core/advisor.test.js tests/core/known.test.js",
"test": "npm run test:py && npm run test:unit",
"graph": "node analysis/network/build-graph.js",
"policy": "python3 planner/build_policy.py && python3 planner/policy_report.py && python3 planner/build_experiments.py && python3 analysis/black/evidence.py && python3 analysis/tree/build_tree.py",
"policy": "python3 planner/build_policy.py && python3 planner/policy_report.py && python3 planner/build_experiments.py && python3 analysis/black/evidence.py && python3 analysis/tree/build_tree.py && python3 analysis/known/build_known.py",
"cycle": "python3 -m collection cycle",
"stats": "python3 analysis/stats/site_stats.py",
"collect": "python3 -m collection update",
+10 -1
View File
@@ -36,6 +36,15 @@ def low_bias(r, lb=CONFIG["low_bias"]):
return r["goal"] not in lb["rare_goals"]
def drop_flagged(runs, cfg=CONFIG.get("drop_flagged") or {}):
"""Without the flagged runs of the sources read automatically from free text (planner/policy.yaml drop_flagged)."""
sources, keep = set(cfg.get("sources") or ()), tuple(cfg.get("except") or ())
def problems(r):
return [f for f in (r.get("data_flags") or "").split("; ") if f and not f.startswith(keep)] if keep else [f for f in (r.get("data_flags") or "").split("; ") if f]
return [r for r in runs if r["source"] not in sources or not problems(r)]
def clean(o):
"""JSON-safe: numpy numbers to floats, infinities and NaN to null (as JavaScript's JSON.stringify does)."""
if isinstance(o, dict):
@@ -56,7 +65,7 @@ def main(argv=None):
ap.add_argument("--out", default=str(ROOT / "data/public/policy.json"))
a = ap.parse_args(argv)
runs = runs_io.read(a.data, sources=SOURCES)
runs = drop_flagged(runs_io.read(a.data, sources=SOURCES))
rows = len(runs)
samples = {
"all": runs,
+8
View File
@@ -8,6 +8,14 @@ version: 1
# the `source` values of data/public/runs_clean.csv the model learns from
sources: [reddit spreadsheet, reported, bot]
# Sources read automatically from free text: a run with any data flag (a broken game rule, an unrecognised answer)
# is left out of the model, since the flag may mean the text was misread or misremembered. Flags that only say where
# the run came from (`except`, matched at the start of a flag) do not count. A hand fix that clears the flags
# brings the run back. Applies once the source is also listed in `sources` above.
drop_flagged:
sources: [reddit comment]
except: ["read from a Reddit comment"]
# Two samples. "all" is every run above. "lowBias" leaves out runs where a rare sighting is more likely to have
# been reported than a miss: form submissions and reports from riders chasing Blue or Black. The bot logs every
# run, and bulk-pasted logs record every run of the players who kept them, so both stay in.
+43 -2
View File
@@ -278,7 +278,7 @@ class RedditComments(unittest.TestCase):
"answers": {"company": "Alone", "outcome": "Incinerated at a bonding encounter", "outcome_color": "Red"}}]}),
encoding="utf-8")
manual = TMP / "reddit_comments_manual.yaml"
manual.write_text("reject: [c2]\nfix: {c1: {outcome_color: Blue, direction: null}}\n"
manual.write_text("reject: [c2]\nfix: {c1: {outcome_color: Blue, branch: 'Valley: passed the Red, the meadow', direction: null}}\n"
"add: [{id: c9, thread: abc, posted: '2026-11-16', "
"answers: {company: Two squadmates, direction: West (toward the scent), outcome: Died before the hour}}]\n",
encoding="utf-8")
@@ -286,12 +286,53 @@ class RedditComments(unittest.TestCase):
self.assertEqual([r["run_id"] for r in rows], ["comment-c1", "comment-c3", "comment-c9"])
c1, c3, c9 = rows
self.assertEqual((c1["source"], c1["outcome_color"], c1["direction"], c1["hour"], c1["enc_Blue"]),
("reddit comment", "Blue", "Unknown", "Tree", "Bonded!"))
("reddit comment", "Blue", "Unknown", "Valley", "Bonded!"))
self.assertEqual(c1["data_flags"], "read from a Reddit comment")
self.assertEqual(c3["data_flags"], "read from a Reddit comment automatically, not checked by hand")
self.assertEqual((c9["company"], c9["direction"], c9["hour"]), ("2 Squadmates", "West", "DIED before the hour"))
self.assertEqual(validate.problems(rows, runs.DICT), [])
def test_game_rules_flag_impossible_runs(self):
def flags(**answers):
return runs.answers_row("x", "reddit comment", None, answers)["data_flags"]
ok = flags(company="Alone", direction="East (toward the roar)", first_sighting="Orange",
scream="Kept walking (ignored it)", resolution="Wounded cadet: tourniquet",
branch="Tree: climbed down slowly to the two Greens", outcome="Bonded", outcome_color="Brown")
self.assertEqual(ok, "") # Brown after the Greens: a Green's rescue
cases = {
"first sighting Orange not in documented pool for Alone/Center":
dict(company="Alone", direction="Toward the forest centre", first_sighting="Orange", outcome="Died before the hour"),
"Brown at the Shadow (rare) encounter, which has only Black/Blue":
dict(branch="Tree: the shadow (Blue or Black)", outcome="Bonded", outcome_color="Brown"),
"Red at the Passed the Red: meadow encounter":
dict(branch="Valley: passed the Red, the meadow", outcome="Incinerated at a bonding encounter", outcome_color="Red"),
"Green recorded on a Valley run":
dict(hour="Went to the valley centre", outcome="Bonded", outcome_color="Green"),
"does not follow 'Ignore the scream'":
dict(scream="Kept walking (ignored it)", resolution="Bullies: my squadmate's revenge", outcome="Died before the hour"),
"fight answers on a run that did not help":
dict(scream="Kept walking (ignored it)", combat_first="Pause to assess", outcome="Died before the hour"),
"a path after the fight on a run without a fight":
dict(scream="Investigated, and walked away", post_path="West", outcome="Died before the hour"),
"a second fight move without pausing to assess":
dict(scream="Investigated, and helped my squadmate", combat_first="Charge the smaller cadet",
combat_second="Engage the smaller cadet", outcome="Died before the hour"),
"died before the hour, yet reached":
dict(scream="Investigated, and helped my squadmate", resolution="I died in the fight", outcome="Bonded", outcome_color="Red"),
}
for expected, answers in cases.items():
self.assertIn(expected, flags(**answers), expected)
def test_flagged_comment_runs_stay_out_of_the_route_model(self):
sys.path.insert(0, str(ROOT / "planner"))
import build_policy
rows = [{"source": "reddit comment", "data_flags": "read from a Reddit comment automatically, not checked by hand"},
{"source": "reddit comment", "data_flags": "read from a Reddit comment; Green recorded on a Valley run (no Greens in the valley)"},
{"source": "reddit spreadsheet", "data_flags": "multiple wings"},
{"source": "reported", "data_flags": "Green recorded on a Valley run (no Greens in the valley)"}]
kept = build_policy.drop_flagged(rows)
self.assertEqual([r["source"] for r in kept], ["reddit comment", "reddit spreadsheet", "reported"])
def test_delivered_not_extracted(self):
spec = read_yaml("collection/pipeline.yaml")["sources"]["reddit_comments"]
with self.assertRaises(extract.Skip):
+32
View File
@@ -0,0 +1,32 @@
// knownAnswer (core/solver.js) against the published data/public/known_answers.json: the guide's recommended answers
// are found on the game's full texts, wrong colours and deadly answers are not picked, and unknown screens stay open.
const test = require("node:test");
const assert = require("node:assert/strict");
const path = require("node:path");
const S = require("../../core/solver.js");
const known = require(path.join(__dirname, "../../data/public/known_answers.json"));
test("the Black: 'Hold its gaze' is the strong pick, 'Lower your eyes' is bad", () => {
const r = S.knownAnswer(known, ["Lower your eyes", "Hold its gaze"], { target: "black", sceneColour: "Black" });
assert.equal(r.pick, 1);
assert.equal(r.confidence, "strong");
assert.equal(r.choices[0].verdict, "bad");
});
test("a guide paraphrase matches the game's full text", () => {
const r = S.knownAnswer(known, ["Climb onto its foreleg", "Reach a hand slowly to touch its talon"], { target: "Red", sceneColour: "Red" });
assert.equal(r.pick, 1);
assert.match(r.reason, /Touch its talon/);
});
test("the two Greens: the answer for the right Green is not the pick for a Brown target", () => {
const offered = ["You respect their nature", "You don't know", "Intellect match"];
assert.equal(S.knownAnswer(known, offered, { target: "Green" }).pick, 0);
assert.equal(S.knownAnswer(known, offered, { target: "Brown" }).pick, 2);
});
test("a screen nobody has seen: no pick, every choice unknown", () => {
const r = S.knownAnswer(known, ["Whistle a tune", "Count the clouds"], { target: "Blue" });
assert.equal(r.pick, null);
assert.deepEqual(r.choices.map((c) => c.verdict), ["unknown", "unknown"]);
});