FA-86696 / Procedural level generation constraints / Open access
Decoration scatter with quadrant quota: Quadrant counter never exceeds one · case 01
Quotas above one are ignored.
ROOT CAUSE
The quadrant counter is reset to one on each placement.
VERIFIED REPAIR
Restore `quota[q] = quota.get(q, 0) + 1` at the quota increment step.
Unsuccessful approach: Storing the global count mixes quadrants.
Case contract
Candidates [x, y] (grid[y][x]) are tried in order. Accept when in bounds on '.', its quadrant (x*2//w, y*2//h) holds fewer than per_quadrant accepted props, and its squared Euclidean distance to every accepted prop is at least radius*radius. Returns accepted [x, y].
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, candidates, radius, per_quadrant):
h = len(grid)
w = len(grid[0])
placed = []
quota = {}
for x, y in candidates:
if not (0 <= y < h and 0 <= x < w) or grid[y][x] != '.':
continue
q = (x * 2 // w, y * 2 // h)
if quota.get(q, 0) >= per_quadrant:
continue
if any((x - px) ** 2 + (y - py) ** 2 < radius * radius for px, py in placed):
continue
placed.append([x, y])
quota[q] = 1
return placed
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['......~.', '#..~.#.#', '~#..~..#', '..~...~#', '~.......', '....#~..'],
[[0, 2], [7, 4], [6, 2], [5, 1], [4, 1], [5, 0], [6, 5], [7, 1], [2, 5], [4, 5], [2, 6]],
1,
3],
[[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]]),
('partial repair boundary #2',
[['.~~...'], [[2, 0], [0, 0], [4, 0], [4, 0], [3, 1], [6, 1], [5, 0], [3, 1]], 1, 2],
[[0, 0], [4, 0], [5, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('control #1',
[['~~..#', '.....', '....#'], [[3, 1], [1, 2], [5, 2], [2, 3], [0, 3], [3, 0], [1, 1], [0, 1]], 1, 1],
[[3, 1], [1, 2], [1, 1]])],
[('regression quota increment #1',
[['...~.#..', '~#.###~.', '.#.#..~#', '...#.#~.', '~.~.~..#', '.#...#.#', '#..~#...'],
[[4, 2], [6, 0], [7, 3], [5, 4], [7, 6], [5, 6], [7, 4], [0, 2], [4, 0], [5, 2], [1, 2]],
2,
2],
[[4, 2], [6, 0], [5, 4], [7, 6], [0, 2]]),
('regression quota increment #2',
[['~#...##', '...##..', '~..~~..', '#.#.~..', '..#...#', '~#.~~~.'],
[[0, 0], [1, 3], [3, 0], [7, 1], [6, 3], [5, 2], [2, 0], [2, 6], [1, 1], [7, 1], [1, 2], [7, 4]],
1,
2],
[[1, 3], [3, 0], [6, 3], [5, 2], [2, 0]]),
('partial repair boundary #1',
[['#..~.##', '..~.#..', '#.~#..~'],
[[3, 1], [7, 1], [4, 1], [0, 3], [6, 0], [5, 2], [5, 3], [6, 3], [1, 0], [6, 1], [2, 0], [6, 1]],
1,
3],
[[3, 1], [5, 2], [1, 0], [6, 1], [2, 0]]),
('partial repair boundary #2',
[['~..#.#', '~.#~..', '......', '.~.#.#', '..~...', '....#.', '..~~.#'],
[[1, 5], [0, 0], [0, 4], [1, 3], [1, 0], [5, 1], [2, 6], [3, 0], [1, 1], [5, 1]],
1,
3],
[[1, 5], [0, 4], [1, 0], [5, 1], [1, 1]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('control #1',
[['~~..#', '.....', '....#'], [[3, 1], [1, 2], [5, 2], [2, 3], [0, 3], [3, 0], [1, 1], [0, 1]], 1, 1],
[[3, 1], [1, 2], [1, 1]]),
('control #2',
[['~..~.', '.#...', '~..#.', '..~#.'], [[1, 2], [4, 3], [1, 2], [4, 3], [1, 1]], 2, 3],
[[1, 2], [4, 3]])],
[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['.~....', '...~..'], [[0, 0], [5, 1], [6, 0], [4, 1], [0, 1], [3, 2], [1, 0]], 1, 2],
[[0, 0], [5, 1], [4, 1], [0, 1]]),
('partial repair boundary #2',
[['#.~', '.~#', '.~.', '...', '#..', '..~'],
[[3, 5], [2, 2], [2, 6], [0, 2], [3, 1], [1, 2], [2, 2], [1, 0], [2, 1]],
2,
2],
[[2, 2], [0, 2], [1, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('control #1',
[['~..~.', '.#...', '~..#.', '..~#.'], [[1, 2], [4, 3], [1, 2], [4, 3], [1, 1]], 2, 3],
[[1, 2], [4, 3]]),
('control #2', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]])],
[('regression quota increment #1',
[['...~.#..', '~#.###~.', '.#.#..~#', '...#.#~.', '~.~.~..#', '.#...#.#', '#..~#...'],
[[4, 2], [6, 0], [7, 3], [5, 4], [7, 6], [5, 6], [7, 4], [0, 2], [4, 0], [5, 2], [1, 2]],
2,
2],
[[4, 2], [6, 0], [5, 4], [7, 6], [0, 2]]),
('regression quota increment #2',
[['~#...##', '...##..', '~..~~..', '#.#.~..', '..#...#', '~#.~~~.'],
[[0, 0], [1, 3], [3, 0], [7, 1], [6, 3], [5, 2], [2, 0], [2, 6], [1, 1], [7, 1], [1, 2], [7, 4]],
1,
2],
[[1, 3], [3, 0], [6, 3], [5, 2], [2, 0]]),
('partial repair boundary #1',
[['......#', '~~..#~.', '.~.~~..', '#......', '..~..~#'],
[[5, 3], [1, 2], [0, 3], [4, 0], [1, 4], [4, 3], [0, 3], [3, 4], [1, 3], [7, 5]],
1,
3],
[[5, 3], [4, 0], [1, 4], [4, 3], [3, 4], [1, 3]]),
('partial repair boundary #2',
[['~.#...', '......', '.~#~~#', '..~..~', '~#~#~#', '.~~...', '......'],
[[4, 0], [3, 1], [1, 1], [1, 3], [3, 1], [5, 2], [3, 4]],
1,
2],
[[4, 0], [3, 1], [1, 1], [1, 3]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('control #1',
[['..', '~.'],
[[2, 1], [1, 2], [2, 0], [2, 0], [0, 1], [2, 1], [0, 0], [2, 2], [0, 0], [1, 1], [2, 0]],
3,
2],
[[0, 0]]),
('control #2', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[0, 0]])],
[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['.#..#..', '.#.~...', '.###..~', '~#..#.#', '.......', '...##~.'],
[[2, 4], [6, 3], [0, 2], [6, 0], [2, 1], [4, 3], [4, 4], [0, 0], [4, 3], [0, 3]],
1,
3],
[[2, 4], [0, 2], [6, 0], [2, 1], [4, 4], [0, 0]]),
('partial repair boundary #2',
[['~~.....', '..#...~', '....#..', '.~.....', '#...~~~', '....~..'],
[[1, 1], [3, 5], [5, 5], [5, 4], [4, 4], [1, 0], [0, 0], [1, 4], [3, 1], [4, 1], [6, 0], [3, 4]],
2,
2],
[[1, 1], [3, 5], [5, 5], [1, 4], [3, 1], [6, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('control #1', [['....', '..#.'], [[0, 1], [3, 0], [1, 0]], 3, 2], [[0, 1], [3, 0]]),
('control #2',
[['..', '.#', '..', '~~', '..', '..', '..'],
[[1, 6], [1, 1], [0, 7], [0, 0], [2, 1], [2, 5], [2, 0], [0, 4], [1, 1], [0, 0], [0, 3], [2, 6]],
3,
3],
[[1, 6], [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 |
|---|---|---|---|
| fault site quota increment #1 | [[1, 1], [0, 1], [0, 0], [4, 2]] | [[1, 1], [0, 1], [4, 2]] | Failed |
| fault site quota increment #2 | [[2, 1], [3, 1], [1, 1], [5, 0]] | [[2, 1], [3, 1], [5, 0]] | Failed |
| partial repair boundary #1 | [[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]] | [[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]] | Passed |
| partial repair boundary #2 | [[0, 0], [4, 0], [5, 0]] | [[0, 0], [4, 0], [5, 0]] | Passed |
| exact radius spacing #1 | [[0, 0], [2, 0]] | [[0, 0], [2, 0]] | Passed |
| diagonal within radius #1 | [[0, 0]] | [[0, 0]] | Passed |
| quadrant full #1 | [[0, 0], [3, 0]] | [[0, 0], [3, 0]] | Passed |
| control #1 | [[3, 1], [1, 2], [1, 1]] | [[3, 1], [1, 2], [1, 1]] | Passed |
SHA-256 / 3feec1047667f53ef915654e171d605f89d133d7fe25446b6578731bb6d05160
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, candidates, radius, per_quadrant):
h = len(grid)
w = len(grid[0])
placed = []
quota = {}
for x, y in candidates:
if not (0 <= y < h and 0 <= x < w) or grid[y][x] != '.':
continue
q = (x * 2 // w, y * 2 // h)
if quota.get(q, 0) >= per_quadrant:
continue
if any((x - px) ** 2 + (y - py) ** 2 < radius * radius for px, py in placed):
continue
placed.append([x, y])
quota[q] = len(placed)
return placed
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['......~.', '#..~.#.#', '~#..~..#', '..~...~#', '~.......', '....#~..'],
[[0, 2], [7, 4], [6, 2], [5, 1], [4, 1], [5, 0], [6, 5], [7, 1], [2, 5], [4, 5], [2, 6]],
1,
3],
[[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]]),
('partial repair boundary #2',
[['.~~...'], [[2, 0], [0, 0], [4, 0], [4, 0], [3, 1], [6, 1], [5, 0], [3, 1]], 1, 2],
[[0, 0], [4, 0], [5, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('control #1',
[['~~..#', '.....', '....#'], [[3, 1], [1, 2], [5, 2], [2, 3], [0, 3], [3, 0], [1, 1], [0, 1]], 1, 1],
[[3, 1], [1, 2], [1, 1]])],
[('regression quota increment #1',
[['...~.#..', '~#.###~.', '.#.#..~#', '...#.#~.', '~.~.~..#', '.#...#.#', '#..~#...'],
[[4, 2], [6, 0], [7, 3], [5, 4], [7, 6], [5, 6], [7, 4], [0, 2], [4, 0], [5, 2], [1, 2]],
2,
2],
[[4, 2], [6, 0], [5, 4], [7, 6], [0, 2]]),
('regression quota increment #2',
[['~#...##', '...##..', '~..~~..', '#.#.~..', '..#...#', '~#.~~~.'],
[[0, 0], [1, 3], [3, 0], [7, 1], [6, 3], [5, 2], [2, 0], [2, 6], [1, 1], [7, 1], [1, 2], [7, 4]],
1,
2],
[[1, 3], [3, 0], [6, 3], [5, 2], [2, 0]]),
('partial repair boundary #1',
[['#..~.##', '..~.#..', '#.~#..~'],
[[3, 1], [7, 1], [4, 1], [0, 3], [6, 0], [5, 2], [5, 3], [6, 3], [1, 0], [6, 1], [2, 0], [6, 1]],
1,
3],
[[3, 1], [5, 2], [1, 0], [6, 1], [2, 0]]),
('partial repair boundary #2',
[['~..#.#', '~.#~..', '......', '.~.#.#', '..~...', '....#.', '..~~.#'],
[[1, 5], [0, 0], [0, 4], [1, 3], [1, 0], [5, 1], [2, 6], [3, 0], [1, 1], [5, 1]],
1,
3],
[[1, 5], [0, 4], [1, 0], [5, 1], [1, 1]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('control #1',
[['~~..#', '.....', '....#'], [[3, 1], [1, 2], [5, 2], [2, 3], [0, 3], [3, 0], [1, 1], [0, 1]], 1, 1],
[[3, 1], [1, 2], [1, 1]]),
('control #2',
[['~..~.', '.#...', '~..#.', '..~#.'], [[1, 2], [4, 3], [1, 2], [4, 3], [1, 1]], 2, 3],
[[1, 2], [4, 3]])],
[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['.~....', '...~..'], [[0, 0], [5, 1], [6, 0], [4, 1], [0, 1], [3, 2], [1, 0]], 1, 2],
[[0, 0], [5, 1], [4, 1], [0, 1]]),
('partial repair boundary #2',
[['#.~', '.~#', '.~.', '...', '#..', '..~'],
[[3, 5], [2, 2], [2, 6], [0, 2], [3, 1], [1, 2], [2, 2], [1, 0], [2, 1]],
2,
2],
[[2, 2], [0, 2], [1, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('control #1',
[['~..~.', '.#...', '~..#.', '..~#.'], [[1, 2], [4, 3], [1, 2], [4, 3], [1, 1]], 2, 3],
[[1, 2], [4, 3]]),
('control #2', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]])],
[('regression quota increment #1',
[['...~.#..', '~#.###~.', '.#.#..~#', '...#.#~.', '~.~.~..#', '.#...#.#', '#..~#...'],
[[4, 2], [6, 0], [7, 3], [5, 4], [7, 6], [5, 6], [7, 4], [0, 2], [4, 0], [5, 2], [1, 2]],
2,
2],
[[4, 2], [6, 0], [5, 4], [7, 6], [0, 2]]),
('regression quota increment #2',
[['~#...##', '...##..', '~..~~..', '#.#.~..', '..#...#', '~#.~~~.'],
[[0, 0], [1, 3], [3, 0], [7, 1], [6, 3], [5, 2], [2, 0], [2, 6], [1, 1], [7, 1], [1, 2], [7, 4]],
1,
2],
[[1, 3], [3, 0], [6, 3], [5, 2], [2, 0]]),
('partial repair boundary #1',
[['......#', '~~..#~.', '.~.~~..', '#......', '..~..~#'],
[[5, 3], [1, 2], [0, 3], [4, 0], [1, 4], [4, 3], [0, 3], [3, 4], [1, 3], [7, 5]],
1,
3],
[[5, 3], [4, 0], [1, 4], [4, 3], [3, 4], [1, 3]]),
('partial repair boundary #2',
[['~.#...', '......', '.~#~~#', '..~..~', '~#~#~#', '.~~...', '......'],
[[4, 0], [3, 1], [1, 1], [1, 3], [3, 1], [5, 2], [3, 4]],
1,
2],
[[4, 0], [3, 1], [1, 1], [1, 3]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('control #1',
[['..', '~.'],
[[2, 1], [1, 2], [2, 0], [2, 0], [0, 1], [2, 1], [0, 0], [2, 2], [0, 0], [1, 1], [2, 0]],
3,
2],
[[0, 0]]),
('control #2', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[0, 0]])],
[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['.#..#..', '.#.~...', '.###..~', '~#..#.#', '.......', '...##~.'],
[[2, 4], [6, 3], [0, 2], [6, 0], [2, 1], [4, 3], [4, 4], [0, 0], [4, 3], [0, 3]],
1,
3],
[[2, 4], [0, 2], [6, 0], [2, 1], [4, 4], [0, 0]]),
('partial repair boundary #2',
[['~~.....', '..#...~', '....#..', '.~.....', '#...~~~', '....~..'],
[[1, 1], [3, 5], [5, 5], [5, 4], [4, 4], [1, 0], [0, 0], [1, 4], [3, 1], [4, 1], [6, 0], [3, 4]],
2,
2],
[[1, 1], [3, 5], [5, 5], [1, 4], [3, 1], [6, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('control #1', [['....', '..#.'], [[0, 1], [3, 0], [1, 0]], 3, 2], [[0, 1], [3, 0]]),
('control #2',
[['..', '.#', '..', '~~', '..', '..', '..'],
[[1, 6], [1, 1], [0, 7], [0, 0], [2, 1], [2, 5], [2, 0], [0, 4], [1, 1], [0, 0], [0, 3], [2, 6]],
3,
3],
[[1, 6], [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 |
|---|---|---|---|
| fault site quota increment #1 | [[1, 1], [0, 1], [4, 2]] | [[1, 1], [0, 1], [4, 2]] | Passed |
| fault site quota increment #2 | [[2, 1], [3, 1], [5, 0]] | [[2, 1], [3, 1], [5, 0]] | Passed |
| partial repair boundary #1 | [[7, 4], [6, 2], [4, 1], [6, 5], [2, 5]] | [[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]] | Failed |
| partial repair boundary #2 | [[0, 0], [4, 0]] | [[0, 0], [4, 0], [5, 0]] | Failed |
| exact radius spacing #1 | [[0, 0], [2, 0]] | [[0, 0], [2, 0]] | Passed |
| diagonal within radius #1 | [[0, 0]] | [[0, 0]] | Passed |
| quadrant full #1 | [[0, 0], [3, 0]] | [[0, 0], [3, 0]] | Passed |
| control #1 | [[3, 1], [1, 2], [1, 1]] | [[3, 1], [1, 2], [1, 1]] | Passed |
SHA-256 / 9f4e6522ab23abb5d5e2c868e2f1ec2a98326bee82373bf43d0e78ae91d5e75d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(grid, candidates, radius, per_quadrant):
h = len(grid)
w = len(grid[0])
placed = []
quota = {}
for x, y in candidates:
if not (0 <= y < h and 0 <= x < w) or grid[y][x] != '.':
continue
q = (x * 2 // w, y * 2 // h)
if quota.get(q, 0) >= per_quadrant:
continue
if any((x - px) ** 2 + (y - py) ** 2 < radius * radius for px, py in placed):
continue
placed.append([x, y])
quota[q] = quota.get(q, 0) + 1
return placed
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['......~.', '#..~.#.#', '~#..~..#', '..~...~#', '~.......', '....#~..'],
[[0, 2], [7, 4], [6, 2], [5, 1], [4, 1], [5, 0], [6, 5], [7, 1], [2, 5], [4, 5], [2, 6]],
1,
3],
[[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]]),
('partial repair boundary #2',
[['.~~...'], [[2, 0], [0, 0], [4, 0], [4, 0], [3, 1], [6, 1], [5, 0], [3, 1]], 1, 2],
[[0, 0], [4, 0], [5, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('control #1',
[['~~..#', '.....', '....#'], [[3, 1], [1, 2], [5, 2], [2, 3], [0, 3], [3, 0], [1, 1], [0, 1]], 1, 1],
[[3, 1], [1, 2], [1, 1]])],
[('regression quota increment #1',
[['...~.#..', '~#.###~.', '.#.#..~#', '...#.#~.', '~.~.~..#', '.#...#.#', '#..~#...'],
[[4, 2], [6, 0], [7, 3], [5, 4], [7, 6], [5, 6], [7, 4], [0, 2], [4, 0], [5, 2], [1, 2]],
2,
2],
[[4, 2], [6, 0], [5, 4], [7, 6], [0, 2]]),
('regression quota increment #2',
[['~#...##', '...##..', '~..~~..', '#.#.~..', '..#...#', '~#.~~~.'],
[[0, 0], [1, 3], [3, 0], [7, 1], [6, 3], [5, 2], [2, 0], [2, 6], [1, 1], [7, 1], [1, 2], [7, 4]],
1,
2],
[[1, 3], [3, 0], [6, 3], [5, 2], [2, 0]]),
('partial repair boundary #1',
[['#..~.##', '..~.#..', '#.~#..~'],
[[3, 1], [7, 1], [4, 1], [0, 3], [6, 0], [5, 2], [5, 3], [6, 3], [1, 0], [6, 1], [2, 0], [6, 1]],
1,
3],
[[3, 1], [5, 2], [1, 0], [6, 1], [2, 0]]),
('partial repair boundary #2',
[['~..#.#', '~.#~..', '......', '.~.#.#', '..~...', '....#.', '..~~.#'],
[[1, 5], [0, 0], [0, 4], [1, 3], [1, 0], [5, 1], [2, 6], [3, 0], [1, 1], [5, 1]],
1,
3],
[[1, 5], [0, 4], [1, 0], [5, 1], [1, 1]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('control #1',
[['~~..#', '.....', '....#'], [[3, 1], [1, 2], [5, 2], [2, 3], [0, 3], [3, 0], [1, 1], [0, 1]], 1, 1],
[[3, 1], [1, 2], [1, 1]]),
('control #2',
[['~..~.', '.#...', '~..#.', '..~#.'], [[1, 2], [4, 3], [1, 2], [4, 3], [1, 1]], 2, 3],
[[1, 2], [4, 3]])],
[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['.~....', '...~..'], [[0, 0], [5, 1], [6, 0], [4, 1], [0, 1], [3, 2], [1, 0]], 1, 2],
[[0, 0], [5, 1], [4, 1], [0, 1]]),
('partial repair boundary #2',
[['#.~', '.~#', '.~.', '...', '#..', '..~'],
[[3, 5], [2, 2], [2, 6], [0, 2], [3, 1], [1, 2], [2, 2], [1, 0], [2, 1]],
2,
2],
[[2, 2], [0, 2], [1, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('control #1',
[['~..~.', '.#...', '~..#.', '..~#.'], [[1, 2], [4, 3], [1, 2], [4, 3], [1, 1]], 2, 3],
[[1, 2], [4, 3]]),
('control #2', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]])],
[('regression quota increment #1',
[['...~.#..', '~#.###~.', '.#.#..~#', '...#.#~.', '~.~.~..#', '.#...#.#', '#..~#...'],
[[4, 2], [6, 0], [7, 3], [5, 4], [7, 6], [5, 6], [7, 4], [0, 2], [4, 0], [5, 2], [1, 2]],
2,
2],
[[4, 2], [6, 0], [5, 4], [7, 6], [0, 2]]),
('regression quota increment #2',
[['~#...##', '...##..', '~..~~..', '#.#.~..', '..#...#', '~#.~~~.'],
[[0, 0], [1, 3], [3, 0], [7, 1], [6, 3], [5, 2], [2, 0], [2, 6], [1, 1], [7, 1], [1, 2], [7, 4]],
1,
2],
[[1, 3], [3, 0], [6, 3], [5, 2], [2, 0]]),
('partial repair boundary #1',
[['......#', '~~..#~.', '.~.~~..', '#......', '..~..~#'],
[[5, 3], [1, 2], [0, 3], [4, 0], [1, 4], [4, 3], [0, 3], [3, 4], [1, 3], [7, 5]],
1,
3],
[[5, 3], [4, 0], [1, 4], [4, 3], [3, 4], [1, 3]]),
('partial repair boundary #2',
[['~.#...', '......', '.~#~~#', '..~..~', '~#~#~#', '.~~...', '......'],
[[4, 0], [3, 1], [1, 1], [1, 3], [3, 1], [5, 2], [3, 4]],
1,
2],
[[4, 0], [3, 1], [1, 1], [1, 3]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
('control #1',
[['..', '~.'],
[[2, 1], [1, 2], [2, 0], [2, 0], [0, 1], [2, 1], [0, 0], [2, 2], [0, 0], [1, 1], [2, 0]],
3,
2],
[[0, 0]]),
('control #2', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[0, 0]])],
[('fault site quota increment #1',
[['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
[[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
1,
2],
[[1, 1], [0, 1], [4, 2]]),
('fault site quota increment #2',
[['......#', '#...#..'], [[2, 1], [3, 1], [7, 2], [6, 2], [7, 1], [1, 1], [5, 0], [3, 1]], 1, 2],
[[2, 1], [3, 1], [5, 0]]),
('partial repair boundary #1',
[['.#..#..', '.#.~...', '.###..~', '~#..#.#', '.......', '...##~.'],
[[2, 4], [6, 3], [0, 2], [6, 0], [2, 1], [4, 3], [4, 4], [0, 0], [4, 3], [0, 3]],
1,
3],
[[2, 4], [0, 2], [6, 0], [2, 1], [4, 4], [0, 0]]),
('partial repair boundary #2',
[['~~.....', '..#...~', '....#..', '.~.....', '#...~~~', '....~..'],
[[1, 1], [3, 5], [5, 5], [5, 4], [4, 4], [1, 0], [0, 0], [1, 4], [3, 1], [4, 1], [6, 0], [3, 4]],
2,
2],
[[1, 1], [3, 5], [5, 5], [1, 4], [3, 1], [6, 0]]),
('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
('control #1', [['....', '..#.'], [[0, 1], [3, 0], [1, 0]], 3, 2], [[0, 1], [3, 0]]),
('control #2',
[['..', '.#', '..', '~~', '..', '..', '..'],
[[1, 6], [1, 1], [0, 7], [0, 0], [2, 1], [2, 5], [2, 0], [0, 4], [1, 1], [0, 0], [0, 3], [2, 6]],
3,
3],
[[1, 6], [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 |
|---|---|---|---|
| fault site quota increment #1 | [[1, 1], [0, 1], [4, 2]] | [[1, 1], [0, 1], [4, 2]] | Passed |
| fault site quota increment #2 | [[2, 1], [3, 1], [5, 0]] | [[2, 1], [3, 1], [5, 0]] | Passed |
| partial repair boundary #1 | [[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]] | [[7, 4], [6, 2], [4, 1], [5, 0], [6, 5], [2, 5]] | Passed |
| partial repair boundary #2 | [[0, 0], [4, 0], [5, 0]] | [[0, 0], [4, 0], [5, 0]] | Passed |
| exact radius spacing #1 | [[0, 0], [2, 0]] | [[0, 0], [2, 0]] | Passed |
| diagonal within radius #1 | [[0, 0]] | [[0, 0]] | Passed |
| quadrant full #1 | [[0, 0], [3, 0]] | [[0, 0], [3, 0]] | Passed |
| control #1 | [[3, 1], [1, 2], [1, 1]] | [[3, 1], [1, 2], [1, 1]] | Passed |
SHA-256 / 6d1fe659f31e111cd658b0493e4065fd1ac9e58c75fa14ddfc8b465c0614965d
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.952493+00:00.
Case digest / 43c05b41294e38bf7ca059e42cd40ebbbb7b31b4935a312c220124955c4457d6