FAILURE MAP
← Case archive

FA-83301 / Go territory scoring / Open access

Negative komi loses its sign · case 01

Reverse komi of -6.5 is applied as +6.5.

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

ROOT CAUSE

The parsed sign flag is never applied.

VERIFIED REPAIR

Negate the complete value when the sign is minus.

Unsuccessful approach: Negating only the whole part turns -0.5 into +0.5 and -6.5 into -5.5.

Case contract

Input a komi string: optional sign, whole points, and an optional half written ".5"/".0" or "½". A bare half ("½", ".5") is allowed. Return komi in tenths or "invalid".

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):
    s = x.strip()
    neg = s.startswith('-')
    if s[:1] in '+-' and s:
        s = s[1:]
    half = 0
    if s.endswith('½'):
        half = 5
        s = s[:-1]
    elif '.' in s:
        s, _, frac = s.partition('.')
        if frac not in ('0', '5'):
            return 'invalid'
        half = int(frac)
    if not s.isdigit():
        if s == '' and half:
            s = '0'
        else:
            return 'invalid'
    v = int(s) * 10 + half
    return v
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['-0.5', -5], ['-0.5', -5], ['+5.5', 55], ['7.0', 70], ['6.3', 'invalid'], ['.5', 5], ['', 'invalid'], ['-', 'invalid']], [['abc', 'invalid'], ['5.', 'invalid'], [' 6.5 ', 65], ['-3', -30], ['-7.5', -75], ['-7.5', -75], ['0.0', 0], ['1 1/2', 'invalid']], [['6.5', 65], ['7', 70], ['-0.5', -5], ['-6½', -65], ['-3', -30], ['6.50', 'invalid'], ['+', 'invalid'], ['+½', 5]], [['-0.5', -5], ['½', 5], ['-6½', -65], ['0', 0], ['+5.5', 55], ['7.0', 70], ['6.3', 'invalid'], ['.5', 5]], [['-0.5', -5], ['', 'invalid'], ['-', 'invalid'], ['abc', 'invalid'], ['5.', 'invalid'], [' 6.5 ', 65], ['-3', -30], ['-7.5', -75]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("komi 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
komi case 05-5Failed
komi case 15-5Failed
komi case 25555Passed
komi case 37070Passed
komi case 4invalidinvalidPassed
komi case 555Passed
komi case 6invalidinvalidPassed
komi case 7invalidinvalidPassed

SHA-256 / 9e3c4eb9587b2afae765bd43dbb84c248eee219d66c72d753fac99142c0d1d52

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    s = x.strip()
    neg = s.startswith('-')
    if s[:1] in '+-' and s:
        s = s[1:]
    half = 0
    if s.endswith('½'):
        half = 5
        s = s[:-1]
    elif '.' in s:
        s, _, frac = s.partition('.')
        if frac not in ('0', '5'):
            return 'invalid'
        half = int(frac)
    if not s.isdigit():
        if s == '' and half:
            s = '0'
        else:
            return 'invalid'
    v = int(s) * 10 + half
    return -int(s) * 10 + half if neg else v
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['-0.5', -5], ['-0.5', -5], ['+5.5', 55], ['7.0', 70], ['6.3', 'invalid'], ['.5', 5], ['', 'invalid'], ['-', 'invalid']], [['abc', 'invalid'], ['5.', 'invalid'], [' 6.5 ', 65], ['-3', -30], ['-7.5', -75], ['-7.5', -75], ['0.0', 0], ['1 1/2', 'invalid']], [['6.5', 65], ['7', 70], ['-0.5', -5], ['-6½', -65], ['-3', -30], ['6.50', 'invalid'], ['+', 'invalid'], ['+½', 5]], [['-0.5', -5], ['½', 5], ['-6½', -65], ['0', 0], ['+5.5', 55], ['7.0', 70], ['6.3', 'invalid'], ['.5', 5]], [['-0.5', -5], ['', 'invalid'], ['-', 'invalid'], ['abc', 'invalid'], ['5.', 'invalid'], [' 6.5 ', 65], ['-3', -30], ['-7.5', -75]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("komi 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
komi case 05-5Failed
komi case 15-5Failed
komi case 25555Passed
komi case 37070Passed
komi case 4invalidinvalidPassed
komi case 555Passed
komi case 6invalidinvalidPassed
komi case 7invalidinvalidPassed

SHA-256 / 9e8a35cfa7f9c8cd5553b030d3b007d2a6328d36387c95acff4f977b9bd49894

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    s = x.strip()
    neg = s.startswith('-')
    if s[:1] in '+-' and s:
        s = s[1:]
    half = 0
    if s.endswith('½'):
        half = 5
        s = s[:-1]
    elif '.' in s:
        s, _, frac = s.partition('.')
        if frac not in ('0', '5'):
            return 'invalid'
        half = int(frac)
    if not s.isdigit():
        if s == '' and half:
            s = '0'
        else:
            return 'invalid'
    v = int(s) * 10 + half
    return -v if neg else v
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['-0.5', -5], ['-0.5', -5], ['+5.5', 55], ['7.0', 70], ['6.3', 'invalid'], ['.5', 5], ['', 'invalid'], ['-', 'invalid']], [['abc', 'invalid'], ['5.', 'invalid'], [' 6.5 ', 65], ['-3', -30], ['-7.5', -75], ['-7.5', -75], ['0.0', 0], ['1 1/2', 'invalid']], [['6.5', 65], ['7', 70], ['-0.5', -5], ['-6½', -65], ['-3', -30], ['6.50', 'invalid'], ['+', 'invalid'], ['+½', 5]], [['-0.5', -5], ['½', 5], ['-6½', -65], ['0', 0], ['+5.5', 55], ['7.0', 70], ['6.3', 'invalid'], ['.5', 5]], [['-0.5', -5], ['', 'invalid'], ['-', 'invalid'], ['abc', 'invalid'], ['5.', 'invalid'], [' 6.5 ', 65], ['-3', -30], ['-7.5', -75]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("komi 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
komi case 0-5-5Passed
komi case 1-5-5Passed
komi case 25555Passed
komi case 37070Passed
komi case 4invalidinvalidPassed
komi case 555Passed
komi case 6invalidinvalidPassed
komi case 7invalidinvalidPassed

SHA-256 / 893def30b2128476b438b2fa17e8e1c50292c9d79c0d9c5043515061e7dd7865

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

Case digest / af08b6172a03671f7aa082c8c72fd59d89d43eed325dca4c829e7fe1698615f0