FAILURE MAP
← Case archive

FA-86556 / Procedural level generation constraints / Open access

Encounter difficulty budget: Enemies unlock one floor late · case 01

New enemy types never appear on their unlock floor.

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

ROOT CAUSE

The unlock comparison excludes the unlock depth itself.

THE FAILURE

The unlock comparison excludes the unlock depth itself.

Unsuccessful approach: Allowing one floor early spawns locked enemies.

Case contract

budget = 10 + 5*depth + 10*(depth//5). roster [name, cost, min_depth] with cost >= 1. Repeatedly pick the most expensive unlocked (min_depth <= depth) affordable enemy with fewer than 3 copies already picked, ties broken by name; stop when none qualifies. Returns {picks, left}.

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(depth, roster):
    budget = 10 + 5 * depth + depth // 5 * 10
    counts = {}
    picks = []
    while True:
        best = None
        for name, cost, need in roster:
            if need >= depth or cost > budget or counts.get(name, 0) >= 3:
                continue
            if best is None or cost > best[1] or (cost == best[1] and name < best[0]):
                best = (name, cost)
        if best is None:
            break
        picks.append(best[0])
        counts[best[0]] = counts.get(best[0], 0) + 1
        budget -= best[1]
    return {'picks': picks, 'left': budget}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('unlock at depth #1',
   [3, [['ogre', 10, 3], ['rat', 1, 0]]],
   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),
  ('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),
  ('fault site unlock depth #1',
   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),
  ('partial repair boundary #1', [4, [['orc', 10, 10], ['wyrm', 2, 5]]], {'picks': [], 'left': 30}),
  ('partial repair boundary #2',
   [9, [['bat', 26, 5], ['rat', 11, 10], ['ogre', 5, 0], ['imp', 5, 0]]],
   {'picks': ['bat', 'bat', 'imp', 'imp'], 'left': 3}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1', [15, [['ogre', 5, 1]]], {'picks': ['ogre', 'ogre', 'ogre'], 'left': 100}),
  ('control #2',
   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],
   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0})],
 [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),
  ('fault site unlock depth #1',
   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),
  ('fault site unlock depth #2',
   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],
   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2}),
  ('partial repair boundary #1',
   [4, [['rat', 5, 1], ['orc', 8, 0], ['imp', 5, 5]]],
   {'picks': ['orc', 'orc', 'orc', 'rat'], 'left': 1}),
  ('partial repair boundary #2',
   [0, [['imp', 10, 1], ['rat', 7, 10], ['orc', 5, 10], ['ogre', 1, 1], ['wyrm', 5, 5]]],
   {'picks': [], 'left': 10}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1',
   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],
   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),
  ('control #2', [5, [['orc', 10, 1], ['imp', 5, 10]]], {'picks': ['orc', 'orc', 'orc'], 'left': 15})],
 [('unlock at depth #1',
   [3, [['ogre', 10, 3], ['rat', 1, 0]]],
   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),
  ('fault site unlock depth #1',
   [1, [['orc', 5, 3], ['bat', 8, 1], ['wyrm', 8, 0]]],
   {'picks': ['bat'], 'left': 7}),
  ('fault site unlock depth #2',
   [10, [['imp', 15, 10], ['ogre', 5, 1], ['orc', 5, 5], ['rat', 5, 0], ['wyrm', 10, 1]]],
   {'picks': ['imp', 'imp', 'imp', 'wyrm', 'wyrm', 'wyrm', 'ogre'], 'left': 0}),
  ('partial repair boundary #1', [9, [['ogre', 5, 10]]], {'picks': [], 'left': 65}),
  ('partial repair boundary #2',
   [4, [['wyrm', 20, 5], ['orc', 5, 10], ['rat', 10, 10], ['bat', 15, 0]]],
   {'picks': ['bat', 'bat'], 'left': 0}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1',
   [1, [['imp', 10, 3], ['orc', 2, 0], ['rat', 10, 10], ['wyrm', 15, 5], ['bat', 15, 3]]],
   {'picks': ['orc', 'orc', 'orc'], 'left': 9}),
  ('control #2',
   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0})],
 [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),
  ('fault site unlock depth #1',
   [1, [['wyrm', 8, 10], ['ogre', 5, 1]]],
   {'picks': ['ogre', 'ogre', 'ogre'], 'left': 0}),
  ('fault site unlock depth #2',
   [1, [['wyrm', 8, 3], ['rat', 5, 1]]],
   {'picks': ['rat', 'rat', 'rat'], 'left': 0}),
  ('partial repair boundary #1',
   [0, [['bat', 5, 3], ['orc', 1, 1], ['rat', 10, 10]]],
   {'picks': [], 'left': 10}),
  ('partial repair boundary #2', [9, [['wyrm', 2, 10]]], {'picks': [], 'left': 65}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1',
   [9, [['rat', 7, 0], ['ogre', 1, 0]]],
   {'picks': ['rat', 'rat', 'rat', 'ogre', 'ogre', 'ogre'], 'left': 41}),
  ('control #2', [0, [['bat', 18, 0]]], {'picks': [], 'left': 10})],
 [('unlock at depth #1',
   [3, [['ogre', 10, 3], ['rat', 1, 0]]],
   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),
  ('fault site unlock depth #1',
   [10, [['bat', 5, 10], ['ogre', 5, 5], ['wyrm', 10, 0]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'bat', 'bat', 'ogre', 'ogre', 'ogre'], 'left': 20}),
  ('fault site unlock depth #2',
   [10, [['bat', 10, 1], ['ogre', 10, 10], ['orc', 5, 10]]],
   {'picks': ['bat', 'bat', 'bat', 'ogre', 'ogre', 'ogre', 'orc', 'orc', 'orc'], 'left': 5}),
  ('regression unlock depth #1',
   [0, [['ogre', 2, 0], ['wyrm', 8, 1], ['rat', 5, 0], ['bat', 1, 1], ['imp', 10, 5]]],
   {'picks': ['rat', 'rat'], 'left': 0}),
  ('partial repair boundary #1',
   [9, [['wyrm', 1, 10], ['imp', 8, 5], ['rat', 8, 10]]],
   {'picks': ['imp', 'imp', 'imp'], 'left': 41}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1', [3, [['orc', 2, 0], ['wyrm', 2, 5]]], {'picks': ['orc', 'orc', 'orc'], 'left': 19}),
  ('control #2',
   [14, [['orc', 30, 1], ['bat', 15, 5], ['ogre', 5, 0], ['rat', 5, 5]]],
   {'picks': ['orc', 'orc', 'orc', 'ogre', 'ogre'], 'left': 0})]]
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
unlock at depth #1{'left': 22, 'picks': ['rat', 'rat', 'rat']}{'left': 2, 'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat']}Failed
equal cost tie #1{'left': 10, 'picks': []}{'left': 0, 'picks': ['imp', 'imp']}Failed
fault site unlock depth #1{'left': 56, 'picks': ['orc', 'orc', 'orc', 'bat', 'bat', 'bat', 'rat', 'rat', 'rat']}{'left': 0, 'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat']}Failed
partial repair boundary #1{'left': 30, 'picks': []}{'left': 30, 'picks': []}Passed
partial repair boundary #2{'left': 3, 'picks': ['bat', 'bat', 'imp', 'imp']}{'left': 3, 'picks': ['bat', 'bat', 'imp', 'imp']}Passed
milestone depth bonus #1{'left': 30, 'picks': ['orc', 'orc', 'orc']}{'left': 30, 'picks': ['orc', 'orc', 'orc']}Passed
control #1{'left': 100, 'picks': ['ogre', 'ogre', 'ogre']}{'left': 100, 'picks': ['ogre', 'ogre', 'ogre']}Passed
control #2{'left': 0, 'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre']}{'left': 0, 'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre']}Passed

SHA-256 / 47d58e01ddeb17ba247d642d1590cac9cd5c87a58a2fcee9e5755ba056984f99

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(depth, roster):
    budget = 10 + 5 * depth + depth // 5 * 10
    counts = {}
    picks = []
    while True:
        best = None
        for name, cost, need in roster:
            if need > depth + 1 or cost > budget or counts.get(name, 0) >= 3:
                continue
            if best is None or cost > best[1] or (cost == best[1] and name < best[0]):
                best = (name, cost)
        if best is None:
            break
        picks.append(best[0])
        counts[best[0]] = counts.get(best[0], 0) + 1
        budget -= best[1]
    return {'picks': picks, 'left': budget}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('unlock at depth #1',
   [3, [['ogre', 10, 3], ['rat', 1, 0]]],
   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),
  ('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),
  ('fault site unlock depth #1',
   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),
  ('partial repair boundary #1', [4, [['orc', 10, 10], ['wyrm', 2, 5]]], {'picks': [], 'left': 30}),
  ('partial repair boundary #2',
   [9, [['bat', 26, 5], ['rat', 11, 10], ['ogre', 5, 0], ['imp', 5, 0]]],
   {'picks': ['bat', 'bat', 'imp', 'imp'], 'left': 3}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1', [15, [['ogre', 5, 1]]], {'picks': ['ogre', 'ogre', 'ogre'], 'left': 100}),
  ('control #2',
   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],
   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0})],
 [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),
  ('fault site unlock depth #1',
   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),
  ('fault site unlock depth #2',
   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],
   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2}),
  ('partial repair boundary #1',
   [4, [['rat', 5, 1], ['orc', 8, 0], ['imp', 5, 5]]],
   {'picks': ['orc', 'orc', 'orc', 'rat'], 'left': 1}),
  ('partial repair boundary #2',
   [0, [['imp', 10, 1], ['rat', 7, 10], ['orc', 5, 10], ['ogre', 1, 1], ['wyrm', 5, 5]]],
   {'picks': [], 'left': 10}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1',
   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],
   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),
  ('control #2', [5, [['orc', 10, 1], ['imp', 5, 10]]], {'picks': ['orc', 'orc', 'orc'], 'left': 15})],
 [('unlock at depth #1',
   [3, [['ogre', 10, 3], ['rat', 1, 0]]],
   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),
  ('fault site unlock depth #1',
   [1, [['orc', 5, 3], ['bat', 8, 1], ['wyrm', 8, 0]]],
   {'picks': ['bat'], 'left': 7}),
  ('fault site unlock depth #2',
   [10, [['imp', 15, 10], ['ogre', 5, 1], ['orc', 5, 5], ['rat', 5, 0], ['wyrm', 10, 1]]],
   {'picks': ['imp', 'imp', 'imp', 'wyrm', 'wyrm', 'wyrm', 'ogre'], 'left': 0}),
  ('partial repair boundary #1', [9, [['ogre', 5, 10]]], {'picks': [], 'left': 65}),
  ('partial repair boundary #2',
   [4, [['wyrm', 20, 5], ['orc', 5, 10], ['rat', 10, 10], ['bat', 15, 0]]],
   {'picks': ['bat', 'bat'], 'left': 0}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1',
   [1, [['imp', 10, 3], ['orc', 2, 0], ['rat', 10, 10], ['wyrm', 15, 5], ['bat', 15, 3]]],
   {'picks': ['orc', 'orc', 'orc'], 'left': 9}),
  ('control #2',
   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0})],
 [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),
  ('fault site unlock depth #1',
   [1, [['wyrm', 8, 10], ['ogre', 5, 1]]],
   {'picks': ['ogre', 'ogre', 'ogre'], 'left': 0}),
  ('fault site unlock depth #2',
   [1, [['wyrm', 8, 3], ['rat', 5, 1]]],
   {'picks': ['rat', 'rat', 'rat'], 'left': 0}),
  ('partial repair boundary #1',
   [0, [['bat', 5, 3], ['orc', 1, 1], ['rat', 10, 10]]],
   {'picks': [], 'left': 10}),
  ('partial repair boundary #2', [9, [['wyrm', 2, 10]]], {'picks': [], 'left': 65}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1',
   [9, [['rat', 7, 0], ['ogre', 1, 0]]],
   {'picks': ['rat', 'rat', 'rat', 'ogre', 'ogre', 'ogre'], 'left': 41}),
  ('control #2', [0, [['bat', 18, 0]]], {'picks': [], 'left': 10})],
 [('unlock at depth #1',
   [3, [['ogre', 10, 3], ['rat', 1, 0]]],
   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),
  ('fault site unlock depth #1',
   [10, [['bat', 5, 10], ['ogre', 5, 5], ['wyrm', 10, 0]]],
   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'bat', 'bat', 'ogre', 'ogre', 'ogre'], 'left': 20}),
  ('fault site unlock depth #2',
   [10, [['bat', 10, 1], ['ogre', 10, 10], ['orc', 5, 10]]],
   {'picks': ['bat', 'bat', 'bat', 'ogre', 'ogre', 'ogre', 'orc', 'orc', 'orc'], 'left': 5}),
  ('regression unlock depth #1',
   [0, [['ogre', 2, 0], ['wyrm', 8, 1], ['rat', 5, 0], ['bat', 1, 1], ['imp', 10, 5]]],
   {'picks': ['rat', 'rat'], 'left': 0}),
  ('partial repair boundary #1',
   [9, [['wyrm', 1, 10], ['imp', 8, 5], ['rat', 8, 10]]],
   {'picks': ['imp', 'imp', 'imp'], 'left': 41}),
  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),
  ('control #1', [3, [['orc', 2, 0], ['wyrm', 2, 5]]], {'picks': ['orc', 'orc', 'orc'], 'left': 19}),
  ('control #2',
   [14, [['orc', 30, 1], ['bat', 15, 5], ['ogre', 5, 0], ['rat', 5, 5]]],
   {'picks': ['orc', 'orc', 'orc', 'ogre', 'ogre'], 'left': 0})]]
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
unlock at depth #1{'left': 2, 'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat']}{'left': 2, 'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat']}Passed
equal cost tie #1{'left': 0, 'picks': ['imp', 'imp']}{'left': 0, 'picks': ['imp', 'imp']}Passed
fault site unlock depth #1{'left': 0, 'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat']}{'left': 0, 'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat']}Passed
partial repair boundary #1{'left': 24, 'picks': ['wyrm', 'wyrm', 'wyrm']}{'left': 30, 'picks': []}Failed
partial repair boundary #2{'left': 2, 'picks': ['bat', 'bat', 'rat']}{'left': 3, 'picks': ['bat', 'bat', 'imp', 'imp']}Failed
milestone depth bonus #1{'left': 30, 'picks': ['orc', 'orc', 'orc']}{'left': 30, 'picks': ['orc', 'orc', 'orc']}Passed
control #1{'left': 100, 'picks': ['ogre', 'ogre', 'ogre']}{'left': 100, 'picks': ['ogre', 'ogre', 'ogre']}Passed
control #2{'left': 0, 'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre']}{'left': 0, 'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre']}Passed

SHA-256 / afbd85e443b1e6f7f48a434254522cb789e31510fa518d97224662a7b8928551

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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:50.640789+00:00.

Case digest / 615e62da044200057510b088fb6dcdd6a0084fcb1504b16a6642cc93bc54ba43