FAILURE MAP
← Case archive

FA-86836 / Procedural level generation constraints / Open access

Aligned stair placement: Exact minimum distance rejected · case 01

Small floors fail to place stairs.

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

ROOT CAUSE

The distance test rejects cells exactly at min_dist.

VERIFIED REPAIR

Restore `< min_dist:` at the distance threshold step.

Unsuccessful approach: Relaxing by one accepts cells too close to the entrance.

Case contract

Scan floor_a row by row (y), then column (x); choose the first cell where floor_a[y][x] == '.', the cell exists on floor_b and is '.' there, and the Manhattan distance to entrance [x, y] is at least min_dist. Returns [x, y] or None.

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(floor_a, floor_b, entrance, min_dist):
    for y in range(len(floor_a)):
        for x in range(len(floor_a[0])):
            if floor_a[y][x] != '.':
                continue
            if y >= len(floor_b) or x >= len(floor_b[0]) or floor_b[y][x] != '.':
                continue
            if abs(x - entrance[0]) + abs(y - entrance[1]) <= min_dist:
                continue
            return [x, y]
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['...', '.#.', '...', '..#', '###', '..#'], ['~.#.~', '##~~#', '~~#..', '.~.~.'], [2, 4], 5],
   [1, 0]),
  ('fault site distance threshold #2',
   [['...##.', '..#.#.', '..#...', '#.....', '#.....'], ['#', '.', '.', '~'], [0, 2], 1],
   [0, 1]),
  ('partial repair boundary #1', [['#.#.', '...#'], ['...#~', '.....'], [3, 1], 4], None),
  ('partial repair boundary #2',
   [['.#', '#.', '#.', '..', '..', '#.'], ['~..##', '#..#.', '#.#~.', '..~.~', '~~~..'], [0, 0], 5],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['.', '#', '.', '#'], ['#.....'], [0, 1], 4], None)],
 [('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['...', '.#.', '...', '..#', '###', '..#'], ['~.#.~', '##~~#', '~~#..', '.~.~.'], [2, 4], 5],
   [1, 0]),
  ('fault site distance threshold #2',
   [['...##.', '..#.#.', '..#...', '#.....', '#.....'], ['#', '.', '.', '~'], [0, 2], 1],
   [0, 1]),
  ('partial repair boundary #1',
   [['.#', '#.', '#.', '..', '..', '#.'], ['~..##', '#..#.', '#.#~.', '..~.~', '~~~..'], [0, 0], 5],
   None),
  ('partial repair boundary #2',
   [['.#.#', '#...', '..#.'], ['..#', '~~.', '~.#', '...', '#~.', '~#.'], [2, 0], 4],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['##', '.#', '#.', '.#', '.#'], ['##.', '...', '.~#'], [0, 0], 5], None),
  ('control #2',
   [['#....', '..#..', '#...#', '#..#.', '.#.#.', '.#.#.'],
    ['#~..', '..~.', '..~.', '..#.', '##~~'],
    [1, 4],
    1],
   [2, 0])],
 [('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['.', '.', '.'], ['.#.~', '~..~', '...~', '...~', '~~#.'], [0, 0], 2],
   [0, 2]),
  ('fault site distance threshold #2',
   [['..##.', '.##..', '.##..'], ['..~', '.##', '..~', '...', '.##', '...'], [3, 2], 5],
   [0, 0]),
  ('partial repair boundary #1',
   [['..', '..', '.#'], ['.#.#', '#~..', '#.#.', '..#.', '#...', '~~..'], [1, 2], 4],
   None),
  ('partial repair boundary #2',
   [['..#.', '..#.', '..#.', '#...', '.#.#'], ['#..#', '.~#.', '.##~'], [0, 2], 5],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['##', '.#', '#.', '.#', '.#'], ['##.', '...', '.~#'], [0, 0], 5], None)],
 [('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['..###.', '.#.#..', '...##.', '###...', '.#..##'], ['#', '~', '.', '.', '.', '#'], [2, 2], 2],
   [0, 2]),
  ('fault site distance threshold #2',
   [['..#..', '#..#.', '..#..', '.....', '.#...', '##.#.'],
    ['~~.', '##.', '~#~', '###', '.##', '...'],
    [2, 1],
    0],
   [2, 1]),
  ('regression distance threshold #1',
   [['#.#', '#..', '.##', '..#'], ['~~.#..', '...#~~', '#.#..#', '.....~', '~~#.~.'], [0, 2], 3],
   [2, 1]),
  ('partial repair boundary #1', [['..#..'], ['#.#~', '#...', '.~~#', '~.#.'], [2, 0], 2], None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['#..#', '..#.', '#.##'], ['.', '~', '.', '#'], [2, 2], 4], None),
  ('control #2',
   [['..', '..', '#.', '.#', '#.', '.#'], ['~.~', '~~~', '~#.', '~#.', '...', '##.'], [0, 4], 4],
   [1, 0])],
 [('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('regression distance threshold #1',
   [['#.#', '#..', '.##', '..#'], ['~~.#..', '...#~~', '#.#..#', '.....~', '~~#.~.'], [0, 2], 3],
   [2, 1]),
  ('fault site distance threshold #1',
   [['###..', '.#.##', '.....', '.....', '#.##.'], ['~#..', '...#'], [0, 0], 3],
   [3, 0]),
  ('partial repair boundary #1',
   [['#.', '.#'], ['#..#.#', '.~#~.#', '~~#.~.', '..#~~.', '##~..#', '.~#~.#'], [0, 0], 2],
   None),
  ('partial repair boundary #2',
   [['.###', '....', '....', '....', '#...'],
    ['~.#~.', '..#.~', '.###.', '.#.~#', '.~#.#', '.~.~~'],
    [0, 2],
    6],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['..', '##'], ['.', '.', '~', '~', '.'], [1, 0], 6], None)]]
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
first row candidate #1[1, 1][1, 0]Failed
distance exactly min #1None[2, 0]Failed
fault site distance threshold #1None[1, 0]Failed
fault site distance threshold #2None[0, 1]Failed
partial repair boundary #1NoneNonePassed
partial repair boundary #2NoneNonePassed
water below #1NoneNonePassed
control #1NoneNonePassed

SHA-256 / f9318bfb1c574a86f5901f82b80fba8fb99b89684a83a6bb9800b2baa076083c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(floor_a, floor_b, entrance, min_dist):
    for y in range(len(floor_a)):
        for x in range(len(floor_a[0])):
            if floor_a[y][x] != '.':
                continue
            if y >= len(floor_b) or x >= len(floor_b[0]) or floor_b[y][x] != '.':
                continue
            if abs(x - entrance[0]) + abs(y - entrance[1]) < min_dist - 1:
                continue
            return [x, y]
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['...', '.#.', '...', '..#', '###', '..#'], ['~.#.~', '##~~#', '~~#..', '.~.~.'], [2, 4], 5],
   [1, 0]),
  ('fault site distance threshold #2',
   [['...##.', '..#.#.', '..#...', '#.....', '#.....'], ['#', '.', '.', '~'], [0, 2], 1],
   [0, 1]),
  ('partial repair boundary #1', [['#.#.', '...#'], ['...#~', '.....'], [3, 1], 4], None),
  ('partial repair boundary #2',
   [['.#', '#.', '#.', '..', '..', '#.'], ['~..##', '#..#.', '#.#~.', '..~.~', '~~~..'], [0, 0], 5],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['.', '#', '.', '#'], ['#.....'], [0, 1], 4], None)],
 [('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['...', '.#.', '...', '..#', '###', '..#'], ['~.#.~', '##~~#', '~~#..', '.~.~.'], [2, 4], 5],
   [1, 0]),
  ('fault site distance threshold #2',
   [['...##.', '..#.#.', '..#...', '#.....', '#.....'], ['#', '.', '.', '~'], [0, 2], 1],
   [0, 1]),
  ('partial repair boundary #1',
   [['.#', '#.', '#.', '..', '..', '#.'], ['~..##', '#..#.', '#.#~.', '..~.~', '~~~..'], [0, 0], 5],
   None),
  ('partial repair boundary #2',
   [['.#.#', '#...', '..#.'], ['..#', '~~.', '~.#', '...', '#~.', '~#.'], [2, 0], 4],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['##', '.#', '#.', '.#', '.#'], ['##.', '...', '.~#'], [0, 0], 5], None),
  ('control #2',
   [['#....', '..#..', '#...#', '#..#.', '.#.#.', '.#.#.'],
    ['#~..', '..~.', '..~.', '..#.', '##~~'],
    [1, 4],
    1],
   [2, 0])],
 [('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['.', '.', '.'], ['.#.~', '~..~', '...~', '...~', '~~#.'], [0, 0], 2],
   [0, 2]),
  ('fault site distance threshold #2',
   [['..##.', '.##..', '.##..'], ['..~', '.##', '..~', '...', '.##', '...'], [3, 2], 5],
   [0, 0]),
  ('partial repair boundary #1',
   [['..', '..', '.#'], ['.#.#', '#~..', '#.#.', '..#.', '#...', '~~..'], [1, 2], 4],
   None),
  ('partial repair boundary #2',
   [['..#.', '..#.', '..#.', '#...', '.#.#'], ['#..#', '.~#.', '.##~'], [0, 2], 5],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['##', '.#', '#.', '.#', '.#'], ['##.', '...', '.~#'], [0, 0], 5], None)],
 [('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['..###.', '.#.#..', '...##.', '###...', '.#..##'], ['#', '~', '.', '.', '.', '#'], [2, 2], 2],
   [0, 2]),
  ('fault site distance threshold #2',
   [['..#..', '#..#.', '..#..', '.....', '.#...', '##.#.'],
    ['~~.', '##.', '~#~', '###', '.##', '...'],
    [2, 1],
    0],
   [2, 1]),
  ('regression distance threshold #1',
   [['#.#', '#..', '.##', '..#'], ['~~.#..', '...#~~', '#.#..#', '.....~', '~~#.~.'], [0, 2], 3],
   [2, 1]),
  ('partial repair boundary #1', [['..#..'], ['#.#~', '#...', '.~~#', '~.#.'], [2, 0], 2], None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['#..#', '..#.', '#.##'], ['.', '~', '.', '#'], [2, 2], 4], None),
  ('control #2',
   [['..', '..', '#.', '.#', '#.', '.#'], ['~.~', '~~~', '~#.', '~#.', '...', '##.'], [0, 4], 4],
   [1, 0])],
 [('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('regression distance threshold #1',
   [['#.#', '#..', '.##', '..#'], ['~~.#..', '...#~~', '#.#..#', '.....~', '~~#.~.'], [0, 2], 3],
   [2, 1]),
  ('fault site distance threshold #1',
   [['###..', '.#.##', '.....', '.....', '#.##.'], ['~#..', '...#'], [0, 0], 3],
   [3, 0]),
  ('partial repair boundary #1',
   [['#.', '.#'], ['#..#.#', '.~#~.#', '~~#.~.', '..#~~.', '##~..#', '.~#~.#'], [0, 0], 2],
   None),
  ('partial repair boundary #2',
   [['.###', '....', '....', '....', '#...'],
    ['~.#~.', '..#.~', '.###.', '.#.~#', '.~#.#', '.~.~~'],
    [0, 2],
    6],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['..', '##'], ['.', '.', '~', '~', '.'], [1, 0], 6], None)]]
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
first row candidate #1[1, 0][1, 0]Passed
distance exactly min #1[1, 0][2, 0]Failed
fault site distance threshold #1[1, 0][1, 0]Passed
fault site distance threshold #2[0, 1][0, 1]Passed
partial repair boundary #1[1, 0]NoneFailed
partial repair boundary #2[1, 3]NoneFailed
water below #1NoneNonePassed
control #1NoneNonePassed

SHA-256 / d256068d17b97858e49991e8a78f76260484438fba5eed108066be11f1495bb1

3 / The verified repair

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

N = 1
observations = []
def solve(floor_a, floor_b, entrance, min_dist):
    for y in range(len(floor_a)):
        for x in range(len(floor_a[0])):
            if floor_a[y][x] != '.':
                continue
            if y >= len(floor_b) or x >= len(floor_b[0]) or floor_b[y][x] != '.':
                continue
            if abs(x - entrance[0]) + abs(y - entrance[1]) < min_dist:
                continue
            return [x, y]
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['...', '.#.', '...', '..#', '###', '..#'], ['~.#.~', '##~~#', '~~#..', '.~.~.'], [2, 4], 5],
   [1, 0]),
  ('fault site distance threshold #2',
   [['...##.', '..#.#.', '..#...', '#.....', '#.....'], ['#', '.', '.', '~'], [0, 2], 1],
   [0, 1]),
  ('partial repair boundary #1', [['#.#.', '...#'], ['...#~', '.....'], [3, 1], 4], None),
  ('partial repair boundary #2',
   [['.#', '#.', '#.', '..', '..', '#.'], ['~..##', '#..#.', '#.#~.', '..~.~', '~~~..'], [0, 0], 5],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['.', '#', '.', '#'], ['#.....'], [0, 1], 4], None)],
 [('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['...', '.#.', '...', '..#', '###', '..#'], ['~.#.~', '##~~#', '~~#..', '.~.~.'], [2, 4], 5],
   [1, 0]),
  ('fault site distance threshold #2',
   [['...##.', '..#.#.', '..#...', '#.....', '#.....'], ['#', '.', '.', '~'], [0, 2], 1],
   [0, 1]),
  ('partial repair boundary #1',
   [['.#', '#.', '#.', '..', '..', '#.'], ['~..##', '#..#.', '#.#~.', '..~.~', '~~~..'], [0, 0], 5],
   None),
  ('partial repair boundary #2',
   [['.#.#', '#...', '..#.'], ['..#', '~~.', '~.#', '...', '#~.', '~#.'], [2, 0], 4],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['##', '.#', '#.', '.#', '.#'], ['##.', '...', '.~#'], [0, 0], 5], None),
  ('control #2',
   [['#....', '..#..', '#...#', '#..#.', '.#.#.', '.#.#.'],
    ['#~..', '..~.', '..~.', '..#.', '##~~'],
    [1, 4],
    1],
   [2, 0])],
 [('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['.', '.', '.'], ['.#.~', '~..~', '...~', '...~', '~~#.'], [0, 0], 2],
   [0, 2]),
  ('fault site distance threshold #2',
   [['..##.', '.##..', '.##..'], ['..~', '.##', '..~', '...', '.##', '...'], [3, 2], 5],
   [0, 0]),
  ('partial repair boundary #1',
   [['..', '..', '.#'], ['.#.#', '#~..', '#.#.', '..#.', '#...', '~~..'], [1, 2], 4],
   None),
  ('partial repair boundary #2',
   [['..#.', '..#.', '..#.', '#...', '.#.#'], ['#..#', '.~#.', '.##~'], [0, 2], 5],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['##', '.#', '#.', '.#', '.#'], ['##.', '...', '.~#'], [0, 0], 5], None)],
 [('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('fault site distance threshold #1',
   [['..###.', '.#.#..', '...##.', '###...', '.#..##'], ['#', '~', '.', '.', '.', '#'], [2, 2], 2],
   [0, 2]),
  ('fault site distance threshold #2',
   [['..#..', '#..#.', '..#..', '.....', '.#...', '##.#.'],
    ['~~.', '##.', '~#~', '###', '.##', '...'],
    [2, 1],
    0],
   [2, 1]),
  ('regression distance threshold #1',
   [['#.#', '#..', '.##', '..#'], ['~~.#..', '...#~~', '#.#..#', '.....~', '~~#.~.'], [0, 2], 3],
   [2, 1]),
  ('partial repair boundary #1', [['..#..'], ['#.#~', '#...', '.~~#', '~.#.'], [2, 0], 2], None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['#..#', '..#.', '#.##'], ['.', '~', '.', '#'], [2, 2], 4], None),
  ('control #2',
   [['..', '..', '#.', '.#', '#.', '.#'], ['~.~', '~~~', '~#.', '~#.', '...', '##.'], [0, 4], 4],
   [1, 0])],
 [('first row candidate #1', [['..', '..'], ['#.', '..'], [0, 0], 1], [1, 0]),
  ('distance exactly min #1', [['...'], ['...'], [0, 0], 2], [2, 0]),
  ('regression distance threshold #1',
   [['#.#', '#..', '.##', '..#'], ['~~.#..', '...#~~', '#.#..#', '.....~', '~~#.~.'], [0, 2], 3],
   [2, 1]),
  ('fault site distance threshold #1',
   [['###..', '.#.##', '.....', '.....', '#.##.'], ['~#..', '...#'], [0, 0], 3],
   [3, 0]),
  ('partial repair boundary #1',
   [['#.', '.#'], ['#..#.#', '.~#~.#', '~~#.~.', '..#~~.', '##~..#', '.~#~.#'], [0, 0], 2],
   None),
  ('partial repair boundary #2',
   [['.###', '....', '....', '....', '#...'],
    ['~.#~.', '..#.~', '.###.', '.#.~#', '.~#.#', '.~.~~'],
    [0, 2],
    6],
   None),
  ('water below #1', [['.'], ['~'], [0, 0], 0], None),
  ('control #1', [['..', '##'], ['.', '.', '~', '~', '.'], [1, 0], 6], None)]]
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
first row candidate #1[1, 0][1, 0]Passed
distance exactly min #1[2, 0][2, 0]Passed
fault site distance threshold #1[1, 0][1, 0]Passed
fault site distance threshold #2[0, 1][0, 1]Passed
partial repair boundary #1NoneNonePassed
partial repair boundary #2NoneNonePassed
water below #1NoneNonePassed
control #1NoneNonePassed

SHA-256 / 7dc95dbe3643d60a464100a160b6396d8ce23b7a6f1478a6cc783fe66fc16778

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

Case digest / 1e3c280961af120e3366e26d6f99a7db63995a6c690da114393db6192aaeee87