FAILURE MAP
← Case archive

FA-83076 / Go territory scoring / Open access

Handicap compensation is added to black · case 01

Black margin grows with the handicap.

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

ROOT CAUSE

The compensation is added to the black side of the margin.

VERIFIED REPAIR

Add the compensation to white before converting to tenths.

Unsuccessful approach: Subtracting the compensation from the tenths margin without scaling treats points as tenths.

Case contract

Input [rules, handicap, area_b, area_w, komi_tenths]. With handicap >= 2, white receives handicap points under chinese and handicap-1 under aga; other rules none. Return black margin in tenths.

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):
    rules, h, ab, aw, komi = x
    comp = 0
    if h >= 2:
        if rules == 'chinese':
            comp = h
        elif rules == 'aga':
            comp = h - 1
    return (ab + comp) * 10 - aw * 10 - komi
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['aga', 5, 177, 168, 5], 45], [['chinese', 9, 175, 177, 5], -115], [['japanese', 2, 192, 168, 5], 235], [['japanese', 6, 150, 163, 0], -130], [['korean', 4, 186, 189, 0], -30], [['japanese', 0, 194, 172, 5], 215], [['aga', 5, 208, 202, 65], -45], [['chinese', 7, 188, 188, 5], -75]], [[['chinese', 7, 165, 188, 5], -305], [['aga', 8, 157, 153, 0], -30], [['japanese', 9, 154, 170, 65], -225], [['japanese', 5, 174, 162, 5], 115], [['korean', 6, 207, 201, 5], 55], [['korean', 0, 160, 185, 65], -315], [['japanese', 1, 209, 204, 5], 45], [['chinese', 5, 192, 202, 5], -155]], [[['chinese', 9, 175, 177, 5], -115], [['aga', 0, 154, 183, 75], -365], [['chinese', 0, 190, 164, 75], 185], [['korean', 2, 151, 171, 75], -275], [['chinese', 5, 192, 202, 5], -155], [['korean', 2, 172, 205, 75], -405], [['aga', 4, 210, 187, 75], 125], [['aga', 7, 191, 209, 75], -315]], [[['chinese', 7, 188, 188, 5], -75], [['aga', 2, 184, 170, 65], 65], [['korean', 2, 160, 206, 65], -525], [['korean', 7, 159, 177, 0], -180], [['aga', 9, 154, 181, 75], -425], [['japanese', 7, 205, 198, 0], 70], [['aga', 7, 191, 209, 75], -315], [['chinese', 7, 174, 205, 0], -380]], [[['aga', 4, 210, 187, 75], 125], [['korean', 4, 163, 154, 0], 90], [['aga', 7, 202, 195, 65], -55], [['korean', 1, 174, 169, 75], -25], [['korean', 7, 195, 188, 65], 5], [['korean', 8, 166, 205, 5], -395], [['japanese', 8, 168, 154, 0], 140], [['chinese', 8, 209, 167, 75], 265]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("compensation 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
compensation case 012545Failed
compensation case 165-115Failed
compensation case 2235235Passed
compensation case 3-130-130Passed
compensation case 4-30-30Passed
compensation case 5215215Passed
compensation case 635-45Failed
compensation case 765-75Failed

SHA-256 / 43e2a06a28676fa8693fa17708811727ea5081874c1aab1c5a0b64c4c56a77e1

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    rules, h, ab, aw, komi = x
    comp = 0
    if h >= 2:
        if rules == 'chinese':
            comp = h
        elif rules == 'aga':
            comp = h - 1
    return ab * 10 - aw * 10 - komi - comp
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['aga', 5, 177, 168, 5], 45], [['chinese', 9, 175, 177, 5], -115], [['japanese', 2, 192, 168, 5], 235], [['japanese', 6, 150, 163, 0], -130], [['korean', 4, 186, 189, 0], -30], [['japanese', 0, 194, 172, 5], 215], [['aga', 5, 208, 202, 65], -45], [['chinese', 7, 188, 188, 5], -75]], [[['chinese', 7, 165, 188, 5], -305], [['aga', 8, 157, 153, 0], -30], [['japanese', 9, 154, 170, 65], -225], [['japanese', 5, 174, 162, 5], 115], [['korean', 6, 207, 201, 5], 55], [['korean', 0, 160, 185, 65], -315], [['japanese', 1, 209, 204, 5], 45], [['chinese', 5, 192, 202, 5], -155]], [[['chinese', 9, 175, 177, 5], -115], [['aga', 0, 154, 183, 75], -365], [['chinese', 0, 190, 164, 75], 185], [['korean', 2, 151, 171, 75], -275], [['chinese', 5, 192, 202, 5], -155], [['korean', 2, 172, 205, 75], -405], [['aga', 4, 210, 187, 75], 125], [['aga', 7, 191, 209, 75], -315]], [[['chinese', 7, 188, 188, 5], -75], [['aga', 2, 184, 170, 65], 65], [['korean', 2, 160, 206, 65], -525], [['korean', 7, 159, 177, 0], -180], [['aga', 9, 154, 181, 75], -425], [['japanese', 7, 205, 198, 0], 70], [['aga', 7, 191, 209, 75], -315], [['chinese', 7, 174, 205, 0], -380]], [[['aga', 4, 210, 187, 75], 125], [['korean', 4, 163, 154, 0], 90], [['aga', 7, 202, 195, 65], -55], [['korean', 1, 174, 169, 75], -25], [['korean', 7, 195, 188, 65], 5], [['korean', 8, 166, 205, 5], -395], [['japanese', 8, 168, 154, 0], 140], [['chinese', 8, 209, 167, 75], 265]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("compensation 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
compensation case 08145Failed
compensation case 1-34-115Failed
compensation case 2235235Passed
compensation case 3-130-130Passed
compensation case 4-30-30Passed
compensation case 5215215Passed
compensation case 6-9-45Failed
compensation case 7-12-75Failed

SHA-256 / 9bc61b2cc287d1e2d816dcc0679c6ca0b828a3cd7a50024f556b753bca3856f5

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    rules, h, ab, aw, komi = x
    comp = 0
    if h >= 2:
        if rules == 'chinese':
            comp = h
        elif rules == 'aga':
            comp = h - 1
    return ab * 10 - (aw + comp) * 10 - komi
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['aga', 5, 177, 168, 5], 45], [['chinese', 9, 175, 177, 5], -115], [['japanese', 2, 192, 168, 5], 235], [['japanese', 6, 150, 163, 0], -130], [['korean', 4, 186, 189, 0], -30], [['japanese', 0, 194, 172, 5], 215], [['aga', 5, 208, 202, 65], -45], [['chinese', 7, 188, 188, 5], -75]], [[['chinese', 7, 165, 188, 5], -305], [['aga', 8, 157, 153, 0], -30], [['japanese', 9, 154, 170, 65], -225], [['japanese', 5, 174, 162, 5], 115], [['korean', 6, 207, 201, 5], 55], [['korean', 0, 160, 185, 65], -315], [['japanese', 1, 209, 204, 5], 45], [['chinese', 5, 192, 202, 5], -155]], [[['chinese', 9, 175, 177, 5], -115], [['aga', 0, 154, 183, 75], -365], [['chinese', 0, 190, 164, 75], 185], [['korean', 2, 151, 171, 75], -275], [['chinese', 5, 192, 202, 5], -155], [['korean', 2, 172, 205, 75], -405], [['aga', 4, 210, 187, 75], 125], [['aga', 7, 191, 209, 75], -315]], [[['chinese', 7, 188, 188, 5], -75], [['aga', 2, 184, 170, 65], 65], [['korean', 2, 160, 206, 65], -525], [['korean', 7, 159, 177, 0], -180], [['aga', 9, 154, 181, 75], -425], [['japanese', 7, 205, 198, 0], 70], [['aga', 7, 191, 209, 75], -315], [['chinese', 7, 174, 205, 0], -380]], [[['aga', 4, 210, 187, 75], 125], [['korean', 4, 163, 154, 0], 90], [['aga', 7, 202, 195, 65], -55], [['korean', 1, 174, 169, 75], -25], [['korean', 7, 195, 188, 65], 5], [['korean', 8, 166, 205, 5], -395], [['japanese', 8, 168, 154, 0], 140], [['chinese', 8, 209, 167, 75], 265]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("compensation 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
compensation case 04545Passed
compensation case 1-115-115Passed
compensation case 2235235Passed
compensation case 3-130-130Passed
compensation case 4-30-30Passed
compensation case 5215215Passed
compensation case 6-45-45Passed
compensation case 7-75-75Passed

SHA-256 / 51b44bed32cc3319bfa2fa470d942aab5bf7f247ee9900f9831f6e0d63870160

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

Case digest / cc96ef9bbb4a468895884913ddbbe43bdea28882a5a61c7d31d0abb1306c26aa