FA-86666 / Procedural level generation constraints / Open access
Wall autotile bitmask: Floors look like isolated pillars · case 01
Floor cells receive the isolated-wall sprite.
ROOT CAUSE
Non-wall cells are given mask 0, which is the isolated wall piece.
VERIFIED REPAIR
Restore `row.append(-1)` at the non-wall marker step.
Unsuccessful approach: Only plain floor gets -1; doors and chasms still look like pillars.
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(0)
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 non-wall marker #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression non-wall marker #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 non-wall marker #3', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression non-wall marker #4', [['####D'], False], [[2, 10, 10, 8, -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]]),
('regression non-wall marker #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 non-wall marker #2', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression non-wall marker #3', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression non-wall marker #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', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #1', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression non-wall marker #2', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('regression non-wall marker #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 non-wall marker #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', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #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 non-wall marker #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 non-wall marker #3', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression non-wall marker #4', [['~', '~'], True], [[-1], [-1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['#'], False], [[0]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression non-wall marker #2', [['~', '~'], True], [[-1], [-1]]),
('regression non-wall marker #3', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression non-wall marker #4',
[['#~~', '..D', '~#.', 'D.D'], False],
[[0, -1, -1], [-1, -1, -1], [-1, 0, -1], [-1, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['##'], False], [[2, 8]])]]
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, 0]] | [[0, -1]] | Failed |
| regression non-wall marker #1 | [[0, 1, 0], [12, 0, 0]] | [[-1, 1, -1], [12, -1, -1]] | Failed |
| regression non-wall marker #2 | [[0, 7, 11, 11], [10, 9, 0, 0], [0, 0, 0, 0], [12, 0, 0, 0], [13, 0, 0, 6]] | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | Failed |
| regression non-wall marker #3 | [[11, 9, 0], [0, 0, 2], [14, 12, 0]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Failed |
| regression non-wall marker #4 | [[2, 10, 10, 8, 0]] | [[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 | [[4], [5], [1]] | [[4], [5], [1]] | Passed |
SHA-256 / 879e0712de1e4365ed8ff5dcf00199021a90af8203e454866f55d24cc4e07716
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 if grid[r][c] == '.' else 0)
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 non-wall marker #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression non-wall marker #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 non-wall marker #3', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression non-wall marker #4', [['####D'], False], [[2, 10, 10, 8, -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]]),
('regression non-wall marker #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 non-wall marker #2', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression non-wall marker #3', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression non-wall marker #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', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #1', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression non-wall marker #2', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('regression non-wall marker #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 non-wall marker #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', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #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 non-wall marker #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 non-wall marker #3', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression non-wall marker #4', [['~', '~'], True], [[-1], [-1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['#'], False], [[0]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression non-wall marker #2', [['~', '~'], True], [[-1], [-1]]),
('regression non-wall marker #3', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression non-wall marker #4',
[['#~~', '..D', '~#.', 'D.D'], False],
[[0, -1, -1], [-1, -1, -1], [-1, 0, -1], [-1, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['##'], False], [[2, 8]])]]
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, 0]] | [[0, -1]] | Failed |
| regression non-wall marker #1 | [[-1, 1, 0], [12, -1, 0]] | [[-1, 1, -1], [12, -1, -1]] | Failed |
| regression non-wall marker #2 | [[0, 7, 11, 11], [10, 9, 0, -1], [0, 0, 0, -1], [12, 0, 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]] | Failed |
| regression non-wall marker #3 | [[11, 9, 0], [-1, -1, 2], [14, 12, 0]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Failed |
| regression non-wall marker #4 | [[2, 10, 10, 8, 0]] | [[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 | [[4], [5], [1]] | [[4], [5], [1]] | Passed |
SHA-256 / 44da59e2c510fbb96c0a8e12fd8244701e54e15980613528d0c41faebc6393dd
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 non-wall marker #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression non-wall marker #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 non-wall marker #3', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression non-wall marker #4', [['####D'], False], [[2, 10, 10, 8, -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]]),
('regression non-wall marker #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 non-wall marker #2', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression non-wall marker #3', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression non-wall marker #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', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #1', [['####D'], False], [[2, 10, 10, 8, -1]]),
('regression non-wall marker #2', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]]),
('regression non-wall marker #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 non-wall marker #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', [['#', '#', '#'], False], [[4], [5], [1]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #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 non-wall marker #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 non-wall marker #3', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression non-wall marker #4', [['~', '~'], True], [[-1], [-1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['#'], False], [[0]])],
[('door next to wall #1', [['#D'], False], [[0, -1]]),
('regression non-wall marker #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression non-wall marker #2', [['~', '~'], True], [[-1], [-1]]),
('regression non-wall marker #3', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression non-wall marker #4',
[['#~~', '..D', '~#.', 'D.D'], False],
[[0, -1, -1], [-1, -1, -1], [-1, 0, -1], [-1, -1, -1]]),
('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['##'], False], [[2, 8]])]]
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 non-wall marker #1 | [[-1, 1, -1], [12, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Passed |
| regression non-wall marker #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 non-wall marker #3 | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Passed |
| regression non-wall marker #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 | [[4], [5], [1]] | [[4], [5], [1]] | Passed |
SHA-256 / fde6de4680f1aa9a457df5aa618482357671b5b588f8c99dab29737db2bf8f9e
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.541943+00:00.
Case digest / 29a7eec874f875a16f065e912ea43a58073434d4f112f373567890a157ef743a