Game: which dragons each encounter can give; impossible bonds are not counted

A form row recording a Green bonded at the shadow Blue let the "eventually" objective
find a route whose only possible bond was that Green (ratio 1, near-zero chance).
game.yaml now lists the possible bonds per encounter (own colour; the two Greens also
Orange and Brown); anything else is a data-entry error and is not counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-10 02:36:49 +00:00
co-authored by Claude Opus 5.5
parent 64fd3af235
commit 8f1f0383fe
3 changed files with 25 additions and 4 deletions
+8 -2
View File
@@ -158,6 +158,12 @@ def ctx_key(v, names):
# ---------------------------------------------------------------- 2. counts
def can_bond(ctx, colour):
"""Whether a bond with this colour is possible at this encounter (game.yaml `encounters`)."""
e = G["encounters"][ctx]
return colour == "burn" or colour == e["colour"] or colour in (e.get("also") or [])
def count_tables(prepared, weights=None):
"""Counts for every chance event at every back-off level, plus each encounter's outcomes. weights: per run,
{chance event: weight of the outcome it observed} (reporting-bias corrections, core/atlas/bias.py)."""
@@ -187,11 +193,11 @@ def count_tables(prepared, weights=None):
if not v.get("encCtx"):
continue
c = enc.setdefault(v["encCtx"], {"outcomes": {}, "seen": {}})
if v.get("encOutcome"):
if v.get("encOutcome") and can_bond(v["encCtx"], v["encOutcome"]):
c["outcomes"][v["encOutcome"]] = c["outcomes"].get(v["encOutcome"], 0) + 1
# which colours can ever end a run in this context (from all runs, genuine or not)
for v in prepared:
if v.get("encCtx") and v.get("encOutcome") and v["encOutcome"] != "burn":
if v.get("encCtx") and v.get("encOutcome") and v["encOutcome"] != "burn" and can_bond(v["encCtx"], v["encOutcome"]):
enc[v["encCtx"]]["seen"][v["encOutcome"]] = 1
return T
+4 -2
View File
@@ -67,11 +67,13 @@ chance:
shadowColour: { label: Shadow dragon, outcomes: [Black, Blue], context: [] }
meadow: { label: Meadow dragon, outcomes: [Orange, Brown, Blue], context: [cadet, post, fs, direction, company] }
# Bonding encounters: where each colour can be bonded. tree-Greens can also end in an Orange or Brown rescue.
# Bonding encounters: where each colour can be bonded. A run can only bond the encounter's own colour, except at
# the two Greens, where an Orange or a Brown can swoop in (`also`). A recorded bond with any other colour is a
# data-entry error and is not counted.
encounters:
valley-Red: { label: The valley Red, colour: Red }
tree-Red: { label: The Red below the tree, colour: Red }
tree-Greens: { label: The two Greens, colour: Green }
tree-Greens: { label: The two Greens, colour: Green, also: [Orange, Brown] }
meadow-Orange: { label: The meadow Orange, colour: Orange }
meadow-Brown: { label: The meadow Brown, colour: Brown }
meadow-Blue: { label: The meadow Blue, colour: Blue }