FAILURE MAP
← Case archive

FA-83266 / Go territory scoring / Open access

Equidistant black and white stones give the point to one side · case 01

Boundary points are assigned by scan order.

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

ROOT CAUSE

Tied distances do not add the second colour.

VERIFIED REPAIR

Collect all colours at the best distance; ties are neutral.

Unsuccessful approach: Replacing the colour on ties hands the point to the last scanned stone.

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 = abs(i - r) + abs(j - c)
                if d > reach:
                    continue
                if best is None or d < best:
                    best = d
                    near = {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]], [[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]]], [[[['B.W', '...', 'W.B'], 4], [0, 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]], [[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]]], [[[['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]], [[['.WBBB', 'B.BBB', 'WB...', 'BBBWW'], 1], [1, 0]]], [[[['..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]], [[['.B.B', 'WBW.', 'B.BB', '....', '.W.B'], 2], [4, 2]]], [[[['B.....', '...B.W', '....B.', 'BB.BWB'], 3], [11, 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[7, 5][4, 5]Failed
estimate case 1[5, 4][5, 3]Failed
estimate case 2[4, 0][4, 0]Passed
estimate case 3[0, 1][0, 1]Passed
estimate case 4[3, 2][0, 0]Failed
estimate case 5[4, 4][4, 4]Passed
estimate case 6[0, 3][0, 3]Passed
estimate case 7[12, 12][10, 11]Failed

SHA-256 / 52b1d373bb6ff1ea4f0fdbd731dd4113dcb3e87c86fb83f12e44957166599c60

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) + abs(j - c)
                if d > reach:
                    continue
                if best is None or d < best:
                    best = d
                    near = {col}
                elif d == best:
                    near = {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]], [[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]]], [[[['B.W', '...', 'W.B'], 4], [0, 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]], [[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]]], [[[['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]], [[['.WBBB', 'B.BBB', 'WB...', 'BBBWW'], 1], [1, 0]]], [[[['..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]], [[['.B.B', 'WBW.', 'B.BB', '....', '.W.B'], 2], [4, 2]]], [[[['B.....', '...B.W', '....B.', 'BB.BWB'], 3], [11, 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, 7][4, 5]Failed
estimate case 1[5, 4][5, 3]Failed
estimate case 2[4, 0][4, 0]Passed
estimate case 3[0, 1][0, 1]Passed
estimate case 4[3, 2][0, 0]Failed
estimate case 5[4, 4][4, 4]Passed
estimate case 6[0, 3][0, 3]Passed
estimate case 7[11, 13][10, 11]Failed

SHA-256 / 39e847307c5e202f6da221e1ee9b77a90f8f8769ff437d34bdc733ef24e49fc1

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]], [[['W.W...', 'W...B.', 'BB....', 'W.....', 'W.....', 'WWWW..'], 4], [10, 11]]], [[[['B.W', '...', 'W.B'], 4], [0, 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]], [[['....B.', '.....B', 'B.W.B.', '.B.BBW'], 2], [6, 1]]], [[[['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]], [[['.WBBB', 'B.BBB', 'WB...', 'BBBWW'], 1], [1, 0]]], [[[['..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]], [[['.B.B', 'WBW.', 'B.BB', '....', '.W.B'], 2], [4, 2]]], [[[['B.....', '...B.W', '....B.', 'BB.BWB'], 3], [11, 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[10, 11][10, 11]Passed

SHA-256 / 8d79bcb91d6f12233258cac4ccaee23bc6055055f9c1e579792aa809d2269f76

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

Case digest / cd765a9f8fb7a3d3fdbea517e0f1f12ffb888152907060c720f59885a33b25e8