FAILURE MAP
← Case archive

FA-86451 / Procedural level generation constraints / Open access

Enemy spawn point selection: Negative candidates wrap around · case 01

Off-map candidates spawn on the opposite edge.

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

ROOT CAUSE

The bounds test lacks the lower bound, so negative indices wrap.

VERIFIED REPAIR

Restore `not (0 <= r < len(grid) and 0 <= c < len(grid[0]))` at the candidate bounds step.

Unsuccessful approach: Swapping row and column limits breaks non-square maps.

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

SHA-256 / e69dc52f3f54cd9d7d21a3e2eef1e7e1e943bacd5ae3f8b27abda5835bf4cf79

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

SHA-256 / d9a263fb4651db455d5b232dd16ef9799c9c52107570cd71658b8b78fea46a7e

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

SHA-256 / 734dad91b1cdd5b01890c3aa4b279fecf33a579f4f4bd7ed5878e98823380e96

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

Case digest / 04ba259f294cb907333d6363d3e242497d0d1d39c6a1b6c559220d9af1e79383