FAILURE MAP
← Case archive

FA-86681 / Procedural level generation constraints / Open access

Decoration scatter with quadrant quota: Scatter spacing uses Manhattan distance · case 01

Props cluster diagonally closer than the radius.

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

ROOT CAUSE

The spacing test uses Manhattan distance instead of Euclidean.

THE FAILURE

The spacing test uses Manhattan distance instead of Euclidean.

Unsuccessful approach: The inclusive test rejects props at exactly the radius.

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(abs(x - px) + abs(y - py) < 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 = [[('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['..', '.#', '..', '~~', '..', '..', '..'],
    [[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]]),
  ('fault site spacing metric #2',
   [['..#.', '..#.', '..~.', '....'], [[2, 3], [4, 2], [0, 2], [0, 1], [4, 3]], 3, 3],
   [[2, 3]]),
  ('partial repair boundary #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]]),
  ('partial repair boundary #2',
   [['...~.#', '.#....'], [[0, 2], [6, 1], [2, 0], [6, 0], [2, 1], [2, 1], [1, 2], [0, 1]], 1, 1],
   [[2, 0], [2, 1]]),
  ('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]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['..#.', '..#.', '..~.', '....'], [[2, 3], [4, 2], [0, 2], [0, 1], [4, 3]], 3, 3],
   [[2, 3]]),
  ('fault site spacing metric #2',
   [['~~~.', '..~#', '#.~.', '~.~#', '..~#', '....', '#..~'],
    [[3, 5], [4, 3], [3, 1], [4, 7], [2, 3], [4, 7], [0, 6], [0, 1], [4, 2], [3, 6], [1, 4], [1, 4]],
    3,
    2],
   [[3, 5], [0, 1]]),
  ('partial repair boundary #1',
   [['...~.#', '.#....'], [[0, 2], [6, 1], [2, 0], [6, 0], [2, 1], [2, 1], [1, 2], [0, 1]], 1, 1],
   [[2, 0], [2, 1]]),
  ('partial repair boundary #2',
   [['...~#.~~', '~~~~#.~.', '~.#....#', '#~..~...'], [[0, 4], [1, 1], [5, 2], [3, 2], [1, 1]], 2, 2],
   [[5, 2], [3, 2]]),
  ('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]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['...', '~..', '...', '...', '...', '.#~'],
    [[2, 5], [2, 1], [2, 2], [3, 5], [0, 1], [2, 6], [0, 2], [1, 3], [0, 5]],
    3,
    3],
   [[2, 1], [0, 5]]),
  ('fault site spacing metric #2',
   [['..#', '.~~', '.~~', '#.#', '...'], [[1, 3], [0, 4], [0, 2], [3, 4], [2, 0], [0, 3], [1, 0]], 2, 2],
   [[1, 3], [1, 0]]),
  ('partial repair boundary #1',
   [['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
    [[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
    1,
    2],
   [[1, 1], [0, 1], [4, 2]]),
  ('partial repair boundary #2',
   [['.~.##~', '..~...', '....#.', '~.....', '...#.~'],
    [[2, 1], [6, 5], [2, 1], [6, 3], [0, 2], [5, 5], [2, 2], [3, 2], [3, 4]],
    2,
    3],
   [[0, 2], [2, 2]]),
  ('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
  ('control #1', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['#.', '.#', '.#'], [[1, 0], [1, 0], [2, 0], [0, 1], [0, 1], [0, 3], [0, 3]], 2, 3],
   [[1, 0]]),
  ('fault site spacing metric #2',
   [['..~.~', '..#..', '.#.#.', '~.~..'],
    [[2, 2], [3, 2], [2, 1], [0, 3], [4, 1], [1, 1], [5, 3], [3, 3], [2, 0], [2, 1]],
    3,
    3],
   [[2, 2]]),
  ('partial repair boundary #1',
   [['..', '..', '~.', '#.', '..', '..', '~~'], [[1, 7], [1, 3], [1, 1]], 2, 3],
   [[1, 3], [1, 1]]),
  ('partial repair boundary #2',
   [['....'], [[2, 1], [0, 0], [2, 0], [4, 0], [1, 0], [4, 0], [4, 1], [3, 1], [1, 1]], 2, 2],
   [[0, 0], [2, 0]]),
  ('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 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]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['~...', '.#..', '..~.', '...#', '##..', '.#.~'],
    [[2, 3], [0, 1], [4, 5], [0, 1], [0, 2], [0, 2], [1, 1], [3, 6], [0, 6], [3, 6], [3, 4], [0, 0]],
    2,
    2],
   [[2, 3], [0, 1]]),
  ('fault site spacing metric #2',
   [['...#~.', '...~..', '..#..~', '......'],
    [[1, 0], [6, 1], [6, 2], [4, 4], [1, 1], [3, 4], [2, 1], [5, 2], [3, 0], [3, 4]],
    2,
    2],
   [[1, 0]]),
  ('partial repair boundary #1',
   [['.~...', '..~..', '..#~.', '#~...', '.~...'],
    [[3, 3], [0, 5], [3, 1], [3, 4], [2, 5], [0, 4], [3, 0]],
    1,
    3],
   [[3, 3], [3, 1], [3, 4], [0, 4], [3, 0]]),
  ('partial repair boundary #2',
   [['..#..~', '..#~.~', '~.#...', '.#....', '..~.~.'],
    [[6, 0], [1, 1], [6, 3], [1, 0], [3, 2], [3, 1], [2, 2], [6, 5], [1, 3], [3, 2], [2, 3]],
    1,
    2],
   [[1, 1], [1, 0], [3, 2], [2, 3]]),
  ('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
  ('control #1', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[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
diagonal within radius #1[[0, 0], [1, 1]][[0, 0]]Failed
exact radius spacing #1[[0, 0], [2, 0]][[0, 0], [2, 0]]Passed
fault site spacing metric #1[[1, 6], [0, 0], [0, 4]][[1, 6], [0, 0]]Failed
fault site spacing metric #2[[2, 3], [0, 2]][[2, 3]]Failed
partial repair boundary #1[[3, 1], [1, 2], [1, 1]][[3, 1], [1, 2], [1, 1]]Passed
partial repair boundary #2[[2, 0], [2, 1]][[2, 0], [2, 1]]Passed
quadrant full #1[[0, 0], [3, 0]][[0, 0], [3, 0]]Passed
control #1[[1, 2], [4, 3]][[1, 2], [4, 3]]Passed

SHA-256 / 21f616000a6fff8acc5ccebaaa7ee84d6480c2422261d1f39ef3dae819a7d2d1

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] = quota.get(q, 0) + 1
    return placed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['..', '.#', '..', '~~', '..', '..', '..'],
    [[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]]),
  ('fault site spacing metric #2',
   [['..#.', '..#.', '..~.', '....'], [[2, 3], [4, 2], [0, 2], [0, 1], [4, 3]], 3, 3],
   [[2, 3]]),
  ('partial repair boundary #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]]),
  ('partial repair boundary #2',
   [['...~.#', '.#....'], [[0, 2], [6, 1], [2, 0], [6, 0], [2, 1], [2, 1], [1, 2], [0, 1]], 1, 1],
   [[2, 0], [2, 1]]),
  ('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]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['..#.', '..#.', '..~.', '....'], [[2, 3], [4, 2], [0, 2], [0, 1], [4, 3]], 3, 3],
   [[2, 3]]),
  ('fault site spacing metric #2',
   [['~~~.', '..~#', '#.~.', '~.~#', '..~#', '....', '#..~'],
    [[3, 5], [4, 3], [3, 1], [4, 7], [2, 3], [4, 7], [0, 6], [0, 1], [4, 2], [3, 6], [1, 4], [1, 4]],
    3,
    2],
   [[3, 5], [0, 1]]),
  ('partial repair boundary #1',
   [['...~.#', '.#....'], [[0, 2], [6, 1], [2, 0], [6, 0], [2, 1], [2, 1], [1, 2], [0, 1]], 1, 1],
   [[2, 0], [2, 1]]),
  ('partial repair boundary #2',
   [['...~#.~~', '~~~~#.~.', '~.#....#', '#~..~...'], [[0, 4], [1, 1], [5, 2], [3, 2], [1, 1]], 2, 2],
   [[5, 2], [3, 2]]),
  ('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]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['...', '~..', '...', '...', '...', '.#~'],
    [[2, 5], [2, 1], [2, 2], [3, 5], [0, 1], [2, 6], [0, 2], [1, 3], [0, 5]],
    3,
    3],
   [[2, 1], [0, 5]]),
  ('fault site spacing metric #2',
   [['..#', '.~~', '.~~', '#.#', '...'], [[1, 3], [0, 4], [0, 2], [3, 4], [2, 0], [0, 3], [1, 0]], 2, 2],
   [[1, 3], [1, 0]]),
  ('partial repair boundary #1',
   [['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
    [[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
    1,
    2],
   [[1, 1], [0, 1], [4, 2]]),
  ('partial repair boundary #2',
   [['.~.##~', '..~...', '....#.', '~.....', '...#.~'],
    [[2, 1], [6, 5], [2, 1], [6, 3], [0, 2], [5, 5], [2, 2], [3, 2], [3, 4]],
    2,
    3],
   [[0, 2], [2, 2]]),
  ('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
  ('control #1', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['#.', '.#', '.#'], [[1, 0], [1, 0], [2, 0], [0, 1], [0, 1], [0, 3], [0, 3]], 2, 3],
   [[1, 0]]),
  ('fault site spacing metric #2',
   [['..~.~', '..#..', '.#.#.', '~.~..'],
    [[2, 2], [3, 2], [2, 1], [0, 3], [4, 1], [1, 1], [5, 3], [3, 3], [2, 0], [2, 1]],
    3,
    3],
   [[2, 2]]),
  ('partial repair boundary #1',
   [['..', '..', '~.', '#.', '..', '..', '~~'], [[1, 7], [1, 3], [1, 1]], 2, 3],
   [[1, 3], [1, 1]]),
  ('partial repair boundary #2',
   [['....'], [[2, 1], [0, 0], [2, 0], [4, 0], [1, 0], [4, 0], [4, 1], [3, 1], [1, 1]], 2, 2],
   [[0, 0], [2, 0]]),
  ('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 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]])],
 [('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('exact radius spacing #1', [['.....'], [[0, 0], [2, 0]], 2, 3], [[0, 0], [2, 0]]),
  ('fault site spacing metric #1',
   [['~...', '.#..', '..~.', '...#', '##..', '.#.~'],
    [[2, 3], [0, 1], [4, 5], [0, 1], [0, 2], [0, 2], [1, 1], [3, 6], [0, 6], [3, 6], [3, 4], [0, 0]],
    2,
    2],
   [[2, 3], [0, 1]]),
  ('fault site spacing metric #2',
   [['...#~.', '...~..', '..#..~', '......'],
    [[1, 0], [6, 1], [6, 2], [4, 4], [1, 1], [3, 4], [2, 1], [5, 2], [3, 0], [3, 4]],
    2,
    2],
   [[1, 0]]),
  ('partial repair boundary #1',
   [['.~...', '..~..', '..#~.', '#~...', '.~...'],
    [[3, 3], [0, 5], [3, 1], [3, 4], [2, 5], [0, 4], [3, 0]],
    1,
    3],
   [[3, 3], [3, 1], [3, 4], [0, 4], [3, 0]]),
  ('partial repair boundary #2',
   [['..#..~', '..#~.~', '~.#...', '.#....', '..~.~.'],
    [[6, 0], [1, 1], [6, 3], [1, 0], [3, 2], [3, 1], [2, 2], [6, 5], [1, 3], [3, 2], [2, 3]],
    1,
    2],
   [[1, 1], [1, 0], [3, 2], [2, 3]]),
  ('quadrant full #1', [['....', '....'], [[0, 0], [1, 0], [3, 0]], 1, 1], [[0, 0], [3, 0]]),
  ('control #1', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[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
diagonal within radius #1[[0, 0]][[0, 0]]Passed
exact radius spacing #1[[0, 0]][[0, 0], [2, 0]]Failed
fault site spacing metric #1[[1, 6], [0, 0]][[1, 6], [0, 0]]Passed
fault site spacing metric #2[[2, 3]][[2, 3]]Passed
partial repair boundary #1[[3, 1], [1, 2], [0, 1]][[3, 1], [1, 2], [1, 1]]Failed
partial repair boundary #2[[2, 0], [0, 1]][[2, 0], [2, 1]]Failed
quadrant full #1[[0, 0], [3, 0]][[0, 0], [3, 0]]Passed
control #1[[1, 2], [4, 3]][[1, 2], [4, 3]]Passed

SHA-256 / c39ce1dbf1ea208464f784afc55ea04d8630b3be366f968b040b6f27331b2416

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 968e4a187d5d05e04fec84ff623cb200187e87e1db36129c9b5c71e84659aad2