FA-86436 / Procedural level generation constraints / Open access
Enemy spawn point selection: Spawns may touch each other · case 01
Enemy packs spawn stacked on adjacent tiles.
ROOT CAUSE
Spacing only rejects identical cells.
THE FAILURE
Spacing only rejects identical cells.
Unsuccessful approach: Manhattan spacing still admits diagonally touching spawns.
Case contract
Candidates [row, col] are tried in order until count spawns are chosen. A spawn must be in bounds on a '.' tile, at Chebyshev distance >= min_dist from the player and at Chebyshev distance >= 2 from every chosen spawn (no touching spawns, diagonals included). Returns chosen cells.
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, player, candidates, min_dist, count):
chosen = []
pr, pc = player
for r, c in candidates:
if len(chosen) >= count:
break
if not (0 <= r < len(grid) and 0 <= c < len(grid[0])) or grid[r][c] != '.':
continue
if max(abs(r - pr), abs(c - pc)) < min_dist:
continue
if any(max(abs(r - a), abs(c - b)) < 1 for a, b in chosen):
continue
chosen.append([r, c])
return chosen
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('regression spawn spacing #1',
[['...#', '.#..', '#.#~', '~~.~', '~~#.', '~##.', '....', '...#'],
[1, 2],
[[0, 1], [6, 4], [5, 4], [4, 1], [4, 0], [6, 1], [0, 4], [7, 2], [5, 3], [-1, 1]],
3,
2],
[[6, 1], [5, 3]]),
('fault site spawn spacing #1',
[['.~.', '#..', '.#.', '...', '..#', '.~.', '#..', '~..'],
[0, 2],
[[3, 3], [3, 1], [3, 0], [7, -1], [4, 3], [7, 1]],
3,
2],
[[3, 1], [7, 1]]),
('regression spawn spacing #2',
[['...#.#', '~.#...', '...#..', '......', '.~..~.', '#...#.', '....~.'],
[2, 4],
[[3, 4], [0, 0], [4, 3], [1, 0], [3, 2], [3, 0], [7, 0], [7, 6]],
0,
5],
[[3, 4], [0, 0], [3, 2], [3, 0]]),
('regression spawn spacing #3',
[['..~...', '#.~...', '.#....'],
[0, 5],
[[0, 3], [0, 0], [1, 1], [3, 3], [2, 1], [0, 1], [0, 5], [2, 4], [2, 3], [1, 4]],
1,
3],
[[0, 3], [0, 0], [2, 4]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
[])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('fault site spawn spacing #1',
[['.~.', '#..', '.#.', '...', '..#', '.~.', '#..', '~..'],
[0, 2],
[[3, 3], [3, 1], [3, 0], [7, -1], [4, 3], [7, 1]],
3,
2],
[[3, 1], [7, 1]]),
('regression spawn spacing #1',
[['...#.#', '~.#...', '...#..', '......', '.~..~.', '#...#.', '....~.'],
[2, 4],
[[3, 4], [0, 0], [4, 3], [1, 0], [3, 2], [3, 0], [7, 0], [7, 6]],
0,
5],
[[3, 4], [0, 0], [3, 2], [3, 0]]),
('regression spawn spacing #2',
[['..~...', '#.~...', '.#....'],
[0, 5],
[[0, 3], [0, 0], [1, 1], [3, 3], [2, 1], [0, 1], [0, 5], [2, 4], [2, 3], [1, 4]],
1,
3],
[[0, 3], [0, 0], [2, 4]]),
('regression spawn spacing #3',
[['...#.~..', '.#~.....', '.......#', '#...#..#'],
[0, 3],
[[4, -1], [2, 6], [-1, 6], [4, 8], [-1, -1], [1, -1], [1, -1], [2, 8], [4, 2], [3, 5]],
1,
2],
[[2, 6]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
[])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('regression spawn spacing #1',
[['..~...', '#.~...', '.#....'],
[0, 5],
[[0, 3], [0, 0], [1, 1], [3, 3], [2, 1], [0, 1], [0, 5], [2, 4], [2, 3], [1, 4]],
1,
3],
[[0, 3], [0, 0], [2, 4]]),
('regression spawn spacing #2',
[['...#.~..', '.#~.....', '.......#', '#...#..#'],
[0, 3],
[[4, -1], [2, 6], [-1, 6], [4, 8], [-1, -1], [1, -1], [1, -1], [2, 8], [4, 2], [3, 5]],
1,
2],
[[2, 6]]),
('regression spawn spacing #3',
[['.~..', '#...', '..~.'],
[0, 2],
[[1, 0], [3, -1], [1, 2], [-1, 1], [1, 3], [3, 0], [1, 0], [2, 1]],
1,
5],
[[1, 2]]),
('regression spawn spacing #4',
[['...', '~..', '#~~', '...'],
[2, 1],
[[0, 2], [2, -1], [1, 1], [2, 1], [2, 1], [3, -1], [2, -1], [2, 1], [-1, 3], [-1, -1]],
0,
3],
[[0, 2]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
[])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('regression spawn spacing #1',
[['.~..', '#...', '..~.'],
[0, 2],
[[1, 0], [3, -1], [1, 2], [-1, 1], [1, 3], [3, 0], [1, 0], [2, 1]],
1,
5],
[[1, 2]]),
('regression spawn spacing #2',
[['...', '~..', '#~~', '...'],
[2, 1],
[[0, 2], [2, -1], [1, 1], [2, 1], [2, 1], [3, -1], [2, -1], [2, 1], [-1, 3], [-1, -1]],
0,
3],
[[0, 2]]),
('regression spawn spacing #3',
[['..#..', '.#..~', '.##..', '~...#'], [2, 3], [[2, 1], [0, 1], [4, 3], [1, 2], [1, 0]], 0, 5],
[[0, 1]]),
('regression spawn spacing #4',
[['.#~', '.#.', '~..', '.#.', '.#.', '.##', '...'], [3, 1], [[5, 2], [1, 0], [1, 1], [2, 1]], 1, 2],
[[1, 0]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
[[1, 0]])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('fault site spawn spacing #1',
[['...', '..#', '..~', '..#', '.~.', '...', '.~.', '.~#'],
[7, 1],
[[6, 3], [-1, 0], [2, 1], [7, 1], [3, 1]],
3,
5],
[[2, 1]]),
('fault site spawn spacing #2',
[['..~.~', '..#..', '.~...', '..~.~', '.~#..', '.....', '.....'],
[0, 2],
[[2, 0], [4, 5], [5, 0], [0, 5], [5, 4], [7, 1], [-1, -1], [4, 0], [7, 3]],
3,
3],
[[5, 0], [5, 4]]),
('regression spawn spacing #1',
[['.#~', '.#.', '~..', '.#.', '.#.', '.##', '...'], [3, 1], [[5, 2], [1, 0], [1, 1], [2, 1]], 1, 2],
[[1, 0]]),
('regression spawn spacing #2',
[['#.......', '.~~..#.#', '.~......', '.#......', '..#~#...', '#.##..~.', '......~.', '.##...##'],
[6, 3],
[[0, -1], [4, 0], [1, 3], [3, 8], [5, 1], [1, -1], [5, 3], [6, 2], [0, 0], [-1, 4]],
2,
5],
[[4, 0], [1, 3]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['...#...', '......~', '~~.....', '..~....', '.~....~', '.....#.'], [5, 2], [[1, 5]], 0, 0],
[])]]
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 |
|---|---|---|---|
| diagonal neighbour spawn #1 | [[1, 2], [2, 3]] | [[1, 2]] | Failed |
| regression spawn spacing #1 | [[6, 1], [7, 2]] | [[6, 1], [5, 3]] | Failed |
| fault site spawn spacing #1 | [[3, 1], [3, 0]] | [[3, 1], [7, 1]] | Failed |
| regression spawn spacing #2 | [[3, 4], [0, 0], [4, 3], [3, 2], [3, 0]] | [[3, 4], [0, 0], [3, 2], [3, 0]] | Failed |
| regression spawn spacing #3 | [[0, 3], [0, 0], [1, 1]] | [[0, 3], [0, 0], [2, 4]] | Failed |
| exact safe radius #1 | [[0, 2]] | [[0, 2]] | Passed |
| negative index candidate #1 | [[2, 0]] | [[2, 0]] | Passed |
| control #1 | [] | [] | Passed |
SHA-256 / 5bbcdbba0eca32a6b93180dfd76586779667516d6e4235c7191e55c1f9659cc9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, player, candidates, min_dist, count):
chosen = []
pr, pc = player
for r, c in candidates:
if len(chosen) >= count:
break
if not (0 <= r < len(grid) and 0 <= c < len(grid[0])) or grid[r][c] != '.':
continue
if max(abs(r - pr), abs(c - pc)) < min_dist:
continue
if any(abs(r - a) + abs(c - b) < 2 for a, b in chosen):
continue
chosen.append([r, c])
return chosen
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('regression spawn spacing #1',
[['...#', '.#..', '#.#~', '~~.~', '~~#.', '~##.', '....', '...#'],
[1, 2],
[[0, 1], [6, 4], [5, 4], [4, 1], [4, 0], [6, 1], [0, 4], [7, 2], [5, 3], [-1, 1]],
3,
2],
[[6, 1], [5, 3]]),
('fault site spawn spacing #1',
[['.~.', '#..', '.#.', '...', '..#', '.~.', '#..', '~..'],
[0, 2],
[[3, 3], [3, 1], [3, 0], [7, -1], [4, 3], [7, 1]],
3,
2],
[[3, 1], [7, 1]]),
('regression spawn spacing #2',
[['...#.#', '~.#...', '...#..', '......', '.~..~.', '#...#.', '....~.'],
[2, 4],
[[3, 4], [0, 0], [4, 3], [1, 0], [3, 2], [3, 0], [7, 0], [7, 6]],
0,
5],
[[3, 4], [0, 0], [3, 2], [3, 0]]),
('regression spawn spacing #3',
[['..~...', '#.~...', '.#....'],
[0, 5],
[[0, 3], [0, 0], [1, 1], [3, 3], [2, 1], [0, 1], [0, 5], [2, 4], [2, 3], [1, 4]],
1,
3],
[[0, 3], [0, 0], [2, 4]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
[])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('fault site spawn spacing #1',
[['.~.', '#..', '.#.', '...', '..#', '.~.', '#..', '~..'],
[0, 2],
[[3, 3], [3, 1], [3, 0], [7, -1], [4, 3], [7, 1]],
3,
2],
[[3, 1], [7, 1]]),
('regression spawn spacing #1',
[['...#.#', '~.#...', '...#..', '......', '.~..~.', '#...#.', '....~.'],
[2, 4],
[[3, 4], [0, 0], [4, 3], [1, 0], [3, 2], [3, 0], [7, 0], [7, 6]],
0,
5],
[[3, 4], [0, 0], [3, 2], [3, 0]]),
('regression spawn spacing #2',
[['..~...', '#.~...', '.#....'],
[0, 5],
[[0, 3], [0, 0], [1, 1], [3, 3], [2, 1], [0, 1], [0, 5], [2, 4], [2, 3], [1, 4]],
1,
3],
[[0, 3], [0, 0], [2, 4]]),
('regression spawn spacing #3',
[['...#.~..', '.#~.....', '.......#', '#...#..#'],
[0, 3],
[[4, -1], [2, 6], [-1, 6], [4, 8], [-1, -1], [1, -1], [1, -1], [2, 8], [4, 2], [3, 5]],
1,
2],
[[2, 6]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
[])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('regression spawn spacing #1',
[['..~...', '#.~...', '.#....'],
[0, 5],
[[0, 3], [0, 0], [1, 1], [3, 3], [2, 1], [0, 1], [0, 5], [2, 4], [2, 3], [1, 4]],
1,
3],
[[0, 3], [0, 0], [2, 4]]),
('regression spawn spacing #2',
[['...#.~..', '.#~.....', '.......#', '#...#..#'],
[0, 3],
[[4, -1], [2, 6], [-1, 6], [4, 8], [-1, -1], [1, -1], [1, -1], [2, 8], [4, 2], [3, 5]],
1,
2],
[[2, 6]]),
('regression spawn spacing #3',
[['.~..', '#...', '..~.'],
[0, 2],
[[1, 0], [3, -1], [1, 2], [-1, 1], [1, 3], [3, 0], [1, 0], [2, 1]],
1,
5],
[[1, 2]]),
('regression spawn spacing #4',
[['...', '~..', '#~~', '...'],
[2, 1],
[[0, 2], [2, -1], [1, 1], [2, 1], [2, 1], [3, -1], [2, -1], [2, 1], [-1, 3], [-1, -1]],
0,
3],
[[0, 2]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
[])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('regression spawn spacing #1',
[['.~..', '#...', '..~.'],
[0, 2],
[[1, 0], [3, -1], [1, 2], [-1, 1], [1, 3], [3, 0], [1, 0], [2, 1]],
1,
5],
[[1, 2]]),
('regression spawn spacing #2',
[['...', '~..', '#~~', '...'],
[2, 1],
[[0, 2], [2, -1], [1, 1], [2, 1], [2, 1], [3, -1], [2, -1], [2, 1], [-1, 3], [-1, -1]],
0,
3],
[[0, 2]]),
('regression spawn spacing #3',
[['..#..', '.#..~', '.##..', '~...#'], [2, 3], [[2, 1], [0, 1], [4, 3], [1, 2], [1, 0]], 0, 5],
[[0, 1]]),
('regression spawn spacing #4',
[['.#~', '.#.', '~..', '.#.', '.#.', '.##', '...'], [3, 1], [[5, 2], [1, 0], [1, 1], [2, 1]], 1, 2],
[[1, 0]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
[[1, 0]])],
[('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
('fault site spawn spacing #1',
[['...', '..#', '..~', '..#', '.~.', '...', '.~.', '.~#'],
[7, 1],
[[6, 3], [-1, 0], [2, 1], [7, 1], [3, 1]],
3,
5],
[[2, 1]]),
('fault site spawn spacing #2',
[['..~.~', '..#..', '.~...', '..~.~', '.~#..', '.....', '.....'],
[0, 2],
[[2, 0], [4, 5], [5, 0], [0, 5], [5, 4], [7, 1], [-1, -1], [4, 0], [7, 3]],
3,
3],
[[5, 0], [5, 4]]),
('regression spawn spacing #1',
[['.#~', '.#.', '~..', '.#.', '.#.', '.##', '...'], [3, 1], [[5, 2], [1, 0], [1, 1], [2, 1]], 1, 2],
[[1, 0]]),
('regression spawn spacing #2',
[['#.......', '.~~..#.#', '.~......', '.#......', '..#~#...', '#.##..~.', '......~.', '.##...##'],
[6, 3],
[[0, -1], [4, 0], [1, 3], [3, 8], [5, 1], [1, -1], [5, 3], [6, 2], [0, 0], [-1, 4]],
2,
5],
[[4, 0], [1, 3]]),
('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
('control #1',
[['...#...', '......~', '~~.....', '..~....', '.~....~', '.....#.'], [5, 2], [[1, 5]], 0, 0],
[])]]
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 |
|---|---|---|---|
| diagonal neighbour spawn #1 | [[1, 2], [2, 3]] | [[1, 2]] | Failed |
| regression spawn spacing #1 | [[6, 1], [7, 2]] | [[6, 1], [5, 3]] | Failed |
| fault site spawn spacing #1 | [[3, 1], [7, 1]] | [[3, 1], [7, 1]] | Passed |
| regression spawn spacing #2 | [[3, 4], [0, 0], [4, 3], [3, 2], [3, 0]] | [[3, 4], [0, 0], [3, 2], [3, 0]] | Failed |
| regression spawn spacing #3 | [[0, 3], [0, 0], [1, 1]] | [[0, 3], [0, 0], [2, 4]] | Failed |
| exact safe radius #1 | [[0, 2]] | [[0, 2]] | Passed |
| negative index candidate #1 | [[2, 0]] | [[2, 0]] | Passed |
| control #1 | [] | [] | Passed |
SHA-256 / 2e8641b550d6971be9d72b05922d3bdaabb63f7064e64bc26ae5616ffce8909e
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:49.547025+00:00.
Case digest / 8a29a2f67243ddb79b435840e1dac2f35809f253b0b42732c8124da3346fdfd3