FAILURE MAP
← Case archive

FA-82841 / Go territory scoring / Open access

Area flood fill leaks across the top and left board edges · case 01

Empty regions on the first row or column pick up border colours from the opposite edge, so territory becomes dame or changes owner.

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

ROOT CAUSE

The in-board test only checks the upper bounds, so row -1 and column -1 index the last row and column through Python negative indexing.

THE FAILURE

The in-board test only checks the upper bounds, so row -1 and column -1 index the last row and column through Python negative indexing.

Unsuccessful approach: Adding the lower bound for rows only still lets column -1 wrap to the right edge.

Case contract

Input [board, komi_tenths]. Area = own stones + empty regions whose orthogonal border touches only that colour. Return [black_area, white_area, result] where result is "B+x.y" / "W+x.y" after subtracting komi from black, or "Draw".

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])
    b = sum(row.count('B') for row in board)
    w = sum(row.count('W') for row in board)
    seen = set()
    for r in range(n):
        for c in range(m):
            if board[r][c] != '.' or (r, c) in seen:
                continue
            stack = [(r, c)]
            seen.add((r, c))
            size = 0
            border = set()
            while stack:
                i, j = stack.pop()
                size += 1
                for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):
                    a, d = i + di, j + dj
                    if a < n and d < m:
                        v = board[a][d]
                        if v == '.':
                            if (a, d) not in seen:
                                seen.add((a, d))
                                stack.append((a, d))
                        else:
                            border.add(v)
            if border == {'B'}:
                b += size
            elif border == {'W'}:
                w += size
    diff = b * 10 - w * 10 - komi
    if diff > 0:
        res = 'B+%d.%d' % (diff // 10, diff % 10)
    elif diff < 0:
        res = 'W+%d.%d' % ((-diff) // 10, (-diff) % 10)
    else:
        res = 'Draw'
    return [b, w, res]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['.B.', 'B.B', '.B.'], 65], [9, 0, 'B+2.5']], [[['WBWWB', 'BB.B.', 'WBWB.', 'WBWBB'], -5], [12, 7, 'B+5.5']], [[['.B.', '.WW', 'BBB', 'WW.'], 65], [4, 4, 'W+6.5']], [[['.WBB', 'BW..', '..B.'], 35], [4, 2, 'W+1.5']], [[['BW.B', '.WWW', 'B.BB', 'WBB.', 'BW.W'], -5], [8, 7, 'B+1.5']], [[['BWBB.', '.B..B', 'BW..B', 'W.BBW', '...BB'], 65], [13, 4, 'B+2.5']], [[['W..B.', 'BB.BB', 'B..B.', 'BBB..', 'B.BBB'], 60], [19, 1, 'B+12.0']], [[['.BBBW.', 'WBBBB.', '.WBB..', 'BBB...', 'BBW..B', '..BW.W'], 70], [18, 6, 'B+5.0']]], [[[['WB.B', 'B.B.', '.B..', 'B...'], -5], [15, 1, 'B+14.5']], [[['W..BBB', 'BWB.W.', '.WWWWW', 'W.WBWW'], -5], [6, 13, 'W+6.5']], [[['W..B', '...B', 'WWWW'], 0], [2, 5, 'W+3.0']], [[['W...', 'WBWB', 'WWBW', 'BBB.'], 5], [6, 6, 'W+0.5']], [[['WW..', 'WWW.', 'BWWW'], 65], [1, 11, 'W+16.5']], [[['WWB', 'W.W', 'B.W', 'B..', '..B'], 35], [4, 5, 'W+4.5']], [[['BB..', '...W', 'BBBW'], 65], [5, 2, 'W+3.5']], [[['W..', 'W.B', '.WB', 'WWW', 'B..'], -5], [3, 7, 'W+3.5']]], [[[['B.B.W', '.B.W.', 'B.BW.', 'BBW.W', '..W..'], 70], [10, 11, 'W+8.0']], [[['.BBBW.', 'WBBBB.', '.WBB..', 'BBB...', 'BBW..B', '..BW.W'], 70], [18, 6, 'B+5.0']], [[['WWW.W', '..BWW', 'B.BWB', 'W.B..', '.W.WB', 'WW.W.'], 5], [6, 15, 'W+9.5']], [[['.W.', 'BBW', '..B', 'BWW'], 65], [4, 5, 'W+7.5']], [[['.W..', 'WWBB', 'WWWW'], 75], [2, 8, 'W+13.5']], [[['.BBW.', 'WBWBW', '.WWW.', '.WB.B', 'BBW.W'], 35], [8, 11, 'W+6.5']], [[['.W...', '.BBB.', 'WWBBW', '.BB.B', 'WB..W', 'B..BB'], 60], [12, 6, 'Draw']], [[['.W.', '.WW', '.W.', 'BWB'], 70], [2, 6, 'W+11.0']]], [[[['WWW.W', '..BWW', 'B.BWB', 'W.B..', '.W.WB', 'WW.W.'], 5], [6, 15, 'W+9.5']], [[['.W.', '.WW', '.W.', 'BWB'], 70], [2, 6, 'W+11.0']], [[['.WB', 'W.B', 'WB.', 'WB.', 'B..', 'B.B'], 5], [12, 5, 'B+6.5']], [[['WBB', 'BWW', '.BB', 'W..'], 75], [5, 4, 'W+6.5']], [[['..WWB', 'B.B..', '.W.W.', '..BB.', '....B', '...BB'], 60], [8, 4, 'W+2.0']], [[['BBBB.B', '....B.', '.....W', 'BBW..B'], 70], [10, 2, 'B+1.0']], [[['.B.B.', '.BW.W', '....B', 'B..BW', '.BB..', 'W.W..'], -5], [8, 5, 'B+3.5']], [[['...W.W', '.WB.W.', 'W..W..', 'BWW.WW', '.WWW.W', 'BW....'], 0], [3, 25, 'W+22.0']]], [[[['.B.', 'B.B', '.B.'], 65], [9, 0, 'B+2.5']], [[['BBBB.B', '....B.', '.....W', 'BBW..B'], 70], [10, 2, 'B+1.0']], [[['WWW', '.WW', '.WW', 'WWW', 'WWW', 'W.W'], 65], [0, 18, 'W+24.5']], [[['W..', 'W.B', '.WB', 'WWW', 'B..'], -5], [3, 7, 'W+3.5']], [[['WWW', '..B', 'WBW'], 75], [2, 5, 'W+10.5']], [[['.WWW.', 'WW.BB', '.WB..', 'B.W.W', '.WW..', 'W.WWW'], 60], [4, 16, 'W+18.0']], [[['..B', '..W', 'BWB', 'B.B', 'B.W'], 70], [6, 3, 'W+4.0']], [[['.WBB..', 'WWWB.B', 'BWWW.W', 'WW.BB.', 'BW.W.W'], -5], [8, 14, 'W+5.5']]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("area score 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
area score case 0[14, 0, 'B+7.5'][9, 0, 'B+2.5']Failed
area score case 1[12, 7, 'B+5.5'][12, 7, 'B+5.5']Passed
area score case 2[4, 4, 'W+6.5'][4, 4, 'W+6.5']Passed
area score case 3[4, 2, 'W+1.5'][4, 2, 'W+1.5']Passed
area score case 4[8, 7, 'B+1.5'][8, 7, 'B+1.5']Passed
area score case 5[13, 4, 'B+2.5'][13, 4, 'B+2.5']Passed
area score case 6[19, 1, 'B+12.0'][19, 1, 'B+12.0']Passed
area score case 7[16, 6, 'B+3.0'][18, 6, 'B+5.0']Failed

SHA-256 / ae62fd680c942a00d45a5e3064d9628bc04fff01f0539cc80beaf963773090bb

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])
    b = sum(row.count('B') for row in board)
    w = sum(row.count('W') for row in board)
    seen = set()
    for r in range(n):
        for c in range(m):
            if board[r][c] != '.' or (r, c) in seen:
                continue
            stack = [(r, c)]
            seen.add((r, c))
            size = 0
            border = set()
            while stack:
                i, j = stack.pop()
                size += 1
                for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):
                    a, d = i + di, j + dj
                    if 0 <= a < n and d < m:
                        v = board[a][d]
                        if v == '.':
                            if (a, d) not in seen:
                                seen.add((a, d))
                                stack.append((a, d))
                        else:
                            border.add(v)
            if border == {'B'}:
                b += size
            elif border == {'W'}:
                w += size
    diff = b * 10 - w * 10 - komi
    if diff > 0:
        res = 'B+%d.%d' % (diff // 10, diff % 10)
    elif diff < 0:
        res = 'W+%d.%d' % ((-diff) // 10, (-diff) % 10)
    else:
        res = 'Draw'
    return [b, w, res]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['.B.', 'B.B', '.B.'], 65], [9, 0, 'B+2.5']], [[['WBWWB', 'BB.B.', 'WBWB.', 'WBWBB'], -5], [12, 7, 'B+5.5']], [[['.B.', '.WW', 'BBB', 'WW.'], 65], [4, 4, 'W+6.5']], [[['.WBB', 'BW..', '..B.'], 35], [4, 2, 'W+1.5']], [[['BW.B', '.WWW', 'B.BB', 'WBB.', 'BW.W'], -5], [8, 7, 'B+1.5']], [[['BWBB.', '.B..B', 'BW..B', 'W.BBW', '...BB'], 65], [13, 4, 'B+2.5']], [[['W..B.', 'BB.BB', 'B..B.', 'BBB..', 'B.BBB'], 60], [19, 1, 'B+12.0']], [[['.BBBW.', 'WBBBB.', '.WBB..', 'BBB...', 'BBW..B', '..BW.W'], 70], [18, 6, 'B+5.0']]], [[[['WB.B', 'B.B.', '.B..', 'B...'], -5], [15, 1, 'B+14.5']], [[['W..BBB', 'BWB.W.', '.WWWWW', 'W.WBWW'], -5], [6, 13, 'W+6.5']], [[['W..B', '...B', 'WWWW'], 0], [2, 5, 'W+3.0']], [[['W...', 'WBWB', 'WWBW', 'BBB.'], 5], [6, 6, 'W+0.5']], [[['WW..', 'WWW.', 'BWWW'], 65], [1, 11, 'W+16.5']], [[['WWB', 'W.W', 'B.W', 'B..', '..B'], 35], [4, 5, 'W+4.5']], [[['BB..', '...W', 'BBBW'], 65], [5, 2, 'W+3.5']], [[['W..', 'W.B', '.WB', 'WWW', 'B..'], -5], [3, 7, 'W+3.5']]], [[[['B.B.W', '.B.W.', 'B.BW.', 'BBW.W', '..W..'], 70], [10, 11, 'W+8.0']], [[['.BBBW.', 'WBBBB.', '.WBB..', 'BBB...', 'BBW..B', '..BW.W'], 70], [18, 6, 'B+5.0']], [[['WWW.W', '..BWW', 'B.BWB', 'W.B..', '.W.WB', 'WW.W.'], 5], [6, 15, 'W+9.5']], [[['.W.', 'BBW', '..B', 'BWW'], 65], [4, 5, 'W+7.5']], [[['.W..', 'WWBB', 'WWWW'], 75], [2, 8, 'W+13.5']], [[['.BBW.', 'WBWBW', '.WWW.', '.WB.B', 'BBW.W'], 35], [8, 11, 'W+6.5']], [[['.W...', '.BBB.', 'WWBBW', '.BB.B', 'WB..W', 'B..BB'], 60], [12, 6, 'Draw']], [[['.W.', '.WW', '.W.', 'BWB'], 70], [2, 6, 'W+11.0']]], [[[['WWW.W', '..BWW', 'B.BWB', 'W.B..', '.W.WB', 'WW.W.'], 5], [6, 15, 'W+9.5']], [[['.W.', '.WW', '.W.', 'BWB'], 70], [2, 6, 'W+11.0']], [[['.WB', 'W.B', 'WB.', 'WB.', 'B..', 'B.B'], 5], [12, 5, 'B+6.5']], [[['WBB', 'BWW', '.BB', 'W..'], 75], [5, 4, 'W+6.5']], [[['..WWB', 'B.B..', '.W.W.', '..BB.', '....B', '...BB'], 60], [8, 4, 'W+2.0']], [[['BBBB.B', '....B.', '.....W', 'BBW..B'], 70], [10, 2, 'B+1.0']], [[['.B.B.', '.BW.W', '....B', 'B..BW', '.BB..', 'W.W..'], -5], [8, 5, 'B+3.5']], [[['...W.W', '.WB.W.', 'W..W..', 'BWW.WW', '.WWW.W', 'BW....'], 0], [3, 25, 'W+22.0']]], [[[['.B.', 'B.B', '.B.'], 65], [9, 0, 'B+2.5']], [[['BBBB.B', '....B.', '.....W', 'BBW..B'], 70], [10, 2, 'B+1.0']], [[['WWW', '.WW', '.WW', 'WWW', 'WWW', 'W.W'], 65], [0, 18, 'W+24.5']], [[['W..', 'W.B', '.WB', 'WWW', 'B..'], -5], [3, 7, 'W+3.5']], [[['WWW', '..B', 'WBW'], 75], [2, 5, 'W+10.5']], [[['.WWW.', 'WW.BB', '.WB..', 'B.W.W', '.WW..', 'W.WWW'], 60], [4, 16, 'W+18.0']], [[['..B', '..W', 'BWB', 'B.B', 'B.W'], 70], [6, 3, 'W+4.0']], [[['.WBB..', 'WWWB.B', 'BWWW.W', 'WW.BB.', 'BW.W.W'], -5], [8, 14, 'W+5.5']]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("area score 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
area score case 0[11, 0, 'B+4.5'][9, 0, 'B+2.5']Failed
area score case 1[12, 7, 'B+5.5'][12, 7, 'B+5.5']Passed
area score case 2[4, 4, 'W+6.5'][4, 4, 'W+6.5']Passed
area score case 3[4, 2, 'W+1.5'][4, 2, 'W+1.5']Passed
area score case 4[8, 7, 'B+1.5'][8, 7, 'B+1.5']Passed
area score case 5[13, 4, 'B+2.5'][13, 4, 'B+2.5']Passed
area score case 6[19, 1, 'B+12.0'][19, 1, 'B+12.0']Passed
area score case 7[16, 6, 'B+3.0'][18, 6, 'B+5.0']Failed

SHA-256 / 0ea2dbce93f0cf34dde107563207e379b6522776421177b15ac88e5be33bab8c

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

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

Case digest / bbae8b5f92d1fe76ee208c6ba4e415a77db720870e4bdefcd805c8ec48d18e02