FA-86541 / Procedural level generation constraints / Open access
BSP dungeon partition: Bottom child splits one level deeper · case 01
The bottom half of every horizontal split is over-partitioned.
ROOT CAUSE
The second horizontal child does not consume depth.
VERIFIED REPAIR
Restore `split(x, y + half, w, h - half, d - 1)` at the second child depth step.
Unsuccessful approach: Consuming two levels under-partitions the bottom half.
Case contract
Recursively split the rectangle while depth remains. An axis can be split when that side is >= 2*min_size; if neither can, it is a leaf. Split vertically when w > h, or when w == h at even remaining depth; if the chosen axis cannot be split use the other. The first child gets floor(side/2). Returns leaves [x, y, w, h] in left/top-first order.
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(x, y, w, h, min_size, depth):
out = []
def split(x, y, w, h, d):
can_v = w >= 2 * min_size
can_h = h >= 2 * min_size
if d == 0 or not (can_v or can_h):
out.append([x, y, w, h])
return
vertical = w > h or (w == h and d % 2 == 0)
if vertical and not can_v:
vertical = False
elif not vertical and not can_h:
vertical = True
if vertical:
half = w // 2
split(x, y, half, h, d - 1)
split(x + half, y, w - half, h, d - 1)
else:
half = h // 2
split(x, y, w, half, d - 1)
split(x, y + half, w, h - half, d)
split(x, y, w, h, depth)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [3, 0, 14, 28, 4, 1], [[3, 0, 14, 14], [3, 14, 14, 14]]),
('regression second child depth #2', [4, 2, 16, 17, 2, 1], [[4, 2, 16, 8], [4, 10, 16, 9]]),
('partial repair boundary #1',
[3, 2, 2, 18, 2, 3],
[[3, 2, 2, 2],
[3, 4, 2, 2],
[3, 6, 2, 2],
[3, 8, 2, 3],
[3, 11, 2, 2],
[3, 13, 2, 2],
[3, 15, 2, 2],
[3, 17, 2, 3]]),
('regression second child depth #3', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [4, 2, 16, 17, 2, 1], [[4, 2, 16, 8], [4, 10, 16, 9]]),
('regression second child depth #2', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('partial repair boundary #1',
[3, 2, 2, 18, 2, 3],
[[3, 2, 2, 2],
[3, 4, 2, 2],
[3, 6, 2, 2],
[3, 8, 2, 3],
[3, 11, 2, 2],
[3, 13, 2, 2],
[3, 15, 2, 2],
[3, 17, 2, 3]]),
('regression second child depth #3',
[3, 3, 29, 24, 5, 3],
[[3, 3, 7, 12],
[10, 3, 7, 12],
[3, 15, 7, 12],
[10, 15, 7, 12],
[17, 3, 7, 12],
[24, 3, 8, 12],
[17, 15, 7, 12],
[24, 15, 8, 12]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1',
[3, 3, 29, 24, 5, 3],
[[3, 3, 7, 12],
[10, 3, 7, 12],
[3, 15, 7, 12],
[10, 15, 7, 12],
[17, 3, 7, 12],
[24, 3, 8, 12],
[17, 15, 7, 12],
[24, 15, 8, 12]]),
('regression second child depth #2',
[1, 0, 14, 21, 2, 2],
[[1, 0, 7, 10], [8, 0, 7, 10], [1, 10, 7, 11], [8, 10, 7, 11]]),
('regression second child depth #3', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('regression second child depth #4',
[3, 1, 22, 14, 2, 3],
[[3, 1, 5, 7],
[8, 1, 6, 7],
[3, 8, 5, 7],
[8, 8, 6, 7],
[14, 1, 5, 7],
[19, 1, 6, 7],
[14, 8, 5, 7],
[19, 8, 6, 7]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1',
[3, 1, 22, 14, 2, 3],
[[3, 1, 5, 7],
[8, 1, 6, 7],
[3, 8, 5, 7],
[8, 8, 6, 7],
[14, 1, 5, 7],
[19, 1, 6, 7],
[14, 8, 5, 7],
[19, 8, 6, 7]]),
('regression second child depth #2',
[3, 0, 26, 16, 2, 4],
[[3, 0, 6, 4],
[3, 4, 6, 4],
[9, 0, 7, 4],
[9, 4, 7, 4],
[3, 8, 6, 4],
[3, 12, 6, 4],
[9, 8, 7, 4],
[9, 12, 7, 4],
[16, 0, 6, 4],
[16, 4, 6, 4],
[22, 0, 7, 4],
[22, 4, 7, 4],
[16, 8, 6, 4],
[16, 12, 6, 4],
[22, 8, 7, 4],
[22, 12, 7, 4]]),
('regression second child depth #3',
[1, 0, 14, 21, 2, 2],
[[1, 0, 7, 10], [8, 0, 7, 10], [1, 10, 7, 11], [8, 10, 7, 11]]),
('regression second child depth #4', [1, 5, 1, 21, 2, 1], [[1, 5, 1, 10], [1, 15, 1, 11]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [5, 1, 1, 10, 4, 2], [[5, 1, 1, 5], [5, 6, 1, 5]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [1, 5, 1, 21, 2, 1], [[1, 5, 1, 10], [1, 15, 1, 11]]),
('regression second child depth #2', [2, 5, 1, 13, 2, 1], [[2, 5, 1, 6], [2, 11, 1, 7]]),
('regression second child depth #3',
[3, 0, 26, 16, 2, 4],
[[3, 0, 6, 4],
[3, 4, 6, 4],
[9, 0, 7, 4],
[9, 4, 7, 4],
[3, 8, 6, 4],
[3, 12, 6, 4],
[9, 8, 7, 4],
[9, 12, 7, 4],
[16, 0, 6, 4],
[16, 4, 6, 4],
[22, 0, 7, 4],
[22, 4, 7, 4],
[16, 8, 6, 4],
[16, 12, 6, 4],
[22, 8, 7, 4],
[22, 12, 7, 4]]),
('partial repair boundary #1',
[5, 4, 23, 8, 3, 4],
[[5, 4, 5, 4],
[5, 8, 5, 4],
[10, 4, 3, 4],
[13, 4, 3, 4],
[10, 8, 3, 4],
[13, 8, 3, 4],
[16, 4, 3, 4],
[19, 4, 3, 4],
[16, 8, 3, 4],
[19, 8, 3, 4],
[22, 4, 3, 4],
[25, 4, 3, 4],
[22, 8, 3, 4],
[25, 8, 3, 4]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [5, 1, 24, 20, 4, 0], [[5, 1, 24, 20]])]]
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 |
|---|---|---|---|
| square at even depth #1 | [[0, 0, 5, 5], [0, 5, 5, 2], [0, 7, 2, 3], [2, 7, 3, 3], [5, 0, 5, 5], [5, 5, 5, 2], [5, 7, 2, 3], [7, 7, 3, 3]] | [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]] | Failed |
| regression second child depth #1 | [[3, 0, 14, 14], [3, 14, 14, 7], [3, 21, 7, 7], [10, 21, 7, 7]] | [[3, 0, 14, 14], [3, 14, 14, 14]] | Failed |
| regression second child depth #2 | [[4, 2, 16, 8], [4, 10, 8, 9], [12, 10, 8, 9]] | [[4, 2, 16, 8], [4, 10, 16, 9]] | Failed |
| partial repair boundary #1 | [[3, 2, 2, 2], [3, 4, 2, 2], [3, 6, 2, 2], [3, 8, 2, 3], [3, 11, 2, 2], [3, 13, 2, 2], [3, 15, 2, 2], [3, 17, 2, 3]] | [[3, 2, 2, 2], [3, 4, 2, 2], [3, 6, 2, 2], [3, 8, 2, 3], [3, 11, 2, 2], [3, 13, 2, 2], [3, 15, 2, 2], [3, 17, 2, 3]] | Passed |
| regression second child depth #3 | [[5, 5, 2, 14], [5, 19, 2, 7], [5, 26, 2, 7]] | [[5, 5, 2, 14], [5, 19, 2, 14]] | Failed |
| exactly splittable #1 | [[0, 0, 4, 3], [4, 0, 4, 3]] | [[0, 0, 4, 3], [4, 0, 4, 3]] | Passed |
| odd width #1 | [[1, 1, 4, 4], [5, 1, 5, 4]] | [[1, 1, 4, 4], [5, 1, 5, 4]] | Passed |
| control #1 | [[2, 3, 8, 10], [10, 3, 8, 10]] | [[2, 3, 8, 10], [10, 3, 8, 10]] | Passed |
SHA-256 / 7958a89f28161dc2b002ea5aacc8da927b68888c162e50f506f35c3b90827f6f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x, y, w, h, min_size, depth):
out = []
def split(x, y, w, h, d):
can_v = w >= 2 * min_size
can_h = h >= 2 * min_size
if d == 0 or not (can_v or can_h):
out.append([x, y, w, h])
return
vertical = w > h or (w == h and d % 2 == 0)
if vertical and not can_v:
vertical = False
elif not vertical and not can_h:
vertical = True
if vertical:
half = w // 2
split(x, y, half, h, d - 1)
split(x + half, y, w - half, h, d - 1)
else:
half = h // 2
split(x, y, w, half, d - 1)
split(x, y + half, w, h - half, d - 2)
split(x, y, w, h, depth)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [3, 0, 14, 28, 4, 1], [[3, 0, 14, 14], [3, 14, 14, 14]]),
('regression second child depth #2', [4, 2, 16, 17, 2, 1], [[4, 2, 16, 8], [4, 10, 16, 9]]),
('partial repair boundary #1',
[3, 2, 2, 18, 2, 3],
[[3, 2, 2, 2],
[3, 4, 2, 2],
[3, 6, 2, 2],
[3, 8, 2, 3],
[3, 11, 2, 2],
[3, 13, 2, 2],
[3, 15, 2, 2],
[3, 17, 2, 3]]),
('regression second child depth #3', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [4, 2, 16, 17, 2, 1], [[4, 2, 16, 8], [4, 10, 16, 9]]),
('regression second child depth #2', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('partial repair boundary #1',
[3, 2, 2, 18, 2, 3],
[[3, 2, 2, 2],
[3, 4, 2, 2],
[3, 6, 2, 2],
[3, 8, 2, 3],
[3, 11, 2, 2],
[3, 13, 2, 2],
[3, 15, 2, 2],
[3, 17, 2, 3]]),
('regression second child depth #3',
[3, 3, 29, 24, 5, 3],
[[3, 3, 7, 12],
[10, 3, 7, 12],
[3, 15, 7, 12],
[10, 15, 7, 12],
[17, 3, 7, 12],
[24, 3, 8, 12],
[17, 15, 7, 12],
[24, 15, 8, 12]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1',
[3, 3, 29, 24, 5, 3],
[[3, 3, 7, 12],
[10, 3, 7, 12],
[3, 15, 7, 12],
[10, 15, 7, 12],
[17, 3, 7, 12],
[24, 3, 8, 12],
[17, 15, 7, 12],
[24, 15, 8, 12]]),
('regression second child depth #2',
[1, 0, 14, 21, 2, 2],
[[1, 0, 7, 10], [8, 0, 7, 10], [1, 10, 7, 11], [8, 10, 7, 11]]),
('regression second child depth #3', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('regression second child depth #4',
[3, 1, 22, 14, 2, 3],
[[3, 1, 5, 7],
[8, 1, 6, 7],
[3, 8, 5, 7],
[8, 8, 6, 7],
[14, 1, 5, 7],
[19, 1, 6, 7],
[14, 8, 5, 7],
[19, 8, 6, 7]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1',
[3, 1, 22, 14, 2, 3],
[[3, 1, 5, 7],
[8, 1, 6, 7],
[3, 8, 5, 7],
[8, 8, 6, 7],
[14, 1, 5, 7],
[19, 1, 6, 7],
[14, 8, 5, 7],
[19, 8, 6, 7]]),
('regression second child depth #2',
[3, 0, 26, 16, 2, 4],
[[3, 0, 6, 4],
[3, 4, 6, 4],
[9, 0, 7, 4],
[9, 4, 7, 4],
[3, 8, 6, 4],
[3, 12, 6, 4],
[9, 8, 7, 4],
[9, 12, 7, 4],
[16, 0, 6, 4],
[16, 4, 6, 4],
[22, 0, 7, 4],
[22, 4, 7, 4],
[16, 8, 6, 4],
[16, 12, 6, 4],
[22, 8, 7, 4],
[22, 12, 7, 4]]),
('regression second child depth #3',
[1, 0, 14, 21, 2, 2],
[[1, 0, 7, 10], [8, 0, 7, 10], [1, 10, 7, 11], [8, 10, 7, 11]]),
('regression second child depth #4', [1, 5, 1, 21, 2, 1], [[1, 5, 1, 10], [1, 15, 1, 11]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [5, 1, 1, 10, 4, 2], [[5, 1, 1, 5], [5, 6, 1, 5]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [1, 5, 1, 21, 2, 1], [[1, 5, 1, 10], [1, 15, 1, 11]]),
('regression second child depth #2', [2, 5, 1, 13, 2, 1], [[2, 5, 1, 6], [2, 11, 1, 7]]),
('regression second child depth #3',
[3, 0, 26, 16, 2, 4],
[[3, 0, 6, 4],
[3, 4, 6, 4],
[9, 0, 7, 4],
[9, 4, 7, 4],
[3, 8, 6, 4],
[3, 12, 6, 4],
[9, 8, 7, 4],
[9, 12, 7, 4],
[16, 0, 6, 4],
[16, 4, 6, 4],
[22, 0, 7, 4],
[22, 4, 7, 4],
[16, 8, 6, 4],
[16, 12, 6, 4],
[22, 8, 7, 4],
[22, 12, 7, 4]]),
('partial repair boundary #1',
[5, 4, 23, 8, 3, 4],
[[5, 4, 5, 4],
[5, 8, 5, 4],
[10, 4, 3, 4],
[13, 4, 3, 4],
[10, 8, 3, 4],
[13, 8, 3, 4],
[16, 4, 3, 4],
[19, 4, 3, 4],
[16, 8, 3, 4],
[19, 8, 3, 4],
[22, 4, 3, 4],
[25, 4, 3, 4],
[22, 8, 3, 4],
[25, 8, 3, 4]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [5, 1, 24, 20, 4, 0], [[5, 1, 24, 20]])]]
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 |
|---|---|---|---|
| square at even depth #1 | [[0, 0, 5, 5], [0, 5, 2, 2], [2, 5, 3, 2], [0, 7, 2, 3], [2, 7, 3, 3], [5, 0, 5, 5], [5, 5, 2, 2], [7, 5, 3, 2], [5, 7, 2, 3], [7, 7, 3, 3]] | [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]] | Failed |
| regression second child depth #1 | [[3, 0, 14, 14], [3, 14, 7, 7], [10, 14, 7, 7], [3, 21, 7, 7], [10, 21, 7, 7]] | [[3, 0, 14, 14], [3, 14, 14, 14]] | Failed |
| regression second child depth #2 | [[4, 2, 16, 8], [4, 10, 2, 2], [4, 12, 2, 2], [6, 10, 2, 2], [6, 12, 2, 2], [8, 10, 2, 2], [8, 12, 2, 2], [10, 10, 2, 2], [10, 12, 2, 2], [4, 14, 2, 2], [6, 14, 2, 2], [4, 16, 2, 3], [6, 16, 2, 3], [8, 14, 2, 2], [10, 14, 2, 2], [8, 16, 2, 3], [10, 16, 2, 3], [12, 10, 2, 2], [12, 12, 2, 2], [14, 10, 2, 2], [14, 12, 2, 2], [16, 10, 2, 2], [16, 12, 2, 2], [18, 10, 2, 2], [18, 12, 2, 2], [12, 14, 2, 2], [14, 14, 2, 2], [12, 16, 2, 3], [14, 16, 2, 3], [16, 14, 2, 2], [18, 14, 2, 2], [16, 16, 2, 3], [18, 16, 2, 3]] | [[4, 2, 16, 8], [4, 10, 16, 9]] | Failed |
| partial repair boundary #1 | [[3, 2, 2, 2], [3, 4, 2, 2], [3, 6, 2, 5], [3, 11, 2, 4], [3, 15, 2, 2], [3, 17, 2, 3]] | [[3, 2, 2, 2], [3, 4, 2, 2], [3, 6, 2, 2], [3, 8, 2, 3], [3, 11, 2, 2], [3, 13, 2, 2], [3, 15, 2, 2], [3, 17, 2, 3]] | Failed |
| regression second child depth #3 | [[5, 5, 2, 14], [5, 19, 2, 7], [5, 26, 2, 7]] | [[5, 5, 2, 14], [5, 19, 2, 14]] | Failed |
| exactly splittable #1 | [[0, 0, 4, 3], [4, 0, 4, 3]] | [[0, 0, 4, 3], [4, 0, 4, 3]] | Passed |
| odd width #1 | [[1, 1, 4, 4], [5, 1, 5, 4]] | [[1, 1, 4, 4], [5, 1, 5, 4]] | Passed |
| control #1 | [[2, 3, 8, 10], [10, 3, 8, 10]] | [[2, 3, 8, 10], [10, 3, 8, 10]] | Passed |
SHA-256 / 20ac54a339bfb56f0de4d72ce562903e704dc0cba683c823d3954428418239dc
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x, y, w, h, min_size, depth):
out = []
def split(x, y, w, h, d):
can_v = w >= 2 * min_size
can_h = h >= 2 * min_size
if d == 0 or not (can_v or can_h):
out.append([x, y, w, h])
return
vertical = w > h or (w == h and d % 2 == 0)
if vertical and not can_v:
vertical = False
elif not vertical and not can_h:
vertical = True
if vertical:
half = w // 2
split(x, y, half, h, d - 1)
split(x + half, y, w - half, h, d - 1)
else:
half = h // 2
split(x, y, w, half, d - 1)
split(x, y + half, w, h - half, d - 1)
split(x, y, w, h, depth)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [3, 0, 14, 28, 4, 1], [[3, 0, 14, 14], [3, 14, 14, 14]]),
('regression second child depth #2', [4, 2, 16, 17, 2, 1], [[4, 2, 16, 8], [4, 10, 16, 9]]),
('partial repair boundary #1',
[3, 2, 2, 18, 2, 3],
[[3, 2, 2, 2],
[3, 4, 2, 2],
[3, 6, 2, 2],
[3, 8, 2, 3],
[3, 11, 2, 2],
[3, 13, 2, 2],
[3, 15, 2, 2],
[3, 17, 2, 3]]),
('regression second child depth #3', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [4, 2, 16, 17, 2, 1], [[4, 2, 16, 8], [4, 10, 16, 9]]),
('regression second child depth #2', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('partial repair boundary #1',
[3, 2, 2, 18, 2, 3],
[[3, 2, 2, 2],
[3, 4, 2, 2],
[3, 6, 2, 2],
[3, 8, 2, 3],
[3, 11, 2, 2],
[3, 13, 2, 2],
[3, 15, 2, 2],
[3, 17, 2, 3]]),
('regression second child depth #3',
[3, 3, 29, 24, 5, 3],
[[3, 3, 7, 12],
[10, 3, 7, 12],
[3, 15, 7, 12],
[10, 15, 7, 12],
[17, 3, 7, 12],
[24, 3, 8, 12],
[17, 15, 7, 12],
[24, 15, 8, 12]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1',
[3, 3, 29, 24, 5, 3],
[[3, 3, 7, 12],
[10, 3, 7, 12],
[3, 15, 7, 12],
[10, 15, 7, 12],
[17, 3, 7, 12],
[24, 3, 8, 12],
[17, 15, 7, 12],
[24, 15, 8, 12]]),
('regression second child depth #2',
[1, 0, 14, 21, 2, 2],
[[1, 0, 7, 10], [8, 0, 7, 10], [1, 10, 7, 11], [8, 10, 7, 11]]),
('regression second child depth #3', [5, 5, 2, 28, 5, 1], [[5, 5, 2, 14], [5, 19, 2, 14]]),
('regression second child depth #4',
[3, 1, 22, 14, 2, 3],
[[3, 1, 5, 7],
[8, 1, 6, 7],
[3, 8, 5, 7],
[8, 8, 6, 7],
[14, 1, 5, 7],
[19, 1, 6, 7],
[14, 8, 5, 7],
[19, 8, 6, 7]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [2, 3, 16, 10, 5, 1], [[2, 3, 8, 10], [10, 3, 8, 10]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1',
[3, 1, 22, 14, 2, 3],
[[3, 1, 5, 7],
[8, 1, 6, 7],
[3, 8, 5, 7],
[8, 8, 6, 7],
[14, 1, 5, 7],
[19, 1, 6, 7],
[14, 8, 5, 7],
[19, 8, 6, 7]]),
('regression second child depth #2',
[3, 0, 26, 16, 2, 4],
[[3, 0, 6, 4],
[3, 4, 6, 4],
[9, 0, 7, 4],
[9, 4, 7, 4],
[3, 8, 6, 4],
[3, 12, 6, 4],
[9, 8, 7, 4],
[9, 12, 7, 4],
[16, 0, 6, 4],
[16, 4, 6, 4],
[22, 0, 7, 4],
[22, 4, 7, 4],
[16, 8, 6, 4],
[16, 12, 6, 4],
[22, 8, 7, 4],
[22, 12, 7, 4]]),
('regression second child depth #3',
[1, 0, 14, 21, 2, 2],
[[1, 0, 7, 10], [8, 0, 7, 10], [1, 10, 7, 11], [8, 10, 7, 11]]),
('regression second child depth #4', [1, 5, 1, 21, 2, 1], [[1, 5, 1, 10], [1, 15, 1, 11]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [5, 1, 1, 10, 4, 2], [[5, 1, 1, 5], [5, 6, 1, 5]])],
[('square at even depth #1', [0, 0, 10, 10, 2, 2], [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]]),
('regression second child depth #1', [1, 5, 1, 21, 2, 1], [[1, 5, 1, 10], [1, 15, 1, 11]]),
('regression second child depth #2', [2, 5, 1, 13, 2, 1], [[2, 5, 1, 6], [2, 11, 1, 7]]),
('regression second child depth #3',
[3, 0, 26, 16, 2, 4],
[[3, 0, 6, 4],
[3, 4, 6, 4],
[9, 0, 7, 4],
[9, 4, 7, 4],
[3, 8, 6, 4],
[3, 12, 6, 4],
[9, 8, 7, 4],
[9, 12, 7, 4],
[16, 0, 6, 4],
[16, 4, 6, 4],
[22, 0, 7, 4],
[22, 4, 7, 4],
[16, 8, 6, 4],
[16, 12, 6, 4],
[22, 8, 7, 4],
[22, 12, 7, 4]]),
('partial repair boundary #1',
[5, 4, 23, 8, 3, 4],
[[5, 4, 5, 4],
[5, 8, 5, 4],
[10, 4, 3, 4],
[13, 4, 3, 4],
[10, 8, 3, 4],
[13, 8, 3, 4],
[16, 4, 3, 4],
[19, 4, 3, 4],
[16, 8, 3, 4],
[19, 8, 3, 4],
[22, 4, 3, 4],
[25, 4, 3, 4],
[22, 8, 3, 4],
[25, 8, 3, 4]]),
('exactly splittable #1', [0, 0, 8, 3, 4, 1], [[0, 0, 4, 3], [4, 0, 4, 3]]),
('odd width #1', [1, 1, 9, 4, 2, 1], [[1, 1, 4, 4], [5, 1, 5, 4]]),
('control #1', [5, 1, 24, 20, 4, 0], [[5, 1, 24, 20]])]]
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 |
|---|---|---|---|
| square at even depth #1 | [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]] | [[0, 0, 5, 5], [0, 5, 5, 5], [5, 0, 5, 5], [5, 5, 5, 5]] | Passed |
| regression second child depth #1 | [[3, 0, 14, 14], [3, 14, 14, 14]] | [[3, 0, 14, 14], [3, 14, 14, 14]] | Passed |
| regression second child depth #2 | [[4, 2, 16, 8], [4, 10, 16, 9]] | [[4, 2, 16, 8], [4, 10, 16, 9]] | Passed |
| partial repair boundary #1 | [[3, 2, 2, 2], [3, 4, 2, 2], [3, 6, 2, 2], [3, 8, 2, 3], [3, 11, 2, 2], [3, 13, 2, 2], [3, 15, 2, 2], [3, 17, 2, 3]] | [[3, 2, 2, 2], [3, 4, 2, 2], [3, 6, 2, 2], [3, 8, 2, 3], [3, 11, 2, 2], [3, 13, 2, 2], [3, 15, 2, 2], [3, 17, 2, 3]] | Passed |
| regression second child depth #3 | [[5, 5, 2, 14], [5, 19, 2, 14]] | [[5, 5, 2, 14], [5, 19, 2, 14]] | Passed |
| exactly splittable #1 | [[0, 0, 4, 3], [4, 0, 4, 3]] | [[0, 0, 4, 3], [4, 0, 4, 3]] | Passed |
| odd width #1 | [[1, 1, 4, 4], [5, 1, 5, 4]] | [[1, 1, 4, 4], [5, 1, 5, 4]] | Passed |
| control #1 | [[2, 3, 8, 10], [10, 3, 8, 10]] | [[2, 3, 8, 10], [10, 3, 8, 10]] | Passed |
SHA-256 / 3b12c3b60d80d995485ec07b9048042c427dfdf2e3a509d14c93a67aaa82f57c
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:50.564077+00:00.
Case digest / 630295969503ca386c4934749cb907891b49e1effbe7627be606be3ce88ee058