FAILURE MAP
← Case archive

FA-86446 / Procedural level generation constraints / Open access

Enemy spawn point selection: One spawn too many · case 01

Encounters contain an extra enemy.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The quota check is strict.

VERIFIED REPAIR

Restore `if len(chosen) >= count:` at the spawn quota step.

Unsuccessful approach: Forcing at least one spawn ignores a zero quota.

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 = [[('regression spawn quota #1',
   [['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
   []),
  ('regression spawn quota #2',
   [['...#...', '......~', '~~.....', '..~....', '.~....~', '.....#.'], [5, 2], [[1, 5]], 0, 0],
   []),
  ('regression spawn quota #3',
   [['...', '~..', '...', '..#', '...', '..~'],
    [0, 0],
    [[6, 1], [3, 2], [0, 3], [2, -1], [1, 1], [5, 1]],
    3,
    0],
   []),
  ('regression spawn quota #4',
   [['~.##.', '..#.~', '.....', '.....', '.#...', '#..~.'], [4, 0], [[2, 1], [1, 0], [-1, 5], [1, 4]], 2, 0],
   []),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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',
   [['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
   [[1, 0]])],
 [('regression spawn quota #1',
   [['...', '~..', '...', '..#', '...', '..~'],
    [0, 0],
    [[6, 1], [3, 2], [0, 3], [2, -1], [1, 1], [5, 1]],
    3,
    0],
   []),
  ('regression spawn quota #2',
   [['~.##.', '..#.~', '.....', '.....', '.#...', '#..~.'], [4, 0], [[2, 1], [1, 0], [-1, 5], [1, 4]], 2, 0],
   []),
  ('regression spawn quota #3',
   [['~...', '~..~', '.~.#', '~.~.', '~.~#', '....'], [4, 2], [[3, 3]], 0, 0],
   []),
  ('regression spawn quota #4', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('control #1',
   [['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
   [[1, 0]]),
  ('control #2',
   [['....', '.#.~', '..~~', '...#'], [2, 0], [[4, -1], [3, 3], [3, 1], [1, 0], [1, 3]], 0, 2],
   [[3, 1], [1, 0]])],
 [('fault site spawn quota #1',
   [['~..~.#.', '.....#.', '.......', '#......', '##....~'],
    [1, 4],
    [[5, 0], [2, 0], [1, 6], [-1, 7], [0, 2], [1, 1], [3, 5], [2, 3], [5, 4]],
    1,
    3],
   [[2, 0], [1, 6], [0, 2]]),
  ('regression spawn quota #1',
   [['~...', '~..~', '.~.#', '~.~.', '~.~#', '....'], [4, 2], [[3, 3]], 0, 0],
   []),
  ('regression spawn quota #2', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('regression spawn quota #3',
   [['.##...', '.~.#..', '.~...#', '##.~..', '~#...~', '..~.#.', '##...~', '~...#.'],
    [6, 1],
    [[0, 5], [6, 2], [8, 3], [5, 3], [3, 5]],
    0,
    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',
   [['....', '.#.~', '..~~', '...#'], [2, 0], [[4, -1], [3, 3], [3, 1], [1, 0], [1, 3]], 0, 2],
   [[3, 1], [1, 0]]),
  ('control #2',
   [['...#', '.#..', '#.#~', '~~.~', '~~#.', '~##.', '....', '...#'],
    [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]])],
 [('regression spawn quota #1', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('regression spawn quota #2',
   [['.##...', '.~.#..', '.~...#', '##.~..', '~#...~', '..~.#.', '##...~', '~...#.'],
    [6, 1],
    [[0, 5], [6, 2], [8, 3], [5, 3], [3, 5]],
    0,
    0],
   []),
  ('regression spawn quota #3', [['...#..', '....#.', '.~##..'], [1, 1], [[0, 1], [2, 1]], 1, 0], []),
  ('regression spawn quota #4', [['......#.', '..#..~..', '..~~...#'], [2, 2], [[0, 7]], 1, 0], []),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
  ('control #1',
   [['~......', '......~', '~#.~##.', '.#..~~.', '#..#~#.', '......#'],
    [3, 2],
    [[1, 0], [6, 3], [5, 2], [4, 0], [2, 3], [1, 4], [6, 7], [2, 7]],
    0,
    5],
   [[1, 0], [5, 2], [1, 4]]),
  ('control #2',
   [['.#.', '...', '#..', '...', '#..', '#.~'], [5, 2], [[2, -1], [5, 2], [1, 3], [2, 0], [6, 0]], 3, 0],
   [])],
 [('fault site spawn quota #1',
   [['.~..~.#', '~~..~.~', '.......', '~~.~#~.', '.#.##~~', '#~.#...', '..###~.', '..~.~..'],
    [2, 0],
    [[3, 6], [6, 5], [4, 2], [5, 7]],
    0,
    1],
   [[3, 6]]),
  ('fault site spawn quota #2',
   [['##.#~..', '..~#..#', '.~.....', '.#~~~.~', '....~..', '~...~.#', '.~.#.~#', '.......'],
    [0, 0],
    [[-1, 3], [5, 3], [6, 3], [4, 5], [5, -1], [1, 7], [5, 2]],
    0,
    1],
   [[5, 3]]),
  ('regression spawn quota #1', [['......#.', '..#..~..', '..~~...#'], [2, 2], [[0, 7]], 1, 0], []),
  ('regression spawn quota #2',
   [['.#.#.~~~', '.~...~..', '.......~'],
    [1, 5],
    [[0, 5], [3, 7], [1, 2], [0, 2], [0, 7], [1, -1], [1, 1], [2, 2]],
    0,
    0],
   []),
  ('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('control #1',
   [['.#.#~.', '~.....', '.~#...', '......', '..#.#.'], [0, 0], [[1, 1], [5, 0], [3, 3], [-1, 0]], 0, 5],
   [[1, 1], [3, 3]]),
  ('control #2', [['..~#...~', '..~#....', '.~.##..#'], [2, 3], [[3, 7], [2, 4]], 2, 5], [])]]
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 fixtureActualExpectedOutcome
regression spawn quota #1[[7, 2]][]Failed
regression spawn quota #2[[1, 5]][]Failed
regression spawn quota #3[[5, 1]][]Failed
regression spawn quota #4[[2, 1]][]Failed
diagonal neighbour spawn #1[[1, 2]][[1, 2]]Passed
exact safe radius #1[[0, 2]][[0, 2]]Passed
negative index candidate #1[[2, 0]][[2, 0]]Passed
control #1[[1, 0]][[1, 0]]Passed

SHA-256 / 21874372395f8af3362a952b1cf7f1c8c999952611319ca2ff7602e1a5c56834

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) >= max(count, 1):
            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 = [[('regression spawn quota #1',
   [['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
   []),
  ('regression spawn quota #2',
   [['...#...', '......~', '~~.....', '..~....', '.~....~', '.....#.'], [5, 2], [[1, 5]], 0, 0],
   []),
  ('regression spawn quota #3',
   [['...', '~..', '...', '..#', '...', '..~'],
    [0, 0],
    [[6, 1], [3, 2], [0, 3], [2, -1], [1, 1], [5, 1]],
    3,
    0],
   []),
  ('regression spawn quota #4',
   [['~.##.', '..#.~', '.....', '.....', '.#...', '#..~.'], [4, 0], [[2, 1], [1, 0], [-1, 5], [1, 4]], 2, 0],
   []),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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',
   [['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
   [[1, 0]])],
 [('regression spawn quota #1',
   [['...', '~..', '...', '..#', '...', '..~'],
    [0, 0],
    [[6, 1], [3, 2], [0, 3], [2, -1], [1, 1], [5, 1]],
    3,
    0],
   []),
  ('regression spawn quota #2',
   [['~.##.', '..#.~', '.....', '.....', '.#...', '#..~.'], [4, 0], [[2, 1], [1, 0], [-1, 5], [1, 4]], 2, 0],
   []),
  ('regression spawn quota #3',
   [['~...', '~..~', '.~.#', '~.~.', '~.~#', '....'], [4, 2], [[3, 3]], 0, 0],
   []),
  ('regression spawn quota #4', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('control #1',
   [['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
   [[1, 0]]),
  ('control #2',
   [['....', '.#.~', '..~~', '...#'], [2, 0], [[4, -1], [3, 3], [3, 1], [1, 0], [1, 3]], 0, 2],
   [[3, 1], [1, 0]])],
 [('fault site spawn quota #1',
   [['~..~.#.', '.....#.', '.......', '#......', '##....~'],
    [1, 4],
    [[5, 0], [2, 0], [1, 6], [-1, 7], [0, 2], [1, 1], [3, 5], [2, 3], [5, 4]],
    1,
    3],
   [[2, 0], [1, 6], [0, 2]]),
  ('regression spawn quota #1',
   [['~...', '~..~', '.~.#', '~.~.', '~.~#', '....'], [4, 2], [[3, 3]], 0, 0],
   []),
  ('regression spawn quota #2', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('regression spawn quota #3',
   [['.##...', '.~.#..', '.~...#', '##.~..', '~#...~', '..~.#.', '##...~', '~...#.'],
    [6, 1],
    [[0, 5], [6, 2], [8, 3], [5, 3], [3, 5]],
    0,
    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',
   [['....', '.#.~', '..~~', '...#'], [2, 0], [[4, -1], [3, 3], [3, 1], [1, 0], [1, 3]], 0, 2],
   [[3, 1], [1, 0]]),
  ('control #2',
   [['...#', '.#..', '#.#~', '~~.~', '~~#.', '~##.', '....', '...#'],
    [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]])],
 [('regression spawn quota #1', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('regression spawn quota #2',
   [['.##...', '.~.#..', '.~...#', '##.~..', '~#...~', '..~.#.', '##...~', '~...#.'],
    [6, 1],
    [[0, 5], [6, 2], [8, 3], [5, 3], [3, 5]],
    0,
    0],
   []),
  ('regression spawn quota #3', [['...#..', '....#.', '.~##..'], [1, 1], [[0, 1], [2, 1]], 1, 0], []),
  ('regression spawn quota #4', [['......#.', '..#..~..', '..~~...#'], [2, 2], [[0, 7]], 1, 0], []),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
  ('control #1',
   [['~......', '......~', '~#.~##.', '.#..~~.', '#..#~#.', '......#'],
    [3, 2],
    [[1, 0], [6, 3], [5, 2], [4, 0], [2, 3], [1, 4], [6, 7], [2, 7]],
    0,
    5],
   [[1, 0], [5, 2], [1, 4]]),
  ('control #2',
   [['.#.', '...', '#..', '...', '#..', '#.~'], [5, 2], [[2, -1], [5, 2], [1, 3], [2, 0], [6, 0]], 3, 0],
   [])],
 [('fault site spawn quota #1',
   [['.~..~.#', '~~..~.~', '.......', '~~.~#~.', '.#.##~~', '#~.#...', '..###~.', '..~.~..'],
    [2, 0],
    [[3, 6], [6, 5], [4, 2], [5, 7]],
    0,
    1],
   [[3, 6]]),
  ('fault site spawn quota #2',
   [['##.#~..', '..~#..#', '.~.....', '.#~~~.~', '....~..', '~...~.#', '.~.#.~#', '.......'],
    [0, 0],
    [[-1, 3], [5, 3], [6, 3], [4, 5], [5, -1], [1, 7], [5, 2]],
    0,
    1],
   [[5, 3]]),
  ('regression spawn quota #1', [['......#.', '..#..~..', '..~~...#'], [2, 2], [[0, 7]], 1, 0], []),
  ('regression spawn quota #2',
   [['.#.#.~~~', '.~...~..', '.......~'],
    [1, 5],
    [[0, 5], [3, 7], [1, 2], [0, 2], [0, 7], [1, -1], [1, 1], [2, 2]],
    0,
    0],
   []),
  ('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('control #1',
   [['.#.#~.', '~.....', '.~#...', '......', '..#.#.'], [0, 0], [[1, 1], [5, 0], [3, 3], [-1, 0]], 0, 5],
   [[1, 1], [3, 3]]),
  ('control #2', [['..~#...~', '..~#....', '.~.##..#'], [2, 3], [[3, 7], [2, 4]], 2, 5], [])]]
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 fixtureActualExpectedOutcome
regression spawn quota #1[[7, 2]][]Failed
regression spawn quota #2[[1, 5]][]Failed
regression spawn quota #3[[5, 1]][]Failed
regression spawn quota #4[[2, 1]][]Failed
diagonal neighbour spawn #1[[1, 2]][[1, 2]]Passed
exact safe radius #1[[0, 2]][[0, 2]]Passed
negative index candidate #1[[2, 0]][[2, 0]]Passed
control #1[[1, 0]][[1, 0]]Passed

SHA-256 / 0fdf818404b921504f590f6a43a219dd476b53b9d4d705143ed983fd345de945

3 / The verified repair

Exit 0
"""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 = [[('regression spawn quota #1',
   [['#.#', '...', '#.#', '.#.', '...', '...', '...', '##.'], [6, 2], [[2, -1], [7, 2]], 0, 0],
   []),
  ('regression spawn quota #2',
   [['...#...', '......~', '~~.....', '..~....', '.~....~', '.....#.'], [5, 2], [[1, 5]], 0, 0],
   []),
  ('regression spawn quota #3',
   [['...', '~..', '...', '..#', '...', '..~'],
    [0, 0],
    [[6, 1], [3, 2], [0, 3], [2, -1], [1, 1], [5, 1]],
    3,
    0],
   []),
  ('regression spawn quota #4',
   [['~.##.', '..#.~', '.....', '.....', '.#...', '#..~.'], [4, 0], [[2, 1], [1, 0], [-1, 5], [1, 4]], 2, 0],
   []),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 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',
   [['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
   [[1, 0]])],
 [('regression spawn quota #1',
   [['...', '~..', '...', '..#', '...', '..~'],
    [0, 0],
    [[6, 1], [3, 2], [0, 3], [2, -1], [1, 1], [5, 1]],
    3,
    0],
   []),
  ('regression spawn quota #2',
   [['~.##.', '..#.~', '.....', '.....', '.#...', '#..~.'], [4, 0], [[2, 1], [1, 0], [-1, 5], [1, 4]], 2, 0],
   []),
  ('regression spawn quota #3',
   [['~...', '~..~', '.~.#', '~.~.', '~.~#', '....'], [4, 2], [[3, 3]], 0, 0],
   []),
  ('regression spawn quota #4', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('control #1',
   [['.#~', '...', '~.#', '#.~', '..#', '#~.'], [3, 1], [[5, 0], [1, 0], [6, -1], [6, -1]], 0, 5],
   [[1, 0]]),
  ('control #2',
   [['....', '.#.~', '..~~', '...#'], [2, 0], [[4, -1], [3, 3], [3, 1], [1, 0], [1, 3]], 0, 2],
   [[3, 1], [1, 0]])],
 [('fault site spawn quota #1',
   [['~..~.#.', '.....#.', '.......', '#......', '##....~'],
    [1, 4],
    [[5, 0], [2, 0], [1, 6], [-1, 7], [0, 2], [1, 1], [3, 5], [2, 3], [5, 4]],
    1,
    3],
   [[2, 0], [1, 6], [0, 2]]),
  ('regression spawn quota #1',
   [['~...', '~..~', '.~.#', '~.~.', '~.~#', '....'], [4, 2], [[3, 3]], 0, 0],
   []),
  ('regression spawn quota #2', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('regression spawn quota #3',
   [['.##...', '.~.#..', '.~...#', '##.~..', '~#...~', '..~.#.', '##...~', '~...#.'],
    [6, 1],
    [[0, 5], [6, 2], [8, 3], [5, 3], [3, 5]],
    0,
    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',
   [['....', '.#.~', '..~~', '...#'], [2, 0], [[4, -1], [3, 3], [3, 1], [1, 0], [1, 3]], 0, 2],
   [[3, 1], [1, 0]]),
  ('control #2',
   [['...#', '.#..', '#.#~', '~~.~', '~~#.', '~##.', '....', '...#'],
    [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]])],
 [('regression spawn quota #1', [['.##.', '#..~', '~...'], [2, 0], [[0, 1], [2, 3], [-1, 1]], 1, 0], []),
  ('regression spawn quota #2',
   [['.##...', '.~.#..', '.~...#', '##.~..', '~#...~', '..~.#.', '##...~', '~...#.'],
    [6, 1],
    [[0, 5], [6, 2], [8, 3], [5, 3], [3, 5]],
    0,
    0],
   []),
  ('regression spawn quota #3', [['...#..', '....#.', '.~##..'], [1, 1], [[0, 1], [2, 1]], 1, 0], []),
  ('regression spawn quota #4', [['......#.', '..#..~..', '..~~...#'], [2, 2], [[0, 7]], 1, 0], []),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('exact safe radius #1', [['.....', '.....'], [0, 0], [[1, 1], [0, 2]], 2, 2], [[0, 2]]),
  ('control #1',
   [['~......', '......~', '~#.~##.', '.#..~~.', '#..#~#.', '......#'],
    [3, 2],
    [[1, 0], [6, 3], [5, 2], [4, 0], [2, 3], [1, 4], [6, 7], [2, 7]],
    0,
    5],
   [[1, 0], [5, 2], [1, 4]]),
  ('control #2',
   [['.#.', '...', '#..', '...', '#..', '#.~'], [5, 2], [[2, -1], [5, 2], [1, 3], [2, 0], [6, 0]], 3, 0],
   [])],
 [('fault site spawn quota #1',
   [['.~..~.#', '~~..~.~', '.......', '~~.~#~.', '.#.##~~', '#~.#...', '..###~.', '..~.~..'],
    [2, 0],
    [[3, 6], [6, 5], [4, 2], [5, 7]],
    0,
    1],
   [[3, 6]]),
  ('fault site spawn quota #2',
   [['##.#~..', '..~#..#', '.~.....', '.#~~~.~', '....~..', '~...~.#', '.~.#.~#', '.......'],
    [0, 0],
    [[-1, 3], [5, 3], [6, 3], [4, 5], [5, -1], [1, 7], [5, 2]],
    0,
    1],
   [[5, 3]]),
  ('regression spawn quota #1', [['......#.', '..#..~..', '..~~...#'], [2, 2], [[0, 7]], 1, 0], []),
  ('regression spawn quota #2',
   [['.#.#.~~~', '.~...~..', '.......~'],
    [1, 5],
    [[0, 5], [3, 7], [1, 2], [0, 2], [0, 7], [1, -1], [1, 1], [2, 2]],
    0,
    0],
   []),
  ('negative index candidate #1', [['...', '...', '..#'], [0, 0], [[-1, -1], [2, 0]], 1, 2], [[2, 0]]),
  ('diagonal neighbour spawn #1', [['....', '....', '....'], [0, 0], [[1, 2], [2, 3]], 1, 3], [[1, 2]]),
  ('control #1',
   [['.#.#~.', '~.....', '.~#...', '......', '..#.#.'], [0, 0], [[1, 1], [5, 0], [3, 3], [-1, 0]], 0, 5],
   [[1, 1], [3, 3]]),
  ('control #2', [['..~#...~', '..~#....', '.~.##..#'], [2, 3], [[3, 7], [2, 4]], 2, 5], [])]]
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 fixtureActualExpectedOutcome
regression spawn quota #1[][]Passed
regression spawn quota #2[][]Passed
regression spawn quota #3[][]Passed
regression spawn quota #4[][]Passed
diagonal neighbour spawn #1[[1, 2]][[1, 2]]Passed
exact safe radius #1[[0, 2]][[0, 2]]Passed
negative index candidate #1[[2, 0]][[2, 0]]Passed
control #1[[1, 0]][[1, 0]]Passed

SHA-256 / ede434474f0b095c9a33379791f0140e84fd78c1d6e00ba4b7ab675cf58a7735

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.577427+00:00.

Case digest / 50f09a2d2ce082e0b3e69c01e8785ecc18f5726f93914138e4e61f91518b89fa