FAILURE MAP
← Case archive

FA-70506 / GIS polygon topology / Open access

Rook and queen polygon adjacency: queen vertex contact · case 01

Polygons meeting only at a corner are missing from queen neighbours.

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

ROOT CAUSE

Queen adjacency reuses the shared-edge test.

VERIFIED REPAIR

At the queen vertex contact step restore `ok = bool(V[i] & V[j])`, leaving the rest of the model unchanged.

Unsuccessful approach: Requiring two shared vertices still misses single-corner contacts.

Case contract

Input [polygons, mode] where each polygon is a closed ring of integer vertices on a noded coverage (shared borders use identical vertices). Rook neighbours share at least one non-degenerate edge irrespective of direction; queen neighbours share at least one vertex. Return, for each polygon index, the ascending list of neighbour indexes (never itself).

Why this case matters

Spatial weights for regional statistics, district contiguity checks and map colouring all start from adjacency.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    polys, mode = x
    def edges(r):
        return {tuple(sorted([tuple(a), tuple(b)])) for a, b in zip(r, r[1:]) if a != b}
    def verts(r):
        return {tuple(p) for p in r}
    E = [edges(p) for p in polys]
    V = [verts(p) for p in polys]
    out = []
    for i in range(len(polys)):
        nb = []
        for j in range(len(polys)):
            if i == j:
                continue
            if mode == 'rook':
                ok = bool(E[i] & E[j])
            else:
                ok = bool(E[i] & E[j])
            if ok:
                nb.append(j)
        out.append(nb)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]]], 'rook'], [[1, 3], [0], [], [0]]), ('control #1', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]]], 'queen'], [[1, 3], [0, 2, 3], [1], [0, 1]]), ('control #2', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 2], [0, 3], [0, 3], [1, 2]]), ('control #3', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]), ('control #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]), ('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #6', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'rook'], [[], []]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []])], [('control #3', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]), ('control #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]), ('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #6', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'rook'], [[], []]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []]), ('control #8', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []])], [('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []]), ('control #8', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []]), ('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #12', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0, 2], [1]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]])], [('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []]), ('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #12', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0, 2], [1]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #14', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'rook'], [[1], [0]]), ('control #15', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'queen'], [[1], [0]]), ('control #16', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0], []])], [('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #14', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'rook'], [[1], [0]]), ('control #15', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'queen'], [[1], [0]]), ('control #16', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0], []]), ('control #17', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #18', [[[[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #19', [[[[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]])]]
for label, args, expected in fixtures[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
control #0[[1, 3], [0], [], [0]][[1, 3], [0], [], [0]]Passed
control #1[[1, 3], [0], [], [0]][[1, 3], [0, 2, 3], [1], [0, 1]]Failed
control #2[[1, 2], [0, 3], [0, 3], [1, 2]][[1, 2], [0, 3], [0, 3], [1, 2]]Passed
control #3[[1, 2], [0, 3], [0, 3], [1, 2]][[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]Failed
control #4[[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]][[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]Passed
control #5[[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]][[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]Failed
control #6[[], []][[], []]Passed
control #7[[], []][[], []]Passed

SHA-256 / b76284b951e693affcda07d2ead68dd39c8d1a558e1df2b94a88ed572c5b9f2e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    polys, mode = x
    def edges(r):
        return {tuple(sorted([tuple(a), tuple(b)])) for a, b in zip(r, r[1:]) if a != b}
    def verts(r):
        return {tuple(p) for p in r}
    E = [edges(p) for p in polys]
    V = [verts(p) for p in polys]
    out = []
    for i in range(len(polys)):
        nb = []
        for j in range(len(polys)):
            if i == j:
                continue
            if mode == 'rook':
                ok = bool(E[i] & E[j])
            else:
                ok = bool(E[i] & E[j]) or len(V[i] & V[j]) > 1
            if ok:
                nb.append(j)
        out.append(nb)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]]], 'rook'], [[1, 3], [0], [], [0]]), ('control #1', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]]], 'queen'], [[1, 3], [0, 2, 3], [1], [0, 1]]), ('control #2', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 2], [0, 3], [0, 3], [1, 2]]), ('control #3', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]), ('control #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]), ('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #6', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'rook'], [[], []]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []])], [('control #3', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]), ('control #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]), ('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #6', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'rook'], [[], []]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []]), ('control #8', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []])], [('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []]), ('control #8', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []]), ('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #12', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0, 2], [1]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]])], [('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []]), ('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #12', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0, 2], [1]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #14', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'rook'], [[1], [0]]), ('control #15', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'queen'], [[1], [0]]), ('control #16', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0], []])], [('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #14', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'rook'], [[1], [0]]), ('control #15', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'queen'], [[1], [0]]), ('control #16', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0], []]), ('control #17', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #18', [[[[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #19', [[[[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]])]]
for label, args, expected in fixtures[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
control #0[[1, 3], [0], [], [0]][[1, 3], [0], [], [0]]Passed
control #1[[1, 3], [0], [], [0]][[1, 3], [0, 2, 3], [1], [0, 1]]Failed
control #2[[1, 2], [0, 3], [0, 3], [1, 2]][[1, 2], [0, 3], [0, 3], [1, 2]]Passed
control #3[[1, 2], [0, 3], [0, 3], [1, 2]][[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]Failed
control #4[[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]][[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]Passed
control #5[[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]][[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]Failed
control #6[[], []][[], []]Passed
control #7[[], []][[], []]Passed

SHA-256 / d319ad9dc488402ea512123ef24cfe510a94b90e71f50a53cb5097589a61afdc

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    polys, mode = x
    def edges(r):
        return {tuple(sorted([tuple(a), tuple(b)])) for a, b in zip(r, r[1:]) if a != b}
    def verts(r):
        return {tuple(p) for p in r}
    E = [edges(p) for p in polys]
    V = [verts(p) for p in polys]
    out = []
    for i in range(len(polys)):
        nb = []
        for j in range(len(polys)):
            if i == j:
                continue
            if mode == 'rook':
                ok = bool(E[i] & E[j])
            else:
                ok = bool(V[i] & V[j])
            if ok:
                nb.append(j)
        out.append(nb)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]]], 'rook'], [[1, 3], [0], [], [0]]), ('control #1', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]]], 'queen'], [[1, 3], [0, 2, 3], [1], [0, 1]]), ('control #2', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 2], [0, 3], [0, 3], [1, 2]]), ('control #3', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]), ('control #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]), ('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #6', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'rook'], [[], []]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []])], [('control #3', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]), ('control #4', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]), ('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #6', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'rook'], [[], []]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []]), ('control #8', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []])], [('control #5', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]], [[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]), ('control #7', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[10, 10], [12, 10], [11, 12], [10, 10]]], 'queen'], [[], []]), ('control #8', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []]), ('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #12', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0, 2], [1]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]])], [('control #9', [[[[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]]), ('control #10', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'rook'], [[], []]), ('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #12', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0, 2], [1]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #14', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'rook'], [[1], [0]]), ('control #15', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'queen'], [[1], [0]]), ('control #16', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0], []])], [('control #11', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]]], 'queen'], [[1], [0]]), ('control #13', [[[[0, 2], [2, 2], [2, 4], [0, 4], [0, 2]], [[2, 2], [4, 2], [4, 4], [2, 4], [2, 2]], [[4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #14', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'rook'], [[1], [0]]), ('control #15', [[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]], [[2, 0], [4, 0], [4, 2], [2, 2], [2, 0]]], 'queen'], [[1], [0]]), ('control #16', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[1], [0], []]), ('control #17', [[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]], [[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0, 2], [1]]), ('control #18', [[[[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'rook'], [[], []]), ('control #19', [[[[2, 0], [4, 0], [4, 2], [4, 2], [2, 2], [2, 0]], [[4, 2], [4, 2], [6, 2], [6, 4], [4, 4], [4, 2]]], 'queen'], [[1], [0]])]]
for label, args, expected in fixtures[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
control #0[[1, 3], [0], [], [0]][[1, 3], [0], [], [0]]Passed
control #1[[1, 3], [0, 2, 3], [1], [0, 1]][[1, 3], [0, 2, 3], [1], [0, 1]]Passed
control #2[[1, 2], [0, 3], [0, 3], [1, 2]][[1, 2], [0, 3], [0, 3], [1, 2]]Passed
control #3[[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]][[1, 2, 3], [0, 2, 3], [0, 1, 3], [0, 1, 2]]Passed
control #4[[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]][[1, 3], [0, 4], [4], [0, 4], [1, 2, 3]]Passed
control #5[[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]][[1, 3, 4], [0, 2, 3, 4], [1, 4], [0, 1, 4], [0, 1, 2, 3]]Passed
control #6[[], []][[], []]Passed
control #7[[], []][[], []]Passed

SHA-256 / a2ec273a243e876c87da3e12c4a10458ab02bfa429f10e73b8997cc809a6216b

Verification & scope

Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. 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:48:21.321282+00:00.

Case digest / 66627795a05b2d132aca72216706bbf49e54dd5cdc211628988927f33dace0cf