FA-86721 / Procedural level generation constraints / Open access
Heightmap smoothing and biome classes: Left edge wraps to the right edge · case 01
The first column is smoothed with values from the opposite side.
ROOT CAUSE
The column window is not clamped at zero, so index -1 wraps.
THE FAILURE
The column window is not clamped at zero, so index -1 wraps.
Unsuccessful approach: Clamping at one excludes column zero from windows.
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(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 = [[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
('regression column window start #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',
[[[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 column window start #3', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg']),
('control #1', [[[0, 9], [7, 2]], 2, 11], ['gg', 'gg']),
('control #2', [[[9, 5, 6], [9, 0, 4]], 6, 10], ['~~~', '~~~'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1',
[[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
['ggggg', 'ggggg', '^^ggs']),
('regression column window start #2', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg']),
('regression column window start #3', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
('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', '~~~~~', '~~~~~', '~~~~~']),
('control #1', [[[10, 11], [1, 0]], 3, 9], ['gg', 'gg']),
('control #2', [[[9, 7]], 2, 6], ['^^'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #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 column window start #2',
[[[0, 3], [6, 9], [0, 3], [3, 12], [7, 10]], 5, 6],
['~~', '~~', 'ss', 'ss', '^^']),
('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 column window start #3', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg']),
('control #1',
[[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
['~~~~', '~~~s', '~~~s', '~~~s']),
('control #2', [[[7, 8], [6, 2], [5, 5], [4, 11]], 2, 11], ['gg', 'gg', 'gg', 'gg'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1', [[[11, 0, 4, 12]], 2, 7], ['ggg^']),
('regression column window start #2',
[[[4, 5, 6, 9, 9], [8, 11, 8, 5, 5], [10, 12, 11, 0, 3]], 6, 11],
['sssss', 'ggss~', 'ggs~~']),
('regression column window start #3',
[[[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~~~']),
('partial repair boundary #1', [[[1, 2, 10]], 6, 9], ['~~s']),
('control #1', [[[7, 6], [5, 12], [1, 6], [10, 10], [8, 3]], 3, 6], ['^^', '^^', '^^', '^^', '^^']),
('control #2', [[[5, 3, 0, 8]], 6, 7], ['~~~~'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1', [[[0, 3, 3], [0, 1, 5], [4, 0, 5]], 2, 6], ['~ss', '~ss', '~ss']),
('regression column window start #2',
[[[12, 10, 4, 10], [2, 0, 12, 2], [9, 12, 4, 8], [3, 9, 11, 3], [12, 5, 11, 6]], 5, 10],
['sssg', 'ggss', 'ssss', 'gggg', 'gggg']),
('partial repair boundary #1', [[[0, 1], [3, 5], [10, 1]], 3, 10], ['~~', 'ss', 'ss']),
('partial repair boundary #2',
[[[1, 2, 0, 4], [12, 1, 9, 7], [9, 3, 6, 5]], 2, 11],
['ggsg', 'gggg', 'gggg']),
('control #1', [[[5, 9, 0, 8, 5], [12, 12, 0, 1, 8]], 2, 11], ['gggsg', 'gggsg']),
('control #2',
[[[6, 10, 8, 0], [6, 10, 7, 12], [10, 7, 5, 3], [4, 11, 0, 1], [1, 2, 7, 12]], 2, 7],
['^^^g', '^^gg', '^ggg', 'gggg', 'gggg'])]]
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 |
|---|---|---|---|
| single row #1 | ['ss^'] | ['^s^'] | Failed |
| corner cell average #1 | ['gg', 'gg'] | ['gg', 'gg'] | Passed |
| regression column window start #1 | ['s^ss~', 's^ss~'] | ['^^ss~', '^^ss~'] | Failed |
| regression column window start #2 | ['ggggg', 'ggggg', 'g^ggs'] | ['ggggg', 'ggggg', '^^ggs'] | Failed |
| partial repair boundary #1 | ['~~sss', '~~sss', '~~~~~', '~~~~~', '~~~~~'] | ['~~sss', '~~sss', '~~~~~', '~~~~~', '~~~~~'] | Passed |
| regression column window start #3 | ['gg', 'gg', 'sg'] | ['gg', 'gg', 'gg'] | Failed |
| control #1 | ['gg', 'gg'] | ['gg', 'gg'] | Passed |
| control #2 | ['~~~', '~~~'] | ['~~~', '~~~'] | Passed |
SHA-256 / 4cc54ad8107e077d6b9ac0515fb999350a967fbff2f0612c57965448611c4f21
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(1, 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 = [[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
('regression column window start #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',
[[[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 column window start #3', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg']),
('control #1', [[[0, 9], [7, 2]], 2, 11], ['gg', 'gg']),
('control #2', [[[9, 5, 6], [9, 0, 4]], 6, 10], ['~~~', '~~~'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1',
[[[5, 4, 2, 6, 4], [12, 10, 8, 2, 4], [4, 10, 11, 2, 6]], 2, 8],
['ggggg', 'ggggg', '^^ggs']),
('regression column window start #2', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg']),
('regression column window start #3', [[[10, 11, 6, 11, 0], [9, 0, 9, 4, 4]], 5, 7], ['^^ss~', '^^ss~']),
('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', '~~~~~', '~~~~~', '~~~~~']),
('control #1', [[[10, 11], [1, 0]], 3, 9], ['gg', 'gg']),
('control #2', [[[9, 7]], 2, 6], ['^^'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #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 column window start #2',
[[[0, 3], [6, 9], [0, 3], [3, 12], [7, 10]], 5, 6],
['~~', '~~', 'ss', 'ss', '^^']),
('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 column window start #3', [[[5, 5], [10, 3], [7, 0]], 2, 10], ['gg', 'gg', 'gg']),
('control #1',
[[[4, 3, 3, 1], [4, 1, 10, 9], [2, 2, 10, 5], [0, 0, 7, 2]], 6, 8],
['~~~~', '~~~s', '~~~s', '~~~s']),
('control #2', [[[7, 8], [6, 2], [5, 5], [4, 11]], 2, 11], ['gg', 'gg', 'gg', 'gg'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1', [[[11, 0, 4, 12]], 2, 7], ['ggg^']),
('regression column window start #2',
[[[4, 5, 6, 9, 9], [8, 11, 8, 5, 5], [10, 12, 11, 0, 3]], 6, 11],
['sssss', 'ggss~', 'ggs~~']),
('regression column window start #3',
[[[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~~~']),
('partial repair boundary #1', [[[1, 2, 10]], 6, 9], ['~~s']),
('control #1', [[[7, 6], [5, 12], [1, 6], [10, 10], [8, 3]], 3, 6], ['^^', '^^', '^^', '^^', '^^']),
('control #2', [[[5, 3, 0, 8]], 6, 7], ['~~~~'])],
[('single row #1', [[[0, 12, 0]], 3, 6], ['^s^']),
('corner cell average #1', [[[9, 9], [9, 0]], 3, 8], ['gg', 'gg']),
('regression column window start #1', [[[0, 3, 3], [0, 1, 5], [4, 0, 5]], 2, 6], ['~ss', '~ss', '~ss']),
('regression column window start #2',
[[[12, 10, 4, 10], [2, 0, 12, 2], [9, 12, 4, 8], [3, 9, 11, 3], [12, 5, 11, 6]], 5, 10],
['sssg', 'ggss', 'ssss', 'gggg', 'gggg']),
('partial repair boundary #1', [[[0, 1], [3, 5], [10, 1]], 3, 10], ['~~', 'ss', 'ss']),
('partial repair boundary #2',
[[[1, 2, 0, 4], [12, 1, 9, 7], [9, 3, 6, 5]], 2, 11],
['ggsg', 'gggg', 'gggg']),
('control #1', [[[5, 9, 0, 8, 5], [12, 12, 0, 1, 8]], 2, 11], ['gggsg', 'gggsg']),
('control #2',
[[[6, 10, 8, 0], [6, 10, 7, 12], [10, 7, 5, 3], [4, 11, 0, 1], [1, 2, 7, 12]], 2, 7],
['^^^g', '^^gg', '^ggg', 'gggg', 'gggg'])]]
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 |
|---|---|---|---|
| single row #1 | ['^^^'] | ['^s^'] | Failed |
| corner cell average #1 | ['ss', 'ss'] | ['gg', 'gg'] | Failed |
| regression column window start #1 | ['ssss~', 'ssss~'] | ['^^ss~', '^^ss~'] | Failed |
| regression column window start #2 | ['ggggg', '^gggg', '^^ggs'] | ['ggggg', 'ggggg', '^^ggs'] | Failed |
| partial repair boundary #1 | ['~~sss', '~ssss', '~~~~~', 'ss~~~', 's~~~~'] | ['~~sss', '~~sss', '~~~~~', '~~~~~', '~~~~~'] | Failed |
| regression column window start #3 | ['gg', 'ss', '~~'] | ['gg', 'gg', 'gg'] | Failed |
| control #1 | ['gg', 'gg'] | ['gg', 'gg'] | Passed |
| control #2 | ['~~~', '~~~'] | ['~~~', '~~~'] | Passed |
SHA-256 / d33fbeddc60ead5305741d0d720442360bfcbed3558577a69079d63be8476616
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.169921+00:00.
Case digest / 237e44f64e117c21cc9e008c6c31caf88f13ca7def05b75bd9f5f0865162f443