FAILURE MAP
← Case archive

FA-86726 / Procedural level generation constraints / Open access

Heightmap smoothing and biome classes: Beach band too wide · case 01

Grassland at sea+2 is classed as beach.

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

ROOT CAUSE

The beach comparison is inclusive.

VERIFIED REPAIR

Restore `elif v < sea + 2:` at the beach band step.

Unsuccessful approach: A one-level band is narrower than specified.

Case contract

Each cell height becomes floor(mean) of the in-bounds cells in its 3x3 window (input values only). Class: '~' when v < sea, 's' beach when v < sea+2, 'g' when v < mountain, otherwise '^'. Returns strings per row.

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(heights, sea, mountain):
    h = len(heights)
    w = len(heights[0])
    out = []
    for r in range(h):
        row = []
        for c in range(w):
            total = 0
            cnt = 0
            for rr in range(max(0, r - 1), min(h, r + 2)):
                for cc in range(max(0, c - 1), min(w, c + 2)):
                    total += heights[rr][cc]
                    cnt += 1
            v = total // cnt
            if v < sea:
                row.append('~')
            elif v <= sea + 2:
                row.append('s')
            elif v < mountain:
                row.append('g')
            else:
                row.append('^')
        out.append(''.join(row))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('fault site beach band #1', [[[0, 9], [7, 2]], 2, 11], ['gg', 'gg']),
  ('regression beach band #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
  ('regression beach band #2',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('partial repair boundary #1', [[[6], [4], [8], [4], [8]], 5, 9], ['s', 's', 's', 's', 's']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[3], [4], [0]], 4, 10], ['~', '~', '~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
  ('fault site beach band #1', [[[9], [8]], 6, 6], ['^', '^']),
  ('regression beach band #2',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('partial repair boundary #1', [[[6], [4], [8], [4], [8]], 5, 9], ['s', 's', 's', 's', 's']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[3], [4], [0]], 4, 10], ['~', '~', '~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('fault site beach band #1', [[[10, 11], [1, 0]], 3, 9], ['gg', 'gg']),
  ('partial repair boundary #1',
   [[[8, 6, 12, 10, 8], [6, 1, 1, 7, 5], [1, 6, 12, 6, 0], [3, 8, 3, 6, 0], [1, 7, 3, 2, 0]], 6, 9],
   ['~~sss', '~~sss', '~~~~~', '~~~~~', '~~~~~']),
  ('regression beach band #2',
   [[[2, 9, 4, 10, 11], [7, 7, 11, 1, 10], [11, 5, 12, 1, 12], [9, 4, 1, 0, 2]], 6, 8],
   ['ssss^', 'sss^s', 'ss~~~', 'ss~~~']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[9, 5, 6], [9, 0, 4]], 6, 10], ['~~~', '~~~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[2, 9, 4, 10, 11], [7, 7, 11, 1, 10], [11, 5, 12, 1, 12], [9, 4, 1, 0, 2]], 6, 8],
   ['ssss^', 'sss^s', 'ss~~~', 'ss~~~']),
  ('regression beach band #2',
   [[[1, 2, 0, 4], [12, 1, 9, 7], [9, 3, 6, 5]], 2, 11],
   ['ggsg', 'gggg', 'gggg']),
  ('partial repair boundary #1', [[[0, 1], [3, 5], [10, 1]], 3, 10], ['~~', 'ss', 'ss']),
  ('partial repair boundary #2',
   [[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
   ['~~~~', '~~~s', '~~~s', '~~~s']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[10, 1, 2, 12, 9], [8, 10, 5, 4, 8], [4, 3, 4, 4, 8], [2, 5, 12, 8, 7]], 5, 7],
   ['^sss^', 'ssss^', 'sssss', '~ss^s']),
  ('regression beach band #2',
   [[[4, 5, 6, 9, 9], [8, 11, 8, 5, 5], [10, 12, 11, 0, 3]], 6, 11],
   ['sssss', 'ggss~', 'ggs~~']),
  ('partial repair boundary #1',
   [[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
   ['~~~~', '~~~s', '~~~s', '~~~s']),
  ('partial repair boundary #2', [[[5, 9, 0, 8, 5], [12, 12, 0, 1, 8]], 2, 11], ['gggsg', 'gggsg']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[9, 7]], 2, 6], ['^^'])]]
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
beach band edge #1['s']['g']Failed
single row #1['^s^']['^s^']Passed
fault site beach band #1['ss', 'ss']['gg', 'gg']Failed
regression beach band #1['ssss~', 'ssss~']['^^ss~', '^^ss~']Failed
regression beach band #2['gggss', 'ggggs', '^^ggs']['ggggg', 'ggggg', '^^ggs']Failed
partial repair boundary #1['s', 's', 's', 's', 's']['s', 's', 's', 's', 's']Passed
corner cell average #1['gg', 'gg']['gg', 'gg']Passed
control #1['~', '~', '~']['~', '~', '~']Passed

SHA-256 / 8b8e2643d177b4a8b9cf67991f074dd4627894016095a65263b18175033069e7

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(heights, sea, mountain):
    h = len(heights)
    w = len(heights[0])
    out = []
    for r in range(h):
        row = []
        for c in range(w):
            total = 0
            cnt = 0
            for rr in range(max(0, r - 1), min(h, r + 2)):
                for cc in range(max(0, c - 1), min(w, c + 2)):
                    total += heights[rr][cc]
                    cnt += 1
            v = total // cnt
            if v < sea:
                row.append('~')
            elif v < sea + 1:
                row.append('s')
            elif v < mountain:
                row.append('g')
            else:
                row.append('^')
        out.append(''.join(row))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('fault site beach band #1', [[[0, 9], [7, 2]], 2, 11], ['gg', 'gg']),
  ('regression beach band #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
  ('regression beach band #2',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('partial repair boundary #1', [[[6], [4], [8], [4], [8]], 5, 9], ['s', 's', 's', 's', 's']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[3], [4], [0]], 4, 10], ['~', '~', '~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
  ('fault site beach band #1', [[[9], [8]], 6, 6], ['^', '^']),
  ('regression beach band #2',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('partial repair boundary #1', [[[6], [4], [8], [4], [8]], 5, 9], ['s', 's', 's', 's', 's']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[3], [4], [0]], 4, 10], ['~', '~', '~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('fault site beach band #1', [[[10, 11], [1, 0]], 3, 9], ['gg', 'gg']),
  ('partial repair boundary #1',
   [[[8, 6, 12, 10, 8], [6, 1, 1, 7, 5], [1, 6, 12, 6, 0], [3, 8, 3, 6, 0], [1, 7, 3, 2, 0]], 6, 9],
   ['~~sss', '~~sss', '~~~~~', '~~~~~', '~~~~~']),
  ('regression beach band #2',
   [[[2, 9, 4, 10, 11], [7, 7, 11, 1, 10], [11, 5, 12, 1, 12], [9, 4, 1, 0, 2]], 6, 8],
   ['ssss^', 'sss^s', 'ss~~~', 'ss~~~']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[9, 5, 6], [9, 0, 4]], 6, 10], ['~~~', '~~~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[2, 9, 4, 10, 11], [7, 7, 11, 1, 10], [11, 5, 12, 1, 12], [9, 4, 1, 0, 2]], 6, 8],
   ['ssss^', 'sss^s', 'ss~~~', 'ss~~~']),
  ('regression beach band #2',
   [[[1, 2, 0, 4], [12, 1, 9, 7], [9, 3, 6, 5]], 2, 11],
   ['ggsg', 'gggg', 'gggg']),
  ('partial repair boundary #1', [[[0, 1], [3, 5], [10, 1]], 3, 10], ['~~', 'ss', 'ss']),
  ('partial repair boundary #2',
   [[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
   ['~~~~', '~~~s', '~~~s', '~~~s']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[10, 1, 2, 12, 9], [8, 10, 5, 4, 8], [4, 3, 4, 4, 8], [2, 5, 12, 8, 7]], 5, 7],
   ['^sss^', 'ssss^', 'sssss', '~ss^s']),
  ('regression beach band #2',
   [[[4, 5, 6, 9, 9], [8, 11, 8, 5, 5], [10, 12, 11, 0, 3]], 6, 11],
   ['sssss', 'ggss~', 'ggs~~']),
  ('partial repair boundary #1',
   [[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
   ['~~~~', '~~~s', '~~~s', '~~~s']),
  ('partial repair boundary #2', [[[5, 9, 0, 8, 5], [12, 12, 0, 1, 8]], 2, 11], ['gggsg', 'gggsg']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[9, 7]], 2, 6], ['^^'])]]
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
beach band edge #1['g']['g']Passed
single row #1['^g^']['^s^']Failed
fault site beach band #1['gg', 'gg']['gg', 'gg']Passed
regression beach band #1['^^gs~', '^^gs~']['^^ss~', '^^ss~']Failed
regression beach band #2['ggggg', 'ggggg', '^^ggg']['ggggg', 'ggggg', '^^ggs']Failed
partial repair boundary #1['s', 'g', 's', 'g', 'g']['s', 's', 's', 's', 's']Failed
corner cell average #1['gg', 'gg']['gg', 'gg']Passed
control #1['~', '~', '~']['~', '~', '~']Passed

SHA-256 / 2a6a777c082ca6bcebabbe257f7521f5100e4719aa8019067167767587a58c7b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(heights, sea, mountain):
    h = len(heights)
    w = len(heights[0])
    out = []
    for r in range(h):
        row = []
        for c in range(w):
            total = 0
            cnt = 0
            for rr in range(max(0, r - 1), min(h, r + 2)):
                for cc in range(max(0, c - 1), min(w, c + 2)):
                    total += heights[rr][cc]
                    cnt += 1
            v = total // cnt
            if v < sea:
                row.append('~')
            elif v < sea + 2:
                row.append('s')
            elif v < mountain:
                row.append('g')
            else:
                row.append('^')
        out.append(''.join(row))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('fault site beach band #1', [[[0, 9], [7, 2]], 2, 11], ['gg', 'gg']),
  ('regression beach band #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
  ('regression beach band #2',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('partial repair boundary #1', [[[6], [4], [8], [4], [8]], 5, 9], ['s', 's', 's', 's', 's']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[3], [4], [0]], 4, 10], ['~', '~', '~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
  ('fault site beach band #1', [[[9], [8]], 6, 6], ['^', '^']),
  ('regression beach band #2',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('partial repair boundary #1', [[[6], [4], [8], [4], [8]], 5, 9], ['s', 's', 's', 's', 's']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[3], [4], [0]], 4, 10], ['~', '~', '~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
   ['ggggg', 'ggggg', '^^ggs']),
  ('fault site beach band #1', [[[10, 11], [1, 0]], 3, 9], ['gg', 'gg']),
  ('partial repair boundary #1',
   [[[8, 6, 12, 10, 8], [6, 1, 1, 7, 5], [1, 6, 12, 6, 0], [3, 8, 3, 6, 0], [1, 7, 3, 2, 0]], 6, 9],
   ['~~sss', '~~sss', '~~~~~', '~~~~~', '~~~~~']),
  ('regression beach band #2',
   [[[2, 9, 4, 10, 11], [7, 7, 11, 1, 10], [11, 5, 12, 1, 12], [9, 4, 1, 0, 2]], 6, 8],
   ['ssss^', 'sss^s', 'ss~~~', 'ss~~~']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[9, 5, 6], [9, 0, 4]], 6, 10], ['~~~', '~~~'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[2, 9, 4, 10, 11], [7, 7, 11, 1, 10], [11, 5, 12, 1, 12], [9, 4, 1, 0, 2]], 6, 8],
   ['ssss^', 'sss^s', 'ss~~~', 'ss~~~']),
  ('regression beach band #2',
   [[[1, 2, 0, 4], [12, 1, 9, 7], [9, 3, 6, 5]], 2, 11],
   ['ggsg', 'gggg', 'gggg']),
  ('partial repair boundary #1', [[[0, 1], [3, 5], [10, 1]], 3, 10], ['~~', 'ss', 'ss']),
  ('partial repair boundary #2',
   [[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
   ['~~~~', '~~~s', '~~~s', '~~~s']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg'])],
 [('beach band edge #1', [[[5]], 3, 9], ['g']),
  ('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
  ('regression beach band #1',
   [[[10, 1, 2, 12, 9], [8, 10, 5, 4, 8], [4, 3, 4, 4, 8], [2, 5, 12, 8, 7]], 5, 7],
   ['^sss^', 'ssss^', 'sssss', '~ss^s']),
  ('regression beach band #2',
   [[[4, 5, 6, 9, 9], [8, 11, 8, 5, 5], [10, 12, 11, 0, 3]], 6, 11],
   ['sssss', 'ggss~', 'ggs~~']),
  ('partial repair boundary #1',
   [[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
   ['~~~~', '~~~s', '~~~s', '~~~s']),
  ('partial repair boundary #2', [[[5, 9, 0, 8, 5], [12, 12, 0, 1, 8]], 2, 11], ['gggsg', 'gggsg']),
  ('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
  ('control #1', [[[9, 7]], 2, 6], ['^^'])]]
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
beach band edge #1['g']['g']Passed
single row #1['^s^']['^s^']Passed
fault site beach band #1['gg', 'gg']['gg', 'gg']Passed
regression beach band #1['^^ss~', '^^ss~']['^^ss~', '^^ss~']Passed
regression beach band #2['ggggg', 'ggggg', '^^ggs']['ggggg', 'ggggg', '^^ggs']Passed
partial repair boundary #1['s', 's', 's', 's', 's']['s', 's', 's', 's', 's']Passed
corner cell average #1['gg', 'gg']['gg', 'gg']Passed
control #1['~', '~', '~']['~', '~', '~']Passed

SHA-256 / cdff5d91f0bafd572da9b2a8fd1d91bc85ce22645baca178fd979284143a23c1

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

Case digest / 9faaac1f0eafb68c89a6c8f5645626b45c99e1ce6b08da35a17927b347a7febf