FAILURE MAP
← Case archive

FA-83046 / Go territory scoring / Open access

Group tax charges one point per chain · case 01

Fragmented positions lose only half the intended penalty.

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

ROOT CAUSE

The tax multiplier is one instead of two.

VERIFIED REPAIR

Subtract two points per chain.

Unsuccessful approach: Exempting each colour first chain still undercharges by two points.

Case contract

Input [board, komi_tenths]. Each colour scores stones + empty regions bordered only by it, minus two points per orthogonally connected chain. Return [black, white, margin_tenths] with margin = 10*(black-white) - komi.

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, komi = x
    n = len(board)
    m = len(board[0])
    score = {'B': 0, 'W': 0}
    groups = {'B': 0, 'W': 0}
    seen = set()
    for r in range(n):
        for c in range(m):
            if (r, c) in seen:
                continue
            col = board[r][c]
            seen.add((r, c))
            stack = [(r, c)]
            size = 0
            touch = set()
            while stack:
                i, j = stack.pop()
                size += 1
                for p, q in ((i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)):
                    if 0 <= p < n and 0 <= q < m:
                        v = board[p][q]
                        if v == col and (p, q) not in seen:
                            seen.add((p, q))
                            stack.append((p, q))
                        elif v != col:
                            touch.add(v)
            if col == '.':
                if len(touch) == 1:
                    score[touch.pop()] += size
            else:
                score[col] += size
                groups[col] += 1
    b = score['B'] - groups['B']
    w = score['W'] - groups['W']
    return [b, w, b * 10 - w * 10 - komi]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['.B.', 'B.B', '.B.'], 65], [1, 0, -55]], [[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 75], [8, -2, 25]], [[['BBBB', 'B..B', 'B..B', 'BBBB'], 20], [14, 0, 120]], [[['WWW', 'W.W', 'WWW'], 0], [0, 7, -70]], [[['B.W', '...', 'W.B'], 5], [-2, -2, -5]], [[['.B...', 'B....', '.....', '....W', '...W.'], 65], [-1, -1, -65]], [[['BW.', 'BW.', 'BW.'], 75], [1, 4, -105]], [[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 20], [23, 0, 210]]], [[[['..B..', '..B..', 'BBBBB', 'WWWWW', '..W..'], 0], [13, 8, 50]], [[['BW.', 'BW.', 'BW.'], 75], [1, 4, -105]], [[['..W', '.W.', 'W..'], 5], [0, 3, -35]], [[['B....B', '......', '..WW..', '..WW..', '......', 'B....B'], 65], [-4, 2, -125]], [[['..WW', '.W..', 'B...'], 75], [-1, -1, -75]], [[['..WW', '.W.B', '.WWW', 'B..B'], 20], [-3, 2, -70]], [[['W..B', 'W...', '.W.W', '.W..', 'W.W.'], 0], [-1, 0, -10]], [[['.W...', 'W....', '.....', '....W', 'W....'], 5], [0, 17, -175]]], [[[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 75], [8, -2, 25]], [[['..WW', '.W..', 'B...'], 75], [-1, -1, -75]], [[['B..', 'B.W', '.W.'], 75], [0, -1, -65]], [[['W..BW.', '.W....', '......'], 20], [-1, -3, 0]], [[['BBBB', '....', '.W.B', 'BBB.', '.BBB', 'BB.B'], 0], [11, -1, 120]], [[['...', '.BW', '.B.', '...', 'B.B', 'BB.'], 5], [1, -1, 15]], [[['B.B', 'WWB', 'BWB', 'BWB', 'WBB'], 65], [3, 1, -45]], [[['B.WBB', 'W.B..', 'W.WWB', '.WB.B', '.WWWW', '..W.B'], 75], [-4, 7, -185]]], [[[['B.W', '...', 'W.B'], 5], [-2, -2, -5]], [[['B..', 'B.W', '.W.'], 75], [0, -1, -65]], [[['B.B...', '......', '..WWB.', '.WB.W.', 'WWB.B.'], 0], [-4, 0, -40]], [[['.WWBBB', 'WBWB.W', 'BBB.W.', 'BB..BB', 'BWB.B.', 'WWW.WW'], 5], [7, 1, 55]], [[['BBBB', 'B..B', 'W..B', '.WBB', 'WB..', '.B..'], 65], [11, -2, 65]], [[['WWWB.W', 'WB....', 'W.WB..', 'W.BB.W', 'BBW...', '.BB.WW'], 75], [2, 0, -55]], [[['BWB', 'W.W', 'WBW', 'BWB', '.W.', 'BWW'], 20], [-6, 1, -90]], [[['.BBW', '.WB.', 'W...', '....', '....'], 0], [1, -3, 40]]], [[[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 20], [23, 0, 210]], [[['B.WBB', 'W.B..', 'W.WWB', '.WB.B', '.WWWW', '..W.B'], 75], [-4, 7, -185]], [[['B..', 'B..', '.B.', '..B', '..B'], 65], [9, 0, 25]], [[['....W.', '...B.B', 'BBBB..', '..B.W.', '.B.B.W'], 75], [5, -3, 5]], [[['..B', '.BW', 'B.B'], 20], [0, -1, -10]], [[['.BB..B', '......', 'B.B.BB', '.BBB..', '.B....'], 0], [20, 0, 200]], [[['W..', '.B.', '.W.', '...'], 5], [-1, -2, 5]], [[['..WW', 'B.WW', 'WBBW', '.WBW', 'WWBW', 'B..W'], 65], [0, 7, -135]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("group tax 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
group tax case 0[5, 0, -15][1, 0, -55]Failed
group tax case 1[12, 3, 15][8, -2, 25]Failed
group tax case 2[15, 0, 130][14, 0, 120]Failed
group tax case 3[0, 8, -80][0, 7, -70]Failed
group tax case 4[0, 0, -5][-2, -2, -5]Failed
group tax case 5[1, 1, -65][-1, -1, -65]Failed
group tax case 6[2, 5, -105][1, 4, -105]Failed
group tax case 7[24, 0, 220][23, 0, 210]Failed

SHA-256 / 9381801b18571199089ac7bda3da003ed27869f12a65222cc9dab346efd9c887

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    board, komi = x
    n = len(board)
    m = len(board[0])
    score = {'B': 0, 'W': 0}
    groups = {'B': 0, 'W': 0}
    seen = set()
    for r in range(n):
        for c in range(m):
            if (r, c) in seen:
                continue
            col = board[r][c]
            seen.add((r, c))
            stack = [(r, c)]
            size = 0
            touch = set()
            while stack:
                i, j = stack.pop()
                size += 1
                for p, q in ((i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)):
                    if 0 <= p < n and 0 <= q < m:
                        v = board[p][q]
                        if v == col and (p, q) not in seen:
                            seen.add((p, q))
                            stack.append((p, q))
                        elif v != col:
                            touch.add(v)
            if col == '.':
                if len(touch) == 1:
                    score[touch.pop()] += size
            else:
                score[col] += size
                groups[col] += 1
    b = score['B'] - 2 * max(groups['B'] - 1, 0)
    w = score['W'] - 2 * max(groups['W'] - 1, 0)
    return [b, w, b * 10 - w * 10 - komi]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['.B.', 'B.B', '.B.'], 65], [1, 0, -55]], [[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 75], [8, -2, 25]], [[['BBBB', 'B..B', 'B..B', 'BBBB'], 20], [14, 0, 120]], [[['WWW', 'W.W', 'WWW'], 0], [0, 7, -70]], [[['B.W', '...', 'W.B'], 5], [-2, -2, -5]], [[['.B...', 'B....', '.....', '....W', '...W.'], 65], [-1, -1, -65]], [[['BW.', 'BW.', 'BW.'], 75], [1, 4, -105]], [[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 20], [23, 0, 210]]], [[[['..B..', '..B..', 'BBBBB', 'WWWWW', '..W..'], 0], [13, 8, 50]], [[['BW.', 'BW.', 'BW.'], 75], [1, 4, -105]], [[['..W', '.W.', 'W..'], 5], [0, 3, -35]], [[['B....B', '......', '..WW..', '..WW..', '......', 'B....B'], 65], [-4, 2, -125]], [[['..WW', '.W..', 'B...'], 75], [-1, -1, -75]], [[['..WW', '.W.B', '.WWW', 'B..B'], 20], [-3, 2, -70]], [[['W..B', 'W...', '.W.W', '.W..', 'W.W.'], 0], [-1, 0, -10]], [[['.W...', 'W....', '.....', '....W', 'W....'], 5], [0, 17, -175]]], [[[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 75], [8, -2, 25]], [[['..WW', '.W..', 'B...'], 75], [-1, -1, -75]], [[['B..', 'B.W', '.W.'], 75], [0, -1, -65]], [[['W..BW.', '.W....', '......'], 20], [-1, -3, 0]], [[['BBBB', '....', '.W.B', 'BBB.', '.BBB', 'BB.B'], 0], [11, -1, 120]], [[['...', '.BW', '.B.', '...', 'B.B', 'BB.'], 5], [1, -1, 15]], [[['B.B', 'WWB', 'BWB', 'BWB', 'WBB'], 65], [3, 1, -45]], [[['B.WBB', 'W.B..', 'W.WWB', '.WB.B', '.WWWW', '..W.B'], 75], [-4, 7, -185]]], [[[['B.W', '...', 'W.B'], 5], [-2, -2, -5]], [[['B..', 'B.W', '.W.'], 75], [0, -1, -65]], [[['B.B...', '......', '..WWB.', '.WB.W.', 'WWB.B.'], 0], [-4, 0, -40]], [[['.WWBBB', 'WBWB.W', 'BBB.W.', 'BB..BB', 'BWB.B.', 'WWW.WW'], 5], [7, 1, 55]], [[['BBBB', 'B..B', 'W..B', '.WBB', 'WB..', '.B..'], 65], [11, -2, 65]], [[['WWWB.W', 'WB....', 'W.WB..', 'W.BB.W', 'BBW...', '.BB.WW'], 75], [2, 0, -55]], [[['BWB', 'W.W', 'WBW', 'BWB', '.W.', 'BWW'], 20], [-6, 1, -90]], [[['.BBW', '.WB.', 'W...', '....', '....'], 0], [1, -3, 40]]], [[[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 20], [23, 0, 210]], [[['B.WBB', 'W.B..', 'W.WWB', '.WB.B', '.WWWW', '..W.B'], 75], [-4, 7, -185]], [[['B..', 'B..', '.B.', '..B', '..B'], 65], [9, 0, 25]], [[['....W.', '...B.B', 'BBBB..', '..B.W.', '.B.B.W'], 75], [5, -3, 5]], [[['..B', '.BW', 'B.B'], 20], [0, -1, -10]], [[['.BB..B', '......', 'B.B.BB', '.BBB..', '.B....'], 0], [20, 0, 200]], [[['W..', '.B.', '.W.', '...'], 5], [-1, -2, 5]], [[['..WW', 'B.WW', 'WBBW', '.WBW', 'WWBW', 'B..W'], 65], [0, 7, -135]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("group tax 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
group tax case 0[3, 0, -35][1, 0, -55]Failed
group tax case 1[10, 0, 25][8, -2, 25]Failed
group tax case 2[16, 0, 140][14, 0, 120]Failed
group tax case 3[0, 9, -90][0, 7, -70]Failed
group tax case 4[0, 0, -5][-2, -2, -5]Failed
group tax case 5[1, 1, -65][-1, -1, -65]Failed
group tax case 6[3, 6, -105][1, 4, -105]Failed
group tax case 7[25, 0, 230][23, 0, 210]Failed

SHA-256 / 6b42b0fb56a6eb9544fb8b6dcbf452e51b86a0dbdc2d2bd18022598265cec0f5

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    board, komi = x
    n = len(board)
    m = len(board[0])
    score = {'B': 0, 'W': 0}
    groups = {'B': 0, 'W': 0}
    seen = set()
    for r in range(n):
        for c in range(m):
            if (r, c) in seen:
                continue
            col = board[r][c]
            seen.add((r, c))
            stack = [(r, c)]
            size = 0
            touch = set()
            while stack:
                i, j = stack.pop()
                size += 1
                for p, q in ((i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)):
                    if 0 <= p < n and 0 <= q < m:
                        v = board[p][q]
                        if v == col and (p, q) not in seen:
                            seen.add((p, q))
                            stack.append((p, q))
                        elif v != col:
                            touch.add(v)
            if col == '.':
                if len(touch) == 1:
                    score[touch.pop()] += size
            else:
                score[col] += size
                groups[col] += 1
    b = score['B'] - 2 * groups['B']
    w = score['W'] - 2 * groups['W']
    return [b, w, b * 10 - w * 10 - komi]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['.B.', 'B.B', '.B.'], 65], [1, 0, -55]], [[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 75], [8, -2, 25]], [[['BBBB', 'B..B', 'B..B', 'BBBB'], 20], [14, 0, 120]], [[['WWW', 'W.W', 'WWW'], 0], [0, 7, -70]], [[['B.W', '...', 'W.B'], 5], [-2, -2, -5]], [[['.B...', 'B....', '.....', '....W', '...W.'], 65], [-1, -1, -65]], [[['BW.', 'BW.', 'BW.'], 75], [1, 4, -105]], [[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 20], [23, 0, 210]]], [[[['..B..', '..B..', 'BBBBB', 'WWWWW', '..W..'], 0], [13, 8, 50]], [[['BW.', 'BW.', 'BW.'], 75], [1, 4, -105]], [[['..W', '.W.', 'W..'], 5], [0, 3, -35]], [[['B....B', '......', '..WW..', '..WW..', '......', 'B....B'], 65], [-4, 2, -125]], [[['..WW', '.W..', 'B...'], 75], [-1, -1, -75]], [[['..WW', '.W.B', '.WWW', 'B..B'], 20], [-3, 2, -70]], [[['W..B', 'W...', '.W.W', '.W..', 'W.W.'], 0], [-1, 0, -10]], [[['.W...', 'W....', '.....', '....W', 'W....'], 5], [0, 17, -175]]], [[[['.W.B.', 'W.WB.', '.WB..', 'WB...', 'B....'], 75], [8, -2, 25]], [[['..WW', '.W..', 'B...'], 75], [-1, -1, -75]], [[['B..', 'B.W', '.W.'], 75], [0, -1, -65]], [[['W..BW.', '.W....', '......'], 20], [-1, -3, 0]], [[['BBBB', '....', '.W.B', 'BBB.', '.BBB', 'BB.B'], 0], [11, -1, 120]], [[['...', '.BW', '.B.', '...', 'B.B', 'BB.'], 5], [1, -1, 15]], [[['B.B', 'WWB', 'BWB', 'BWB', 'WBB'], 65], [3, 1, -45]], [[['B.WBB', 'W.B..', 'W.WWB', '.WB.B', '.WWWW', '..W.B'], 75], [-4, 7, -185]]], [[[['B.W', '...', 'W.B'], 5], [-2, -2, -5]], [[['B..', 'B.W', '.W.'], 75], [0, -1, -65]], [[['B.B...', '......', '..WWB.', '.WB.W.', 'WWB.B.'], 0], [-4, 0, -40]], [[['.WWBBB', 'WBWB.W', 'BBB.W.', 'BB..BB', 'BWB.B.', 'WWW.WW'], 5], [7, 1, 55]], [[['BBBB', 'B..B', 'W..B', '.WBB', 'WB..', '.B..'], 65], [11, -2, 65]], [[['WWWB.W', 'WB....', 'W.WB..', 'W.BB.W', 'BBW...', '.BB.WW'], 75], [2, 0, -55]], [[['BWB', 'W.W', 'WBW', 'BWB', '.W.', 'BWW'], 20], [-6, 1, -90]], [[['.BBW', '.WB.', 'W...', '....', '....'], 0], [1, -3, 40]]], [[[['.....', '.BBB.', '.B.B.', '.BBB.', '.....'], 20], [23, 0, 210]], [[['B.WBB', 'W.B..', 'W.WWB', '.WB.B', '.WWWW', '..W.B'], 75], [-4, 7, -185]], [[['B..', 'B..', '.B.', '..B', '..B'], 65], [9, 0, 25]], [[['....W.', '...B.B', 'BBBB..', '..B.W.', '.B.B.W'], 75], [5, -3, 5]], [[['..B', '.BW', 'B.B'], 20], [0, -1, -10]], [[['.BB..B', '......', 'B.B.BB', '.BBB..', '.B....'], 0], [20, 0, 200]], [[['W..', '.B.', '.W.', '...'], 5], [-1, -2, 5]], [[['..WW', 'B.WW', 'WBBW', '.WBW', 'WWBW', 'B..W'], 65], [0, 7, -135]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("group tax 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
group tax case 0[1, 0, -55][1, 0, -55]Passed
group tax case 1[8, -2, 25][8, -2, 25]Passed
group tax case 2[14, 0, 120][14, 0, 120]Passed
group tax case 3[0, 7, -70][0, 7, -70]Passed
group tax case 4[-2, -2, -5][-2, -2, -5]Passed
group tax case 5[-1, -1, -65][-1, -1, -65]Passed
group tax case 6[1, 4, -105][1, 4, -105]Passed
group tax case 7[23, 0, 210][23, 0, 210]Passed

SHA-256 / ab6dd6d1710f1720a95284a4b5a1e5254b334b0cdf8713fd1b28f158379aae3f

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

Case digest / 6d1525ffeb5e28833ad7324fadcfcd7373583101ff7348734702efe2116a2a74