FAILURE MAP
← Case archive

FA-83271 / Go territory scoring / Open access

Diagonal stones count as distance one · case 01

Estimated territory extends diagonally past the intended shape.

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

ROOT CAUSE

Distance uses Chebyshev max instead of Manhattan sum.

VERIFIED REPAIR

Use |dr| + |dc|.

Unsuccessful approach: Taking abs of the signed sum cancels opposite offsets.

Case contract

Input [board, reach]. Each empty point belongs to the colour of the strictly nearest stones by Manhattan distance, provided that distance <= reach; ties between colours or no stone in reach leave it neutral. Return [black_points, white_points].

Why this case matters

Go servers and scoring tools compute this value automatically; a wrong answer changes a game result.

1 / The failure

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

N = 1
observations = []
def solve(x):
    board, reach = x
    n = len(board)
    m = len(board[0])
    stones = [(i, j, board[i][j]) for i in range(n) for j in range(m) if board[i][j] != '.']
    own = {'B': 0, 'W': 0}
    for r in range(n):
        for c in range(m):
            if board[r][c] != '.':
                continue
            best = None
            near = set()
            for i, j, col in stones:
                d = max(abs(i - r), abs(j - c))
                if d > reach:
                    continue
                if best is None or d < best:
                    best = d
                    near = {col}
                elif d == best:
                    near.add(col)
            if len(near) == 1:
                own[near.pop()] += 1
    return [own['B'], own['W']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['B.B.W', '.B.W.', 'B.BW.', 'BBW.W', '..W..'], 3], [4, 5]], [[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 1], [5, 3]], [[['BBBB', 'B..B', 'B..B', 'BBBB'], 2], [4, 0]], [[['WWW', 'W.W', 'WWW'], 3], [0, 1]], [[['B.W', '...', 'W.B'], 4], [0, 0]], [[['.B...', 'B....', '.....', '....W', '...W.'], 1], [4, 4]], [[['BW.', 'BW.', 'BW.'], 2], [0, 3]], [[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 3], [17, 0]]], [[[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 3], [17, 0]], [[['WB.B', 'B.B.', '.B..', 'B...'], 4], [9, 0]], [[['..W', '.W.', 'W..'], 1], [0, 4]], [[['B....B', '......', '..WW..', '..WW..', '......', 'B....B'], 2], [8, 8]], [[['......', '..WW..', '.....B', '.....B'], 3], [4, 14]], [[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]], [[['..W.', 'B.WW', 'WBWB', 'WWW.', 'WBBW', '.WWB'], 1], [1, 3]], [[['W.WWWW', 'WBWWBW', '..WBWW', 'BW...W'], 2], [1, 2]]], [[[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]], [[['..BBW', 'BB.B.', 'B.BWB', 'W.WWB', 'W.WBW', '.BBB.'], 3], [4, 1]], [[['W.W.', 'WW.W', '..WB', 'WWBW'], 4], [0, 5]], [[['BW..', 'BBBW', 'W...', '.W..', '..W.', '..BW'], 1], [2, 6]], [[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]], [[['B.....', '...B.W', '....B.', 'BB.BWB'], 3], [11, 1]], [[['W..WW.', '.W....', 'WW.B..', '....W.', '..W..B'], 4], [0, 13]], [[['..WWW', '...BB', '.W...', '.BW..'], 1], [3, 5]]], [[[['..BBW', 'BB.B.', 'B.BWB', 'W.WWB', 'W.WBW', '.BBB.'], 3], [4, 1]], [[['BWWBBW', 'BBWWBB', '.WW.BW', 'WW.WWB'], 2], [0, 1]], [[['BBWW', 'WBBW', 'WBBW', '..BB'], 3], [1, 1]], [[['....BB', 'B.....', 'B.....', 'B.BB..', '...B.B'], 4], [21, 0]], [[['.WBBB', 'B.BBB', 'WB...', 'BBBWW'], 1], [1, 0]], [[['WWWWWW', '.WB.B.', '.WBBB.', '.B.W.B', 'WBBW..'], 2], [2, 3]], [[['.W.B', '...W', '....', '..BB', 'B..B'], 3], [6, 4]], [[['WW..B', '..W..', '....W', 'WWW.B', 'B...W', 'WB.WB'], 4], [1, 10]]], [[[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]], [[['WWWW.B', '.WW.B.', 'W.WWBW', 'W...BW', 'B.WBBW', '..BW..'], 1], [2, 5]], [[['.B.B', 'WBW.', 'B.BB', '....', '.W.B'], 2], [4, 2]], [[['....B', '....B', 'B...W', '..B..', '...WW'], 3], [13, 2]], [[['WBB..', 'WWW.W', 'BW..W', 'W.B.B', 'W.WW.'], 4], [1, 4]], [[['WW.B.', '.W.B.', '....B', '...W.', '.W..W', 'BWBWW'], 1], [2, 5]], [[['.W.B.', '...W.', 'WW...', 'BB...'], 2], [2, 8]], [[['..W.', 'WBW.', '...W', 'B...', '.WW.', '....'], 3], [1, 10]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("estimate case %d" % i, 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
estimate case 0[3, 4][4, 5]Failed
estimate case 1[5, 1][5, 3]Failed
estimate case 2[4, 0][4, 0]Passed
estimate case 3[0, 1][0, 1]Passed
estimate case 4[0, 0][0, 0]Passed
estimate case 5[6, 6][4, 4]Failed
estimate case 6[0, 3][0, 3]Passed
estimate case 7[17, 0][17, 0]Passed

SHA-256 / 91147dc8be2711889fe435b4d95b85faba07480f70731e9de6a2a614c14ff225

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    board, reach = x
    n = len(board)
    m = len(board[0])
    stones = [(i, j, board[i][j]) for i in range(n) for j in range(m) if board[i][j] != '.']
    own = {'B': 0, 'W': 0}
    for r in range(n):
        for c in range(m):
            if board[r][c] != '.':
                continue
            best = None
            near = set()
            for i, j, col in stones:
                d = abs(i - r + j - c)
                if d > reach:
                    continue
                if best is None or d < best:
                    best = d
                    near = {col}
                elif d == best:
                    near.add(col)
            if len(near) == 1:
                own[near.pop()] += 1
    return [own['B'], own['W']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['B.B.W', '.B.W.', 'B.BW.', 'BBW.W', '..W..'], 3], [4, 5]], [[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 1], [5, 3]], [[['BBBB', 'B..B', 'B..B', 'BBBB'], 2], [4, 0]], [[['WWW', 'W.W', 'WWW'], 3], [0, 1]], [[['B.W', '...', 'W.B'], 4], [0, 0]], [[['.B...', 'B....', '.....', '....W', '...W.'], 1], [4, 4]], [[['BW.', 'BW.', 'BW.'], 2], [0, 3]], [[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 3], [17, 0]]], [[[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 3], [17, 0]], [[['WB.B', 'B.B.', '.B..', 'B...'], 4], [9, 0]], [[['..W', '.W.', 'W..'], 1], [0, 4]], [[['B....B', '......', '..WW..', '..WW..', '......', 'B....B'], 2], [8, 8]], [[['......', '..WW..', '.....B', '.....B'], 3], [4, 14]], [[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]], [[['..W.', 'B.WW', 'WBWB', 'WWW.', 'WBBW', '.WWB'], 1], [1, 3]], [[['W.WWWW', 'WBWWBW', '..WBWW', 'BW...W'], 2], [1, 2]]], [[[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]], [[['..BBW', 'BB.B.', 'B.BWB', 'W.WWB', 'W.WBW', '.BBB.'], 3], [4, 1]], [[['W.W.', 'WW.W', '..WB', 'WWBW'], 4], [0, 5]], [[['BW..', 'BBBW', 'W...', '.W..', '..W.', '..BW'], 1], [2, 6]], [[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]], [[['B.....', '...B.W', '....B.', 'BB.BWB'], 3], [11, 1]], [[['W..WW.', '.W....', 'WW.B..', '....W.', '..W..B'], 4], [0, 13]], [[['..WWW', '...BB', '.W...', '.BW..'], 1], [3, 5]]], [[[['..BBW', 'BB.B.', 'B.BWB', 'W.WWB', 'W.WBW', '.BBB.'], 3], [4, 1]], [[['BWWBBW', 'BBWWBB', '.WW.BW', 'WW.WWB'], 2], [0, 1]], [[['BBWW', 'WBBW', 'WBBW', '..BB'], 3], [1, 1]], [[['....BB', 'B.....', 'B.....', 'B.BB..', '...B.B'], 4], [21, 0]], [[['.WBBB', 'B.BBB', 'WB...', 'BBBWW'], 1], [1, 0]], [[['WWWWWW', '.WB.B.', '.WBBB.', '.B.W.B', 'WBBW..'], 2], [2, 3]], [[['.W.B', '...W', '....', '..BB', 'B..B'], 3], [6, 4]], [[['WW..B', '..W..', '....W', 'WWW.B', 'B...W', 'WB.WB'], 4], [1, 10]]], [[[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]], [[['WWWW.B', '.WW.B.', 'W.WWBW', 'W...BW', 'B.WBBW', '..BW..'], 1], [2, 5]], [[['.B.B', 'WBW.', 'B.BB', '....', '.W.B'], 2], [4, 2]], [[['....B', '....B', 'B...W', '..B..', '...WW'], 3], [13, 2]], [[['WBB..', 'WWW.W', 'BW..W', 'W.B.B', 'W.WW.'], 4], [1, 4]], [[['WW.B.', '.W.B.', '....B', '...W.', '.W..W', 'BWBWW'], 1], [2, 5]], [[['.W.B.', '...W.', 'WW...', 'BB...'], 2], [2, 8]], [[['..W.', 'WBW.', '...W', 'B...', '.WW.', '....'], 3], [1, 10]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("estimate case %d" % i, 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
estimate case 0[5, 6][4, 5]Failed
estimate case 1[5, 1][5, 3]Failed
estimate case 2[4, 0][4, 0]Passed
estimate case 3[0, 1][0, 1]Passed
estimate case 4[0, 1][0, 0]Failed
estimate case 5[4, 4][4, 4]Passed
estimate case 6[0, 2][0, 3]Failed
estimate case 7[17, 0][17, 0]Passed

SHA-256 / c23f7e6da9da4a0712b496532b0c2820d65ed9ca18202a33c03baa6785dc80bf

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    board, reach = x
    n = len(board)
    m = len(board[0])
    stones = [(i, j, board[i][j]) for i in range(n) for j in range(m) if board[i][j] != '.']
    own = {'B': 0, 'W': 0}
    for r in range(n):
        for c in range(m):
            if board[r][c] != '.':
                continue
            best = None
            near = set()
            for i, j, col in stones:
                d = abs(i - r) + abs(j - c)
                if d > reach:
                    continue
                if best is None or d < best:
                    best = d
                    near = {col}
                elif d == best:
                    near.add(col)
            if len(near) == 1:
                own[near.pop()] += 1
    return [own['B'], own['W']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['B.B.W', '.B.W.', 'B.BW.', 'BBW.W', '..W..'], 3], [4, 5]], [[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 1], [5, 3]], [[['BBBB', 'B..B', 'B..B', 'BBBB'], 2], [4, 0]], [[['WWW', 'W.W', 'WWW'], 3], [0, 1]], [[['B.W', '...', 'W.B'], 4], [0, 0]], [[['.B...', 'B....', '.....', '....W', '...W.'], 1], [4, 4]], [[['BW.', 'BW.', 'BW.'], 2], [0, 3]], [[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 3], [17, 0]]], [[[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 3], [17, 0]], [[['WB.B', 'B.B.', '.B..', 'B...'], 4], [9, 0]], [[['..W', '.W.', 'W..'], 1], [0, 4]], [[['B....B', '......', '..WW..', '..WW..', '......', 'B....B'], 2], [8, 8]], [[['......', '..WW..', '.....B', '.....B'], 3], [4, 14]], [[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]], [[['..W.', 'B.WW', 'WBWB', 'WWW.', 'WBBW', '.WWB'], 1], [1, 3]], [[['W.WWWW', 'WBWWBW', '..WBWW', 'BW...W'], 2], [1, 2]]], [[[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]], [[['..BBW', 'BB.B.', 'B.BWB', 'W.WWB', 'W.WBW', '.BBB.'], 3], [4, 1]], [[['W.W.', 'WW.W', '..WB', 'WWBW'], 4], [0, 5]], [[['BW..', 'BBBW', 'W...', '.W..', '..W.', '..BW'], 1], [2, 6]], [[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]], [[['B.....', '...B.W', '....B.', 'BB.BWB'], 3], [11, 1]], [[['W..WW.', '.W....', 'WW.B..', '....W.', '..W..B'], 4], [0, 13]], [[['..WWW', '...BB', '.W...', '.BW..'], 1], [3, 5]]], [[[['..BBW', 'BB.B.', 'B.BWB', 'W.WWB', 'W.WBW', '.BBB.'], 3], [4, 1]], [[['BWWBBW', 'BBWWBB', '.WW.BW', 'WW.WWB'], 2], [0, 1]], [[['BBWW', 'WBBW', 'WBBW', '..BB'], 3], [1, 1]], [[['....BB', 'B.....', 'B.....', 'B.BB..', '...B.B'], 4], [21, 0]], [[['.WBBB', 'B.BBB', 'WB...', 'BBBWW'], 1], [1, 0]], [[['WWWWWW', '.WB.B.', '.WBBB.', '.B.W.B', 'WBBW..'], 2], [2, 3]], [[['.W.B', '...W', '....', '..BB', 'B..B'], 3], [6, 4]], [[['WW..B', '..W..', '....W', 'WWW.B', 'B...W', 'WB.WB'], 4], [1, 10]]], [[[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]], [[['WWWW.B', '.WW.B.', 'W.WWBW', 'W...BW', 'B.WBBW', '..BW..'], 1], [2, 5]], [[['.B.B', 'WBW.', 'B.BB', '....', '.W.B'], 2], [4, 2]], [[['....B', '....B', 'B...W', '..B..', '...WW'], 3], [13, 2]], [[['WBB..', 'WWW.W', 'BW..W', 'W.B.B', 'W.WW.'], 4], [1, 4]], [[['WW.B.', '.W.B.', '....B', '...W.', '.W..W', 'BWBWW'], 1], [2, 5]], [[['.W.B.', '...W.', 'WW...', 'BB...'], 2], [2, 8]], [[['..W.', 'WBW.', '...W', 'B...', '.WW.', '....'], 3], [1, 10]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("estimate case %d" % i, 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
estimate case 0[4, 5][4, 5]Passed
estimate case 1[5, 3][5, 3]Passed
estimate case 2[4, 0][4, 0]Passed
estimate case 3[0, 1][0, 1]Passed
estimate case 4[0, 0][0, 0]Passed
estimate case 5[4, 4][4, 4]Passed
estimate case 6[0, 3][0, 3]Passed
estimate case 7[17, 0][17, 0]Passed

SHA-256 / 0154ef24310b0b701192a352a3b5b332e5e073660fd2ac5d2ad346350bf632cf

Verification & scope

Small rectangular toy boards given as strings of B, W and dot; a bounded teaching model of one scoring or bookkeeping rule, not a complete rules engine or server implementation. 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:20.010015+00:00.

Case digest / 916edc87b9f76b4a27c18d3d20b621522e8ddc32d915b8dd6d778863ad3addd7