FA-86661 / Procedural level generation constraints / Open access
Wall autotile bitmask: North bit samples the south neighbour · case 01
Wall tops render as if the wall continued below.
ROOT CAUSE
The north bit uses a +1 row offset (y-up assumption) on a row-0-north grid.
VERIFIED REPAIR
Restore `((1, (-1, 0)), (2, (0, 1)), (4, (1, 0)), (8, (0, -1)))` at the north offset step.
Unsuccessful approach: Swapping north and south bits mirrors every vertical wall piece.
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 = [[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression north offset #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 north offset #3', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression north offset #4',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #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 north offset #2', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression north offset #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 north offset #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]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #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 north offset #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 north offset #3', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression north offset #4', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression north offset #2', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression north offset #3', [['#', '#', '#'], False], [[4], [5], [1]]),
('regression north offset #4', [['~D.D#', '#~.#D'], True], [[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['#', '#', '#'], False], [[4], [5], [1]]),
('regression north offset #2', [['~D.D#', '#~.#D'], True], [[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('regression north offset #3',
[['~#.~', '.D~#', '###~', '#~#D', '.##.'], False],
[[-1, 0, -1, -1], [-1, -1, -1, 0], [6, 10, 12, -1], [1, -1, 5, -1], [-1, 2, 9, -1]]),
('regression north offset #4',
[['D#DD', '#D.~', '###~', '#~##'], False],
[[-1, 0, -1, -1], [4, -1, -1, -1], [7, 10, 12, -1], [1, -1, 3, 8]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-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 |
|---|---|---|---|
| vertical wall pair #1 | [[5], [0]] | [[4], [1]] | Failed |
| regression north offset #1 | [[-1, 0, -1], [13, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Failed |
| regression north offset #2 | [[-1, 7, 10, 10], [10, 8, -1, -1], [-1, -1, -1, -1], [13, -1, 0, -1], [13, -1, -1, 7]] | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | Failed |
| regression north offset #3 | [[10, 8, -1], [-1, -1, 2], [15, 13, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Failed |
| regression north offset #4 | [[10, 8, -1, -1], [-1, -1, 0, -1], [15, 8, -1, -1], [8, -1, 0, -1], [-1, -1, -1, 7]] | [[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]] | Failed |
| door next to wall #1 | [[0, -1]] | [[0, -1]] | Passed |
| lone wall at edge #1 | [[15]] | [[15]] | Passed |
| control #1 | [[2, 10, 10, 8, -1]] | [[2, 10, 10, 8, -1]] | Passed |
SHA-256 / f92e8011073b178b92fd0ad0e2e2663548af3de1d96b55a34013c344856d7751
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] == '#':
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 = [[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression north offset #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 north offset #3', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression north offset #4',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #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 north offset #2', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression north offset #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 north offset #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]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #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 north offset #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 north offset #3', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression north offset #4', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression north offset #2', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression north offset #3', [['#', '#', '#'], False], [[4], [5], [1]]),
('regression north offset #4', [['~D.D#', '#~.#D'], True], [[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['#', '#', '#'], False], [[4], [5], [1]]),
('regression north offset #2', [['~D.D#', '#~.#D'], True], [[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('regression north offset #3',
[['~#.~', '.D~#', '###~', '#~#D', '.##.'], False],
[[-1, 0, -1, -1], [-1, -1, -1, 0], [6, 10, 12, -1], [1, -1, 5, -1], [-1, 2, 9, -1]]),
('regression north offset #4',
[['D#DD', '#D.~', '###~', '#~##'], False],
[[-1, 0, -1, -1], [4, -1, -1, -1], [7, 10, 12, -1], [1, -1, 3, 8]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-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 |
|---|---|---|---|
| vertical wall pair #1 | [[1], [4]] | [[4], [1]] | Failed |
| regression north offset #1 | [[-1, 4, -1], [9, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Failed |
| regression north offset #2 | [[-1, 7, 14, 14], [10, 12, -1, -1], [-1, -1, -1, -1], [9, -1, 0, -1], [13, -1, -1, 3]] | [[-1, 7, 11, 11], [10, 9, -1, -1], [-1, -1, -1, -1], [12, -1, 0, -1], [13, -1, -1, 6]] | Failed |
| regression north offset #3 | [[14, 12, -1], [-1, -1, 2], [11, 9, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Failed |
| regression north offset #4 | [[14, 12, -1, -1], [-1, -1, 0, -1], [11, 8, -1, -1], [12, -1, 0, -1], [-1, -1, -1, 3]] | [[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]] | Failed |
| door next to wall #1 | [[0, -1]] | [[0, -1]] | Passed |
| lone wall at edge #1 | [[15]] | [[15]] | Passed |
| control #1 | [[2, 10, 10, 8, -1]] | [[2, 10, 10, 8, -1]] | Passed |
SHA-256 / b554f8bd5153669ceb33349d2a53158a21aaa6f19fd23b8b46abf93558235108
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 = [[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['.#D', '#.~'], True], [[-1, 1, -1], [12, -1, -1]]),
('regression north offset #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 north offset #3', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression north offset #4',
[['##.D', '.D#~', '##..', '#.#~', '~D.#'], True],
[[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #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 north offset #2', [['##D', '..#', '##D'], True], [[11, 9, -1], [-1, -1, 2], [14, 12, -1]]),
('regression north offset #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 north offset #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]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #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 north offset #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 north offset #3', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression north offset #4', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['####D'], False], [[2, 10, 10, 8, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['~#', '.~', '.#'], True], [[-1, 3], [-1, -1], [-1, 6]]),
('regression north offset #2', [['~.#', '##D'], True], [[-1, -1, 3], [14, 12, -1]]),
('regression north offset #3', [['#', '#', '#'], False], [[4], [5], [1]]),
('regression north offset #4', [['~D.D#', '#~.#D'], True], [[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['D~#', '#~.'], False], [[-1, -1, 0], [0, -1, -1]])],
[('vertical wall pair #1', [['#', '#'], False], [[4], [1]]),
('regression north offset #1', [['#', '#', '#'], False], [[4], [5], [1]]),
('regression north offset #2', [['~D.D#', '#~.#D'], True], [[-1, -1, -1, -1, 3], [12, -1, -1, 4, -1]]),
('regression north offset #3',
[['~#.~', '.D~#', '###~', '#~#D', '.##.'], False],
[[-1, 0, -1, -1], [-1, -1, -1, 0], [6, 10, 12, -1], [1, -1, 5, -1], [-1, 2, 9, -1]]),
('regression north offset #4',
[['D#DD', '#D.~', '###~', '#~##'], False],
[[-1, 0, -1, -1], [4, -1, -1, -1], [7, 10, 12, -1], [1, -1, 3, 8]]),
('door next to wall #1', [['#D'], False], [[0, -1]]),
('lone wall at edge #1', [['#'], True], [[15]]),
('control #1', [['~', '~'], True], [[-1], [-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 |
|---|---|---|---|
| vertical wall pair #1 | [[4], [1]] | [[4], [1]] | Passed |
| regression north offset #1 | [[-1, 1, -1], [12, -1, -1]] | [[-1, 1, -1], [12, -1, -1]] | Passed |
| regression north offset #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 north offset #3 | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | [[11, 9, -1], [-1, -1, 2], [14, 12, -1]] | Passed |
| regression north offset #4 | [[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]] | [[11, 9, -1, -1], [-1, -1, 0, -1], [14, 8, -1, -1], [9, -1, 0, -1], [-1, -1, -1, 6]] | Passed |
| door next to wall #1 | [[0, -1]] | [[0, -1]] | Passed |
| lone wall at edge #1 | [[15]] | [[15]] | Passed |
| control #1 | [[2, 10, 10, 8, -1]] | [[2, 10, 10, 8, -1]] | Passed |
SHA-256 / 6ffdc4fb6a623613f8c5ba2784c4ab9f80dcb251bbbe008ab45c20982cb070a9
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.497961+00:00.
Case digest / 630cf2cb234083cb97191bad7d14e886d4b4b285be219b1801138079db992a00