FAILURE MAP
← Case archive

FA-86816 / Procedural level generation constraints / Open access

Door placement between rooms: Stacked rooms compared on the x axis · case 01

Vertically stacked rooms are only connected by coincidence.

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

ROOT CAUSE

The stacked-room test compares against the neighbour x coordinate.

VERIFIED REPAIR

Restore `if py + ph + 1 == qy:` at the stacked axis step.

Unsuccessful approach: Dropping the wall tile connects touching stacked rooms.

Case contract

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. 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(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qx:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[10, 3, 5, 4], [8, 0, 3, 1]], None),
  ('fault site stacked axis #2', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('partial repair boundary #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('partial repair boundary #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('regression stacked axis #1', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('partial repair boundary #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('partial repair boundary #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #2', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('partial repair boundary #1', [[5, 5, 2, 5], [5, 1, 6, 3]], [5, 4]),
  ('partial repair boundary #2', [[3, 9, 6, 5], [2, 4, 4, 5]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[7, 6, 5, 5], [3, 0, 6, 5]], [7, 5]),
  ('regression stacked axis #2', [[4, 13, 5, 2], [3, 9, 2, 3]], [4, 12]),
  ('partial repair boundary #1', [[9, 6, 5, 2], [9, 9, 3, 6]], [10, 8]),
  ('regression stacked axis #3', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[9, 5, 4, 3], [9, 3, 5, 1]], [10, 4]),
  ('regression stacked axis #2', [[9, 6, 4, 6], [8, 13, 6, 4]], [10, 12]),
  ('regression stacked axis #3', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #4', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[7, 2, 4, 4], [4, 3, 3, 3]], 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
stacked reversed order #1None[3, 4]Failed
fault site stacked axis #1[10, 7]NoneFailed
fault site stacked axis #2[5, 3]NoneFailed
partial repair boundary #1NoneNonePassed
partial repair boundary #2NoneNonePassed
side by side #1[3, 2][3, 2]Passed
rooms touching without wall #1NoneNonePassed
control #1[5, 10][5, 10]Passed

SHA-256 / 59c4df3786d0e295b7e470f8414ee3767c6a5d561be47711e6843601f9b978d5

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[10, 3, 5, 4], [8, 0, 3, 1]], None),
  ('fault site stacked axis #2', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('partial repair boundary #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('partial repair boundary #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('regression stacked axis #1', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('partial repair boundary #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('partial repair boundary #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #2', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('partial repair boundary #1', [[5, 5, 2, 5], [5, 1, 6, 3]], [5, 4]),
  ('partial repair boundary #2', [[3, 9, 6, 5], [2, 4, 4, 5]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[7, 6, 5, 5], [3, 0, 6, 5]], [7, 5]),
  ('regression stacked axis #2', [[4, 13, 5, 2], [3, 9, 2, 3]], [4, 12]),
  ('partial repair boundary #1', [[9, 6, 5, 2], [9, 9, 3, 6]], [10, 8]),
  ('regression stacked axis #3', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[9, 5, 4, 3], [9, 3, 5, 1]], [10, 4]),
  ('regression stacked axis #2', [[9, 6, 4, 6], [8, 13, 6, 4]], [10, 12]),
  ('regression stacked axis #3', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #4', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[7, 2, 4, 4], [4, 3, 3, 3]], 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
stacked reversed order #1None[3, 4]Failed
fault site stacked axis #1NoneNonePassed
fault site stacked axis #2NoneNonePassed
partial repair boundary #1[7, 10]NoneFailed
partial repair boundary #2[8, 5]NoneFailed
side by side #1[3, 2][3, 2]Passed
rooms touching without wall #1NoneNonePassed
control #1[5, 10][5, 10]Passed

SHA-256 / 56811f4c5db43ae13e1fed2d42bb4bf099eb9f361f15efd4b75149e1b73b0520

3 / The verified repair

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

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[10, 3, 5, 4], [8, 0, 3, 1]], None),
  ('fault site stacked axis #2', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('partial repair boundary #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('partial repair boundary #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('regression stacked axis #1', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('partial repair boundary #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('partial repair boundary #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #2', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('partial repair boundary #1', [[5, 5, 2, 5], [5, 1, 6, 3]], [5, 4]),
  ('partial repair boundary #2', [[3, 9, 6, 5], [2, 4, 4, 5]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[7, 6, 5, 5], [3, 0, 6, 5]], [7, 5]),
  ('regression stacked axis #2', [[4, 13, 5, 2], [3, 9, 2, 3]], [4, 12]),
  ('partial repair boundary #1', [[9, 6, 5, 2], [9, 9, 3, 6]], [10, 8]),
  ('regression stacked axis #3', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[9, 5, 4, 3], [9, 3, 5, 1]], [10, 4]),
  ('regression stacked axis #2', [[9, 6, 4, 6], [8, 13, 6, 4]], [10, 12]),
  ('regression stacked axis #3', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #4', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[7, 2, 4, 4], [4, 3, 3, 3]], 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
stacked reversed order #1[3, 4][3, 4]Passed
fault site stacked axis #1NoneNonePassed
fault site stacked axis #2NoneNonePassed
partial repair boundary #1NoneNonePassed
partial repair boundary #2NoneNonePassed
side by side #1[3, 2][3, 2]Passed
rooms touching without wall #1NoneNonePassed
control #1[5, 10][5, 10]Passed

SHA-256 / a88aa185e30010a3d8aeb065dbe210425f02cdcb94726254f6e06bc525072f2c

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

Case digest / 330a2e50c2675d7c5256bc04c9d94f5c26e9cc64885d3f903fdd6ccbb6658209