FAILURE MAP
← Case archive

FA-86656 / Procedural level generation constraints / Open access

Boss room selection: Start room becomes the boss · case 01

Isolated starts put the boss in the spawn room.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The start room is only excluded when other rooms were reached.

VERIFIED REPAIR

Restore `if room == start:` at the start exclusion step.

Unsuccessful approach: Excluding start only when more rooms exist still picks it in a one-room level.

Case contract

Rooms 0..n-1 joined by two-way doors [a, b]. The boss room is the reachable room (other than start) with the largest BFS door distance from start, ties to the lowest room id. Returns [room, distance] or None when no other room is reachable.

Why this case matters

Procedural generators silently emit unplayable or unfair levels when a single constraint check uses the wrong boundary, axis, neighborhood or update order; the defect is visible in exact generated geometry.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(n, doors, start):
    adj = {i: [] for i in range(n)}
    for a, b in doors:
        adj[a].append(b)
        adj[b].append(a)
    dist = {start: 0}
    queue = [start]
    for u in queue:
        for v in sorted(adj[u]):
            if v not in dist:
                dist[v] = dist[u] + 1
                queue.append(v)
    best = None
    for room, d in dist.items():
        if room == start and len(dist) > 1:
            continue
        if best is None or d > best[1] or (d == best[1] and room < best[0]):
            best = [room, d]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('isolated start #1', [3, [[1, 2]], 0], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('fault site start exclusion #1', [8, [[1, 0], [1, 3], [3, 4], [4, 5], [0, 6], [7, 4], [3, 7]], 2], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [6, [[0, 1], [1, 2], [1, 3], [1, 4], [2, 0], [1, 4]], 2], [3, 2]),
  ('control #2', [2, [[0, 1], [0, 1], [1, 0]], 0], [1, 1]),
  ('control #3', [7, [[0, 1], [0, 2], [1, 3], [4, 0], [3, 5], [6, 2]], 1], [6, 3])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [8, [[1, 0], [1, 3], [3, 4], [4, 5], [0, 6], [7, 4], [3, 7]], 2], None),
  ('fault site start exclusion #2', [5, [[0, 1], [0, 2], [3, 0], [0, 3]], 4], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [6, [[0, 1], [1, 2], [1, 3], [1, 4], [2, 0], [1, 4]], 2], [3, 2]),
  ('control #2', [2, [[0, 1], [0, 1], [1, 0]], 0], [1, 1])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [3, [[1, 0]], 2], None),
  ('fault site start exclusion #2', [8, [[1, 0], [0, 2], [1, 4], [6, 0], [7, 4], [2, 0], [1, 4]], 3], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [7, [[0, 1], [0, 2], [1, 3], [4, 0], [3, 5], [6, 2]], 1], [6, 3]),
  ('control #2', [2, [[0, 1], [0, 1]], 1], [0, 1])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [3, [], 0], None),
  ('fault site start exclusion #2', [7, [[0, 1], [3, 1], [4, 1], [5, 0], [5, 6], [1, 3]], 2], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [8, [[0, 1], [1, 2], [1, 4], [5, 2], [3, 6], [7, 3], [3, 7]], 2], [0, 2]),
  ('control #2', [6, [[1, 0], [0, 2], [3, 0], [4, 2], [3, 5]], 4], [5, 4])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [4, [[1, 0], [3, 0]], 2], None),
  ('fault site start exclusion #2', [7, [[6, 2], [6, 2]], 4], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [8, [[0, 1], [2, 0], [1, 3], [0, 4], [5, 0], [3, 6], [1, 7], [0, 5], [0, 1]], 5], [6, 4]),
  ('control #2', [7, [[0, 1], [3, 0], [4, 1], [5, 4], [6, 5], [4, 0]], 4], [3, 2])]]
for label, args, expected in cases[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
isolated start #1[0, 0]NoneFailed
regression start exclusion #1[0, 0]NoneFailed
fault site start exclusion #1[2, 0]NoneFailed
door listed backwards #1[1, 1][1, 1]Passed
two leaves tie #1[1, 1][1, 1]Passed
control #1[3, 2][3, 2]Passed
control #2[1, 1][1, 1]Passed
control #3[6, 3][6, 3]Passed

SHA-256 / 309f8110728ad3e2fa9982794600feb4939a9eab638a77906ce22af9a452e672

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(n, doors, start):
    adj = {i: [] for i in range(n)}
    for a, b in doors:
        adj[a].append(b)
        adj[b].append(a)
    dist = {start: 0}
    queue = [start]
    for u in queue:
        for v in sorted(adj[u]):
            if v not in dist:
                dist[v] = dist[u] + 1
                queue.append(v)
    best = None
    for room, d in dist.items():
        if room == start and n > 1:
            continue
        if best is None or d > best[1] or (d == best[1] and room < best[0]):
            best = [room, d]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('isolated start #1', [3, [[1, 2]], 0], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('fault site start exclusion #1', [8, [[1, 0], [1, 3], [3, 4], [4, 5], [0, 6], [7, 4], [3, 7]], 2], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [6, [[0, 1], [1, 2], [1, 3], [1, 4], [2, 0], [1, 4]], 2], [3, 2]),
  ('control #2', [2, [[0, 1], [0, 1], [1, 0]], 0], [1, 1]),
  ('control #3', [7, [[0, 1], [0, 2], [1, 3], [4, 0], [3, 5], [6, 2]], 1], [6, 3])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [8, [[1, 0], [1, 3], [3, 4], [4, 5], [0, 6], [7, 4], [3, 7]], 2], None),
  ('fault site start exclusion #2', [5, [[0, 1], [0, 2], [3, 0], [0, 3]], 4], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [6, [[0, 1], [1, 2], [1, 3], [1, 4], [2, 0], [1, 4]], 2], [3, 2]),
  ('control #2', [2, [[0, 1], [0, 1], [1, 0]], 0], [1, 1])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [3, [[1, 0]], 2], None),
  ('fault site start exclusion #2', [8, [[1, 0], [0, 2], [1, 4], [6, 0], [7, 4], [2, 0], [1, 4]], 3], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [7, [[0, 1], [0, 2], [1, 3], [4, 0], [3, 5], [6, 2]], 1], [6, 3]),
  ('control #2', [2, [[0, 1], [0, 1]], 1], [0, 1])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [3, [], 0], None),
  ('fault site start exclusion #2', [7, [[0, 1], [3, 1], [4, 1], [5, 0], [5, 6], [1, 3]], 2], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [8, [[0, 1], [1, 2], [1, 4], [5, 2], [3, 6], [7, 3], [3, 7]], 2], [0, 2]),
  ('control #2', [6, [[1, 0], [0, 2], [3, 0], [4, 2], [3, 5]], 4], [5, 4])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [4, [[1, 0], [3, 0]], 2], None),
  ('fault site start exclusion #2', [7, [[6, 2], [6, 2]], 4], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [8, [[0, 1], [2, 0], [1, 3], [0, 4], [5, 0], [3, 6], [1, 7], [0, 5], [0, 1]], 5], [6, 4]),
  ('control #2', [7, [[0, 1], [3, 0], [4, 1], [5, 4], [6, 5], [4, 0]], 4], [3, 2])]]
for label, args, expected in cases[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
isolated start #1NoneNonePassed
regression start exclusion #1[0, 0]NoneFailed
fault site start exclusion #1NoneNonePassed
door listed backwards #1[1, 1][1, 1]Passed
two leaves tie #1[1, 1][1, 1]Passed
control #1[3, 2][3, 2]Passed
control #2[1, 1][1, 1]Passed
control #3[6, 3][6, 3]Passed

SHA-256 / 93fbda8d89331eab2582830018bc8e16d13385d30a7df72e63ad4701944abbd9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(n, doors, start):
    adj = {i: [] for i in range(n)}
    for a, b in doors:
        adj[a].append(b)
        adj[b].append(a)
    dist = {start: 0}
    queue = [start]
    for u in queue:
        for v in sorted(adj[u]):
            if v not in dist:
                dist[v] = dist[u] + 1
                queue.append(v)
    best = None
    for room, d in dist.items():
        if room == start:
            continue
        if best is None or d > best[1] or (d == best[1] and room < best[0]):
            best = [room, d]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('isolated start #1', [3, [[1, 2]], 0], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('fault site start exclusion #1', [8, [[1, 0], [1, 3], [3, 4], [4, 5], [0, 6], [7, 4], [3, 7]], 2], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [6, [[0, 1], [1, 2], [1, 3], [1, 4], [2, 0], [1, 4]], 2], [3, 2]),
  ('control #2', [2, [[0, 1], [0, 1], [1, 0]], 0], [1, 1]),
  ('control #3', [7, [[0, 1], [0, 2], [1, 3], [4, 0], [3, 5], [6, 2]], 1], [6, 3])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [8, [[1, 0], [1, 3], [3, 4], [4, 5], [0, 6], [7, 4], [3, 7]], 2], None),
  ('fault site start exclusion #2', [5, [[0, 1], [0, 2], [3, 0], [0, 3]], 4], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [6, [[0, 1], [1, 2], [1, 3], [1, 4], [2, 0], [1, 4]], 2], [3, 2]),
  ('control #2', [2, [[0, 1], [0, 1], [1, 0]], 0], [1, 1])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [3, [[1, 0]], 2], None),
  ('fault site start exclusion #2', [8, [[1, 0], [0, 2], [1, 4], [6, 0], [7, 4], [2, 0], [1, 4]], 3], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [7, [[0, 1], [0, 2], [1, 3], [4, 0], [3, 5], [6, 2]], 1], [6, 3]),
  ('control #2', [2, [[0, 1], [0, 1]], 1], [0, 1])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [3, [], 0], None),
  ('fault site start exclusion #2', [7, [[0, 1], [3, 1], [4, 1], [5, 0], [5, 6], [1, 3]], 2], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [8, [[0, 1], [1, 2], [1, 4], [5, 2], [3, 6], [7, 3], [3, 7]], 2], [0, 2]),
  ('control #2', [6, [[1, 0], [0, 2], [3, 0], [4, 2], [3, 5]], 4], [5, 4])],
 [('isolated start #1', [3, [[1, 2]], 0], None),
  ('fault site start exclusion #1', [4, [[1, 0], [3, 0]], 2], None),
  ('fault site start exclusion #2', [7, [[6, 2], [6, 2]], 4], None),
  ('regression start exclusion #1', [1, [], 0], None),
  ('door listed backwards #1', [2, [[1, 0]], 0], [1, 1]),
  ('two leaves tie #1', [3, [[0, 2], [0, 1]], 0], [1, 1]),
  ('control #1', [8, [[0, 1], [2, 0], [1, 3], [0, 4], [5, 0], [3, 6], [1, 7], [0, 5], [0, 1]], 5], [6, 4]),
  ('control #2', [7, [[0, 1], [3, 0], [4, 1], [5, 4], [6, 5], [4, 0]], 4], [3, 2])]]
for label, args, expected in cases[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
isolated start #1NoneNonePassed
regression start exclusion #1NoneNonePassed
fault site start exclusion #1NoneNonePassed
door listed backwards #1[1, 1][1, 1]Passed
two leaves tie #1[1, 1][1, 1]Passed
control #1[3, 2][3, 2]Passed
control #2[1, 1][1, 1]Passed
control #3[6, 3][6, 3]Passed

SHA-256 / cb50fbc3dcb2a504cb4f4a3f57a4a4b947d1b0b2807379a564fad9e6138bd285

Verification & scope

Deterministic toy contract stipulated for this model; integer or exact arithmetic only, not a reproduction of any specific game engine. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:50:51.499704+00:00.

Case digest / 66585186b5b2f056cd9b615ababb27d32917fef44298840c948ee8b5c53ff64a