FAILURE MAP
← Case archive

FA-86701 / Procedural level generation constraints / Open access

Decoration scatter with quadrant quota: Tile lookup transposed · case 01

Props appear inside walls on non-square maps.

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

ROOT CAUSE

The grid is indexed [x][y] although rows are y.

THE FAILURE

The grid is indexed [x][y] although rows are y.

Unsuccessful approach: Only rejecting walls lets props spawn in water.

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[x][y] != '.':
            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 = [[('regression tile lookup #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]]),
  ('regression tile lookup #2',
   [['..#.~~', '.~...#', '~...~.', '~....#', '..##..'], [[6, 3], [5, 5], [6, 4], [2, 2], [0, 3]], 1, 1],
   [[2, 2]]),
  ('regression tile lookup #3',
   [['...~....', '###.####', '.......#', '~~#.~...', '..#..~..', '.##~#~#.', '....#.#.', '~.....#.'],
    [[0, 6], [3, 4], [5, 4], [3, 5]],
    2,
    2],
   [[0, 6], [3, 4]]),
  ('regression tile lookup #4',
   [['.~~..', '#....', '..##.', '...#.'], [[3, 4], [4, 4], [4, 4], [0, 4], [3, 1], [0, 3], [2, 0]], 1, 3],
   [[3, 1], [0, 3]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]]),
  ('control #2', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[0, 0]]),
  ('control #3',
   [['...', '.#.'], [[3, 1], [0, 2], [1, 2], [2, 2], [3, 0], [3, 1], [3, 0], [1, 0]], 1, 2],
   [[1, 0]])],
 [('fault site tile lookup #1',
   [['..#', '...', '...', '#..', '...', '..#', '.#.', '..~'], [[2, 0]], 2, 1],
   []),
  ('regression tile lookup #1',
   [['...~....', '###.####', '.......#', '~~#.~...', '..#..~..', '.##~#~#.', '....#.#.', '~.....#.'],
    [[0, 6], [3, 4], [5, 4], [3, 5]],
    2,
    2],
   [[0, 6], [3, 4]]),
  ('regression tile lookup #2',
   [['.~~..', '#....', '..##.', '...#.'], [[3, 4], [4, 4], [4, 4], [0, 4], [3, 1], [0, 3], [2, 0]], 1, 3],
   [[3, 1], [0, 3]]),
  ('regression tile lookup #3',
   [['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
    [[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
    1,
    2],
   [[1, 1], [0, 1], [4, 2]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1',
   [['...', '.#.'], [[3, 1], [0, 2], [1, 2], [2, 2], [3, 0], [3, 1], [3, 0], [1, 0]], 1, 2],
   [[1, 0]]),
  ('control #2',
   [['..#...', '...~..', '.~..#.', '......', '..~...', '.#....'], [[3, 3], [3, 3]], 3, 1],
   [[3, 3]]),
  ('control #3',
   [['..#.', '..#.', '..~.', '....'], [[2, 3], [4, 2], [0, 2], [0, 1], [4, 3]], 3, 3],
   [[2, 3]])],
 [('regression tile lookup #1',
   [['.~~..', '#....', '..##.', '...#.'], [[3, 4], [4, 4], [4, 4], [0, 4], [3, 1], [0, 3], [2, 0]], 1, 3],
   [[3, 1], [0, 3]]),
  ('regression tile lookup #2',
   [['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
    [[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
    1,
    2],
   [[1, 1], [0, 1], [4, 2]]),
  ('regression tile lookup #3',
   [['.~.##~', '..~...', '....#.', '~.....', '...#.~'],
    [[2, 1], [6, 5], [2, 1], [6, 3], [0, 2], [5, 5], [2, 2], [3, 2], [3, 4]],
    2,
    3],
   [[0, 2], [2, 2]]),
  ('partial repair boundary #1',
   [['~..', '~~.', '..~'],
    [[2, 3], [3, 0], [3, 0], [3, 0], [0, 0], [1, 1], [1, 3], [2, 0], [3, 0], [1, 3], [2, 1]],
    2,
    3],
   [[2, 0]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1',
   [['.~..', '....', '~.~.', '~...', '....'], [[4, 1], [4, 3], [2, 3], [0, 0], [2, 3]], 1, 1],
   [[2, 3], [0, 0]]),
  ('control #2',
   [['#.', '.#', '.#'], [[1, 0], [1, 0], [2, 0], [0, 1], [0, 1], [0, 3], [0, 3]], 2, 3],
   [[1, 0]]),
  ('control #3', [['..~', '~~.', '..~'], [[0, 3], [0, 3], [1, 2], [2, 1], [1, 2], [3, 0]], 3, 1], [[1, 2]])],
 [('regression tile lookup #1',
   [['.~.##~', '..~...', '....#.', '~.....', '...#.~'],
    [[2, 1], [6, 5], [2, 1], [6, 3], [0, 2], [5, 5], [2, 2], [3, 2], [3, 4]],
    2,
    3],
   [[0, 2], [2, 2]]),
  ('regression tile lookup #2',
   [['~~', '..', '.#'],
    [[0, 3], [2, 3], [1, 0], [2, 1], [0, 1], [1, 1], [2, 3], [2, 0], [1, 3], [0, 1], [2, 0]],
    2,
    3],
   [[0, 1]]),
  ('partial repair boundary #1',
   [['~..', '~~.', '..~'],
    [[2, 3], [3, 0], [3, 0], [3, 0], [0, 0], [1, 1], [1, 3], [2, 0], [3, 0], [1, 3], [2, 1]],
    2,
    3],
   [[2, 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]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1',
   [['...~..', '..~~..', '....##', '.#....', '......', '...~..'],
    [[2, 3], [2, 0], [0, 1], [3, 4], [5, 4], [3, 3], [4, 0], [6, 1], [5, 4], [1, 6], [6, 4]],
    3,
    1],
   [[2, 3], [2, 0], [5, 4]]),
  ('control #2',
   [['#..#~...', '~.....~.', '.#..#...', '~.......', '~.......', '...#..##', '.#.~...~', '..#..~#.'],
    [[1, 3], [4, 4]],
    1,
    1],
   [[1, 3], [4, 4]]),
  ('control #3',
   [['...', '...', '...'],
    [[0, 3], [2, 2], [0, 2], [1, 3], [3, 1], [0, 0], [0, 0], [2, 0], [3, 2], [3, 0]],
    2,
    2],
   [[2, 2], [0, 2], [0, 0], [2, 0]])],
 [('fault site tile lookup #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]]),
  ('fault site tile lookup #2',
   [['~#.#~.', '~~...~', '..~.##', '..#..#', '.~..#.', '#~..#.', '.~#...', '......'],
    [[1, 0], [6, 4], [4, 1], [4, 5], [5, 0], [6, 0], [5, 0]],
    1,
    3],
   [[4, 1], [5, 0]]),
  ('partial repair boundary #1',
   [['..#..~', '..#~.~', '~.#...', '.#....', '..~.~.'],
    [[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]]),
  ('regression tile lookup #1',
   [['....~..', '.~.#..~', '#...#..', '~~###..', '....#.#'],
    [[0, 2], [0, 2], [2, 1], [2, 1], [2, 2], [0, 3], [0, 3]],
    1,
    3],
   [[2, 1], [2, 2]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1', [['...#..', '~~.#.~'], [[5, 2], [0, 2]], 3, 3], []),
  ('control #2', [['.', '.', '.', '~'], [[1, 4], [1, 4]], 2, 3], []),
  ('control #3', [['.~..', '....', '..##', '.#.#'], [[3, 0], [1, 1], [3, 4]], 2, 1], [[3, 0], [1, 1]])]]
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
regression tile lookup #1[[0, 1]][[0, 0]]Failed
regression tile lookup #2[[2, 2], [0, 3]][[2, 2]]Failed
regression tile lookup #3[[0, 6], [3, 5]][[0, 6], [3, 4]]Failed
regression tile lookup #4[[3, 1], [0, 3], [2, 0]][[3, 1], [0, 3]]Failed
diagonal within radius #1[[0, 0]][[0, 0]]Passed
control #1[[1, 1]][[1, 1]]Passed
control #2[[0, 0]][[0, 0]]Passed
control #3[[1, 0]][[1, 0]]Passed

SHA-256 / b4ffc3f7204cef198cb1cd080881a41ef46b0f8429b4f1bef1f0557770856d63

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 = [[('regression tile lookup #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]]),
  ('regression tile lookup #2',
   [['..#.~~', '.~...#', '~...~.', '~....#', '..##..'], [[6, 3], [5, 5], [6, 4], [2, 2], [0, 3]], 1, 1],
   [[2, 2]]),
  ('regression tile lookup #3',
   [['...~....', '###.####', '.......#', '~~#.~...', '..#..~..', '.##~#~#.', '....#.#.', '~.....#.'],
    [[0, 6], [3, 4], [5, 4], [3, 5]],
    2,
    2],
   [[0, 6], [3, 4]]),
  ('regression tile lookup #4',
   [['.~~..', '#....', '..##.', '...#.'], [[3, 4], [4, 4], [4, 4], [0, 4], [3, 1], [0, 3], [2, 0]], 1, 3],
   [[3, 1], [0, 3]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1', [['#..', '..#'], [[1, 1]], 1, 1], [[1, 1]]),
  ('control #2', [['.'], [[0, 0], [0, 0], [1, 0], [1, 1]], 1, 2], [[0, 0]]),
  ('control #3',
   [['...', '.#.'], [[3, 1], [0, 2], [1, 2], [2, 2], [3, 0], [3, 1], [3, 0], [1, 0]], 1, 2],
   [[1, 0]])],
 [('fault site tile lookup #1',
   [['..#', '...', '...', '#..', '...', '..#', '.#.', '..~'], [[2, 0]], 2, 1],
   []),
  ('regression tile lookup #1',
   [['...~....', '###.####', '.......#', '~~#.~...', '..#..~..', '.##~#~#.', '....#.#.', '~.....#.'],
    [[0, 6], [3, 4], [5, 4], [3, 5]],
    2,
    2],
   [[0, 6], [3, 4]]),
  ('regression tile lookup #2',
   [['.~~..', '#....', '..##.', '...#.'], [[3, 4], [4, 4], [4, 4], [0, 4], [3, 1], [0, 3], [2, 0]], 1, 3],
   [[3, 1], [0, 3]]),
  ('regression tile lookup #3',
   [['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
    [[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
    1,
    2],
   [[1, 1], [0, 1], [4, 2]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1',
   [['...', '.#.'], [[3, 1], [0, 2], [1, 2], [2, 2], [3, 0], [3, 1], [3, 0], [1, 0]], 1, 2],
   [[1, 0]]),
  ('control #2',
   [['..#...', '...~..', '.~..#.', '......', '..~...', '.#....'], [[3, 3], [3, 3]], 3, 1],
   [[3, 3]]),
  ('control #3',
   [['..#.', '..#.', '..~.', '....'], [[2, 3], [4, 2], [0, 2], [0, 1], [4, 3]], 3, 3],
   [[2, 3]])],
 [('regression tile lookup #1',
   [['.~~..', '#....', '..##.', '...#.'], [[3, 4], [4, 4], [4, 4], [0, 4], [3, 1], [0, 3], [2, 0]], 1, 3],
   [[3, 1], [0, 3]]),
  ('regression tile lookup #2',
   [['.....#..', '..#..~~.', '~.~...~.', '.~~..~.#', '.~~.~~..'],
    [[1, 1], [0, 1], [0, 0], [4, 2], [2, 4]],
    1,
    2],
   [[1, 1], [0, 1], [4, 2]]),
  ('regression tile lookup #3',
   [['.~.##~', '..~...', '....#.', '~.....', '...#.~'],
    [[2, 1], [6, 5], [2, 1], [6, 3], [0, 2], [5, 5], [2, 2], [3, 2], [3, 4]],
    2,
    3],
   [[0, 2], [2, 2]]),
  ('partial repair boundary #1',
   [['~..', '~~.', '..~'],
    [[2, 3], [3, 0], [3, 0], [3, 0], [0, 0], [1, 1], [1, 3], [2, 0], [3, 0], [1, 3], [2, 1]],
    2,
    3],
   [[2, 0]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1',
   [['.~..', '....', '~.~.', '~...', '....'], [[4, 1], [4, 3], [2, 3], [0, 0], [2, 3]], 1, 1],
   [[2, 3], [0, 0]]),
  ('control #2',
   [['#.', '.#', '.#'], [[1, 0], [1, 0], [2, 0], [0, 1], [0, 1], [0, 3], [0, 3]], 2, 3],
   [[1, 0]]),
  ('control #3', [['..~', '~~.', '..~'], [[0, 3], [0, 3], [1, 2], [2, 1], [1, 2], [3, 0]], 3, 1], [[1, 2]])],
 [('regression tile lookup #1',
   [['.~.##~', '..~...', '....#.', '~.....', '...#.~'],
    [[2, 1], [6, 5], [2, 1], [6, 3], [0, 2], [5, 5], [2, 2], [3, 2], [3, 4]],
    2,
    3],
   [[0, 2], [2, 2]]),
  ('regression tile lookup #2',
   [['~~', '..', '.#'],
    [[0, 3], [2, 3], [1, 0], [2, 1], [0, 1], [1, 1], [2, 3], [2, 0], [1, 3], [0, 1], [2, 0]],
    2,
    3],
   [[0, 1]]),
  ('partial repair boundary #1',
   [['~..', '~~.', '..~'],
    [[2, 3], [3, 0], [3, 0], [3, 0], [0, 0], [1, 1], [1, 3], [2, 0], [3, 0], [1, 3], [2, 1]],
    2,
    3],
   [[2, 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]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1',
   [['...~..', '..~~..', '....##', '.#....', '......', '...~..'],
    [[2, 3], [2, 0], [0, 1], [3, 4], [5, 4], [3, 3], [4, 0], [6, 1], [5, 4], [1, 6], [6, 4]],
    3,
    1],
   [[2, 3], [2, 0], [5, 4]]),
  ('control #2',
   [['#..#~...', '~.....~.', '.#..#...', '~.......', '~.......', '...#..##', '.#.~...~', '..#..~#.'],
    [[1, 3], [4, 4]],
    1,
    1],
   [[1, 3], [4, 4]]),
  ('control #3',
   [['...', '...', '...'],
    [[0, 3], [2, 2], [0, 2], [1, 3], [3, 1], [0, 0], [0, 0], [2, 0], [3, 2], [3, 0]],
    2,
    2],
   [[2, 2], [0, 2], [0, 0], [2, 0]])],
 [('fault site tile lookup #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]]),
  ('fault site tile lookup #2',
   [['~#.#~.', '~~...~', '..~.##', '..#..#', '.~..#.', '#~..#.', '.~#...', '......'],
    [[1, 0], [6, 4], [4, 1], [4, 5], [5, 0], [6, 0], [5, 0]],
    1,
    3],
   [[4, 1], [5, 0]]),
  ('partial repair boundary #1',
   [['..#..~', '..#~.~', '~.#...', '.#....', '..~.~.'],
    [[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]]),
  ('regression tile lookup #1',
   [['....~..', '.~.#..~', '#...#..', '~~###..', '....#.#'],
    [[0, 2], [0, 2], [2, 1], [2, 1], [2, 2], [0, 3], [0, 3]],
    1,
    3],
   [[2, 1], [2, 2]]),
  ('diagonal within radius #1', [['...', '...', '...'], [[0, 0], [1, 1]], 2, 3], [[0, 0]]),
  ('control #1', [['...#..', '~~.#.~'], [[5, 2], [0, 2]], 3, 3], []),
  ('control #2', [['.', '.', '.', '~'], [[1, 4], [1, 4]], 2, 3], []),
  ('control #3', [['.~..', '....', '..##', '.#.#'], [[3, 0], [1, 1], [3, 4]], 2, 1], [[3, 0], [1, 1]])]]
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
regression tile lookup #1[[0, 1]][[0, 0]]Failed
regression tile lookup #2[[2, 2], [0, 3]][[2, 2]]Failed
regression tile lookup #3[[0, 6], [3, 4], [5, 4]][[0, 6], [3, 4]]Failed
regression tile lookup #4[[3, 1], [0, 3], [2, 0]][[3, 1], [0, 3]]Failed
diagonal within radius #1[[0, 0]][[0, 0]]Passed
control #1[[1, 1]][[1, 1]]Passed
control #2[[0, 0]][[0, 0]]Passed
control #3[[1, 0]][[1, 0]]Passed

SHA-256 / 6e611707503ec27f6eb48e759b275eaa3b374f2687b3eb409e948d56751f146e

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

Case digest / 20ca5950a419b66e8792ccc015c911dbdb646ec47f596d20cf6021fe5bbe541a