FA-86431 / Procedural level generation constraints / Open access
Enemy spawn point selection: Spawns at the exact safe radius are rejected · case 01
Small arenas end up with no valid spawns.
ROOT CAUSE
The safe-radius test rejects cells at exactly min_dist.
THE FAILURE
The safe-radius test rejects cells at exactly min_dist.
Unsuccessful approach: Relaxing the radius by one lets spawns inside the safe zone.
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)) < 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 = [[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('fault site safe radius boundary #1',
[['.~.', '#..', '.#.', '...', '..#', '.~.', '#..', '~..'],
[0, 2],
[[3, 3], [3, 1], [3, 0], [7, -1], [4, 3], [7, 1]],
3,
2],
[[3, 1], [7, 1]]),
('regression safe radius boundary #1',
[['......', '..#...', '...~..', '.~#...', '~..~~.'],
[1, 3],
[[0, 0], [-1, 4], [-1, 2], [5, 4], [5, 1], [5, 1], [3, 5], [5, 6], [1, 4], [5, 2]],
3,
3],
[[0, 0]]),
('partial repair boundary #1',
[['..~##.', '~..~..', '.~~#.~'], [0, 3], [[1, 4], [-1, 6], [1, 1], [2, 4], [2, 2], [1, 0]], 3, 5],
[]),
('partial repair boundary #2',
[['...', '#..', '.~~', '#~.', '.~.', '~..'], [2, 1], [[-1, 0], [1, 1], [3, 2], [4, 3]], 2, 1],
[]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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],
[])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('regression safe radius boundary #1',
[['......', '..#...', '...~..', '.~#...', '~..~~.'],
[1, 3],
[[0, 0], [-1, 4], [-1, 2], [5, 4], [5, 1], [5, 1], [3, 5], [5, 6], [1, 4], [5, 2]],
3,
3],
[[0, 0]]),
('fault site safe radius boundary #1',
[['.~..', '#...', '..~~', '#...', '..~.'],
[3, 0],
[[0, 4], [5, 3], [3, 2], [4, -1], [-1, -1], [2, 0], [1, 2], [1, -1], [0, 1]],
1,
3],
[[3, 2], [2, 0], [1, 2]]),
('partial repair boundary #1',
[['..~##.', '~..~..', '.~~#.~'], [0, 3], [[1, 4], [-1, 6], [1, 1], [2, 4], [2, 2], [1, 0]], 3, 5],
[]),
('partial repair boundary #2',
[['...', '#..', '.~~', '#~.', '.~.', '~..'], [2, 1], [[-1, 0], [1, 1], [3, 2], [4, 3]], 2, 1],
[]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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],
[])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('fault site safe radius boundary #1',
[['##..~..', '...~...', '##.....'],
[0, 2],
[[1, -1], [-1, 3], [3, 2], [1, 0], [1, 0], [0, 5], [1, -1], [0, 3]],
2,
2],
[[1, 0], [0, 5]]),
('fault site safe radius boundary #2',
[['.~..', '#...', '..~.'],
[0, 2],
[[1, 0], [3, -1], [1, 2], [-1, 1], [1, 3], [3, 0], [1, 0], [2, 1]],
1,
5],
[[1, 2]]),
('partial repair boundary #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]]),
('partial repair boundary #2',
[['~...', '.~..', '.#..', '#.~.', '....', '...#', '..#.', '~~.#'],
[5, 2],
[[8, 4], [4, -1], [8, -1], [4, 3]],
2,
1],
[]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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],
[])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('regression safe radius boundary #1',
[['.~....##', '......#.', '~...#..#', '~......~'],
[2, 3],
[[-1, 3], [0, 1], [1, -1], [1, 2], [2, 5], [1, 3]],
2,
1],
[[2, 5]]),
('fault site safe radius boundary #1',
[['...', '.~.', '.~.', '.#.', '...', '..~', '...'],
[0, 1],
[[3, 2], [7, 1], [4, -1], [1, 1], [1, 0]],
3,
5],
[[3, 2]]),
('partial repair boundary #1',
[['~..', '~.#', '..#', '.#.', '##.'], [1, 0], [[3, 3], [4, 3], [2, 0], [0, 0]], 2, 1],
[]),
('partial repair boundary #2',
[['~...', '....', '~~..', '.#..', '...~', '~.~.', '..~.'],
[2, 2],
[[3, 3], [3, 2], [2, 0], [6, 3], [7, 2], [7, 1], [7, 2], [0, 3]],
3,
3],
[[6, 3]]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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]])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('regression safe radius boundary #1',
[['...~~...', '#.~....#', '....#...'], [0, 6], [[1, 1], [2, 8], [1, 6], [1, 4]], 2, 5],
[[1, 1], [1, 4]]),
('fault site safe radius boundary #1',
[['.....', '.#~~~', '.~##.', '.....', '~..~#', '....#', '##.##', '...~~'],
[4, 0],
[[5, 1], [3, 3], [7, 0], [6, 4], [8, 3], [1, 3], [6, 4]],
1,
3],
[[5, 1], [3, 3], [7, 0]]),
('partial repair boundary #1',
[['...~#.~~', '....#...', '......~~', '.....#..', '.~....#.', '##....##', '~....~.#'],
[5, 7],
[[7, 6], [3, 1], [4, 7], [-1, 8]],
2,
5],
[[3, 1]]),
('regression safe radius boundary #2',
[['.~....##', '......#.', '~...#..#', '~......~'],
[2, 3],
[[-1, 3], [0, 1], [1, -1], [1, 2], [2, 5], [1, 3]],
2,
1],
[[2, 5]]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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 |
|---|---|---|---|
| exact safe radius #1 | [] | [[0, 2]] | Failed |
| fault site safe radius boundary #1 | [[7, 1]] | [[3, 1], [7, 1]] | Failed |
| regression safe radius boundary #1 | [] | [[0, 0]] | Failed |
| partial repair boundary #1 | [] | [] | Passed |
| partial repair boundary #2 | [] | [] | Passed |
| diagonal neighbour spawn #1 | [[1, 2]] | [[1, 2]] | Passed |
| negative index candidate #1 | [[2, 0]] | [[2, 0]] | Passed |
| control #1 | [] | [] | Passed |
SHA-256 / 81933e5ad76df73388e663db937467f8662e67208c9925de4c26ac3b74ff6467
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 - 1:
continue
if any(max(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 = [[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('fault site safe radius boundary #1',
[['.~.', '#..', '.#.', '...', '..#', '.~.', '#..', '~..'],
[0, 2],
[[3, 3], [3, 1], [3, 0], [7, -1], [4, 3], [7, 1]],
3,
2],
[[3, 1], [7, 1]]),
('regression safe radius boundary #1',
[['......', '..#...', '...~..', '.~#...', '~..~~.'],
[1, 3],
[[0, 0], [-1, 4], [-1, 2], [5, 4], [5, 1], [5, 1], [3, 5], [5, 6], [1, 4], [5, 2]],
3,
3],
[[0, 0]]),
('partial repair boundary #1',
[['..~##.', '~..~..', '.~~#.~'], [0, 3], [[1, 4], [-1, 6], [1, 1], [2, 4], [2, 2], [1, 0]], 3, 5],
[]),
('partial repair boundary #2',
[['...', '#..', '.~~', '#~.', '.~.', '~..'], [2, 1], [[-1, 0], [1, 1], [3, 2], [4, 3]], 2, 1],
[]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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],
[])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('regression safe radius boundary #1',
[['......', '..#...', '...~..', '.~#...', '~..~~.'],
[1, 3],
[[0, 0], [-1, 4], [-1, 2], [5, 4], [5, 1], [5, 1], [3, 5], [5, 6], [1, 4], [5, 2]],
3,
3],
[[0, 0]]),
('fault site safe radius boundary #1',
[['.~..', '#...', '..~~', '#...', '..~.'],
[3, 0],
[[0, 4], [5, 3], [3, 2], [4, -1], [-1, -1], [2, 0], [1, 2], [1, -1], [0, 1]],
1,
3],
[[3, 2], [2, 0], [1, 2]]),
('partial repair boundary #1',
[['..~##.', '~..~..', '.~~#.~'], [0, 3], [[1, 4], [-1, 6], [1, 1], [2, 4], [2, 2], [1, 0]], 3, 5],
[]),
('partial repair boundary #2',
[['...', '#..', '.~~', '#~.', '.~.', '~..'], [2, 1], [[-1, 0], [1, 1], [3, 2], [4, 3]], 2, 1],
[]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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],
[])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('fault site safe radius boundary #1',
[['##..~..', '...~...', '##.....'],
[0, 2],
[[1, -1], [-1, 3], [3, 2], [1, 0], [1, 0], [0, 5], [1, -1], [0, 3]],
2,
2],
[[1, 0], [0, 5]]),
('fault site safe radius boundary #2',
[['.~..', '#...', '..~.'],
[0, 2],
[[1, 0], [3, -1], [1, 2], [-1, 1], [1, 3], [3, 0], [1, 0], [2, 1]],
1,
5],
[[1, 2]]),
('partial repair boundary #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]]),
('partial repair boundary #2',
[['~...', '.~..', '.#..', '#.~.', '....', '...#', '..#.', '~~.#'],
[5, 2],
[[8, 4], [4, -1], [8, -1], [4, 3]],
2,
1],
[]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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],
[])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('regression safe radius boundary #1',
[['.~....##', '......#.', '~...#..#', '~......~'],
[2, 3],
[[-1, 3], [0, 1], [1, -1], [1, 2], [2, 5], [1, 3]],
2,
1],
[[2, 5]]),
('fault site safe radius boundary #1',
[['...', '.~.', '.~.', '.#.', '...', '..~', '...'],
[0, 1],
[[3, 2], [7, 1], [4, -1], [1, 1], [1, 0]],
3,
5],
[[3, 2]]),
('partial repair boundary #1',
[['~..', '~.#', '..#', '.#.', '##.'], [1, 0], [[3, 3], [4, 3], [2, 0], [0, 0]], 2, 1],
[]),
('partial repair boundary #2',
[['~...', '....', '~~..', '.#..', '...~', '~.~.', '..~.'],
[2, 2],
[[3, 3], [3, 2], [2, 0], [6, 3], [7, 2], [7, 1], [7, 2], [0, 3]],
3,
3],
[[6, 3]]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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]])],
[('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
('regression safe radius boundary #1',
[['...~~...', '#.~....#', '....#...'], [0, 6], [[1, 1], [2, 8], [1, 6], [1, 4]], 2, 5],
[[1, 1], [1, 4]]),
('fault site safe radius boundary #1',
[['.....', '.#~~~', '.~##.', '.....', '~..~#', '....#', '##.##', '...~~'],
[4, 0],
[[5, 1], [3, 3], [7, 0], [6, 4], [8, 3], [1, 3], [6, 4]],
1,
3],
[[5, 1], [3, 3], [7, 0]]),
('partial repair boundary #1',
[['...~#.~~', '....#...', '......~~', '.....#..', '.~....#.', '##....##', '~....~.#'],
[5, 7],
[[7, 6], [3, 1], [4, 7], [-1, 8]],
2,
5],
[[3, 1]]),
('regression safe radius boundary #2',
[['.~....##', '......#.', '~...#..#', '~......~'],
[2, 3],
[[-1, 3], [0, 1], [1, -1], [1, 2], [2, 5], [1, 3]],
2,
1],
[[2, 5]]),
('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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 |
|---|---|---|---|
| exact safe radius #1 | [[1, 1]] | [[0, 2]] | Failed |
| fault site safe radius boundary #1 | [[3, 1], [7, 1]] | [[3, 1], [7, 1]] | Passed |
| regression safe radius boundary #1 | [[0, 0], [3, 5]] | [[0, 0]] | Failed |
| partial repair boundary #1 | [[1, 1], [2, 4]] | [] | Failed |
| partial repair boundary #2 | [[1, 1]] | [] | Failed |
| diagonal neighbour spawn #1 | [[1, 2]] | [[1, 2]] | Passed |
| negative index candidate #1 | [[2, 0]] | [[2, 0]] | Passed |
| control #1 | [] | [] | Passed |
SHA-256 / b7551d48d362c65cb8a6d8160163268dd0f0ec4255f9d6d3bf60e223ef0a4fa1
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.503460+00:00.
Case digest / 9542ab05605343c549cede113c19c832fce4a64a85059387020af55f475f51be