FA-86676 / Procedural level generation constraints / Open access
Wall autotile bitmask: Doors and chasms connect walls · case 01
Walls visually merge into doorways.
ROOT CAUSE
Any non-floor neighbour sets the bit.
VERIFIED REPAIR
Restore `if grid[rr][cc] == '#':` at the neighbour wall test step.
Unsuccessful approach: Doors still count as connecting walls.
Case contract
For each '#' cell the mask sums N=1, E=2, S=4, W=8 for 4-neighbours that are '#' (row 0 is north). Out-of-bounds neighbours count as walls when same_oob. Non-wall cells get -1. Returns rows of integers.
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(grid, same_oob):
h = len(grid)
w = len(grid[0])
out = []
for r in range(h):
row = []
for c in range(w):
if grid[r][c] != '#':
row.append(-1)
continue
m = 0
for bit, (dr, dc) in ((1, (-1, 0)), (2, (0, 1)), (4, (1, 0)), (8, (0, -1))):
rr, cc = r + dr, c + dc
if 0 <= rr < h and 0 <= cc < w:
if grid[rr][cc] != '.':
m |= bit
elif same_oob:
m |= bit
row.append(m)
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression neighbour wall test #2',
[['~###', '##~.', 'D~~.', '#D#.', '#..#'], True],
[[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]]),
('regression neighbour wall test #3',
[['##D', '..#', '##D'], True],
[[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression neighbour wall test #4', [['####D'], False], [[2, 10, 10, 8, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1',
[['~###', '##~.', 'D~~.', '#D#.', '#..#'], True],
[[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]]),
('regression neighbour wall test #2',
[['##D', '..#', '##D'], True],
[[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression neighbour wall test #3', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression neighbour wall test #4', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression neighbour wall test #2', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('regression neighbour wall test #3',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('regression neighbour wall test #4',
[['#..D.', '.##.#', '..##D', 'D.#.D'], False],
[[0, -1, -1, -1, -1], [-1, 2, 12, -1, 0], [-1, -1, 7, 8, -1], [-1, -1, 1, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('regression neighbour wall test #2',
[['#..D.', '.##.#', '..##D', 'D.#.D'], False],
[[0, -1, -1, -1, -1], [-1, 2, 12, -1, 0], [-1, -1, 7, 8, -1], [-1, -1, 1, -1, -1]]),
('regression neighbour wall test #3', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression neighbour wall test #4',
[['~D.D#', '#~.#D'], True],
[[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('fault site neighbour wall test #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression neighbour wall test #1', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression neighbour wall test #2',
[['~D.D#', '#~.#D'], True],
[[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('regression neighbour wall test #3',
[['~#.~', '.D~#', '###~', '#~#D', '.##.'], False],
[[-1, 0, -1, -1], [-1, -1, -1, 0], [6, 10, 12, -1], [1, -1, 5, -1], [-1, 2, 9, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['.'], True], [[-1]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| door next to wall #1 | [[2, -1]] | [[0, -1]] | Failed |
| regression neighbour wall test #1 | [[-1, 3, -1], [12, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Failed |
| regression neighbour wall test #2 | [[-1, 15, 15, 11], [15, 15, -1, -1], [-1, -1, -1, -1], [15, -1, 9, -1], [13, -1, -1, 6]] | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | Failed |
| regression neighbour wall test #3 | [[11, 11, -1], [-1, -1, 7], [14, 14, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Failed |
| regression neighbour wall test #4 | [[2, 10, 10, 10, -1]] | [[2, 10, 10, 8, -1]] | Failed |
| vertical wall pair #1 | [[4], [1]] | [[4], [1]] | Passed |
| lone wall at edge #1 | [[15]] | [[15]] | Passed |
| control #1 | [[-1], [-1]] | [[-1], [-1]] | Passed |
SHA-256 / 7172330129696ef65e46a2a781053fea150268cda06ca75e988bcdfb6261101e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, same_oob):
h = len(grid)
w = len(grid[0])
out = []
for r in range(h):
row = []
for c in range(w):
if grid[r][c] != '#':
row.append(-1)
continue
m = 0
for bit, (dr, dc) in ((1, (-1, 0)), (2, (0, 1)), (4, (1, 0)), (8, (0, -1))):
rr, cc = r + dr, c + dc
if 0 <= rr < h and 0 <= cc < w:
if grid[rr][cc] in '#D':
m |= bit
elif same_oob:
m |= bit
row.append(m)
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression neighbour wall test #2',
[['~###', '##~.', 'D~~.', '#D#.', '#..#'], True],
[[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]]),
('regression neighbour wall test #3',
[['##D', '..#', '##D'], True],
[[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression neighbour wall test #4', [['####D'], False], [[2, 10, 10, 8, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1',
[['~###', '##~.', 'D~~.', '#D#.', '#..#'], True],
[[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]]),
('regression neighbour wall test #2',
[['##D', '..#', '##D'], True],
[[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression neighbour wall test #3', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression neighbour wall test #4', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression neighbour wall test #2', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('regression neighbour wall test #3',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('regression neighbour wall test #4',
[['#..D.', '.##.#', '..##D', 'D.#.D'], False],
[[0, -1, -1, -1, -1], [-1, 2, 12, -1, 0], [-1, -1, 7, 8, -1], [-1, -1, 1, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('regression neighbour wall test #2',
[['#..D.', '.##.#', '..##D', 'D.#.D'], False],
[[0, -1, -1, -1, -1], [-1, 2, 12, -1, 0], [-1, -1, 7, 8, -1], [-1, -1, 1, -1, -1]]),
('regression neighbour wall test #3', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression neighbour wall test #4',
[['~D.D#', '#~.#D'], True],
[[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('fault site neighbour wall test #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression neighbour wall test #1', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression neighbour wall test #2',
[['~D.D#', '#~.#D'], True],
[[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('regression neighbour wall test #3',
[['~#.~', '.D~#', '###~', '#~#D', '.##.'], False],
[[-1, 0, -1, -1], [-1, -1, -1, 0], [6, 10, 12, -1], [1, -1, 5, -1], [-1, 2, 9, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['.'], True], [[-1]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| door next to wall #1 | [[2, -1]] | [[0, -1]] | Failed |
| regression neighbour wall test #1 | [[-1, 3, -1], [12, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Failed |
| regression neighbour wall test #2 | [[-1, 7, 11, 11], [14, 9, -1, -1], [-1, -1, -1, -1], [15, -1, 8, -1], [13, -1, -1, 6]] | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | Failed |
| regression neighbour wall test #3 | [[11, 11, -1], [-1, -1, 7], [14, 14, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Failed |
| regression neighbour wall test #4 | [[2, 10, 10, 10, -1]] | [[2, 10, 10, 8, -1]] | Failed |
| vertical wall pair #1 | [[4], [1]] | [[4], [1]] | Passed |
| lone wall at edge #1 | [[15]] | [[15]] | Passed |
| control #1 | [[-1], [-1]] | [[-1], [-1]] | Passed |
SHA-256 / 7ed1c4d01b4b9038b047fd49cbf6b64483e8e839d67dde69ba9567262a8a4b4e
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, same_oob):
h = len(grid)
w = len(grid[0])
out = []
for r in range(h):
row = []
for c in range(w):
if grid[r][c] != '#':
row.append(-1)
continue
m = 0
for bit, (dr, dc) in ((1, (-1, 0)), (2, (0, 1)), (4, (1, 0)), (8, (0, -1))):
rr, cc = r + dr, c + dc
if 0 <= rr < h and 0 <= cc < w:
if grid[rr][cc] == '#':
m |= bit
elif same_oob:
m |= bit
row.append(m)
out.append(row)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression neighbour wall test #2',
[['~###', '##~.', 'D~~.', '#D#.', '#..#'], True],
[[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]]),
('regression neighbour wall test #3',
[['##D', '..#', '##D'], True],
[[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression neighbour wall test #4', [['####D'], False], [[2, 10, 10, 8, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1',
[['~###', '##~.', 'D~~.', '#D#.', '#..#'], True],
[[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]]),
('regression neighbour wall test #2',
[['##D', '..#', '##D'], True],
[[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression neighbour wall test #3', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression neighbour wall test #4', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression neighbour wall test #2', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('regression neighbour wall test #3',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('regression neighbour wall test #4',
[['#..D.', '.##.#', '..##D', 'D.#.D'], False],
[[0, -1, -1, -1, -1], [-1, 2, 12, -1, 0], [-1, -1, 7, 8, -1], [-1, -1, 1, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression neighbour wall test #1',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('regression neighbour wall test #2',
[['#..D.', '.##.#', '..##D', 'D.#.D'], False],
[[0, -1, -1, -1, -1], [-1, 2, 12, -1, 0], [-1, -1, 7, 8, -1], [-1, -1, 1, -1, -1]]),
('regression neighbour wall test #3', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression neighbour wall test #4',
[['~D.D#', '#~.#D'], True],
[[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('fault site neighbour wall test #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression neighbour wall test #1', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression neighbour wall test #2',
[['~D.D#', '#~.#D'], True],
[[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('regression neighbour wall test #3',
[['~#.~', '.D~#', '###~', '#~#D', '.##.'], False],
[[-1, 0, -1, -1], [-1, -1, -1, 0], [6, 10, 12, -1], [1, -1, 5, -1], [-1, 2, 9, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['.'], True], [[-1]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| door next to wall #1 | [[0, -1]] | [[0, -1]] | Passed |
| regression neighbour wall test #1 | [[-1, 1, -1], [12, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Passed |
| regression neighbour wall test #2 | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | Passed |
| regression neighbour wall test #3 | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Passed |
| regression neighbour wall test #4 | [[2, 10, 10, 8, -1]] | [[2, 10, 10, 8, -1]] | Passed |
| vertical wall pair #1 | [[4], [1]] | [[4], [1]] | Passed |
| lone wall at edge #1 | [[15]] | [[15]] | Passed |
| control #1 | [[-1], [-1]] | [[-1], [-1]] | Passed |
SHA-256 / 3aba51309c1c0dd6727446368390851dfb638ad028aac0a456c037b266821711
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.854842+00:00.
Case digest / 7f9b07eb110e52943fc621d91a13b7db0d3c45814d94c1ad17a04e922f0a56a4