FA-83211 / Go territory scoring / Open access
Handicap exceeds nine stones · case 01
Large rank gaps produce impossible handicaps.
ROOT CAUSE
The stone count is not capped.
VERIFIED REPAIR
Cap at nine stones.
Unsuccessful approach: Subtracting one from the rank gap under-handicaps every game.
Case contract
Input [rank_a, rank_b] as Nk (1..30) or Nd (1..9); 1k and 1d are one rank apart. Equal ranks -> [rank_a, 0, 65]; one rank apart -> [weaker, 0, 5]; otherwise [weaker, min(diff, 9), 5]. Invalid ranks -> "invalid". The first element is the player taking black.
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):
def val(s):
if len(s) < 2 or not s[:-1].isdigit():
return None
k = int(s[:-1])
if s[-1] == 'k' and 1 <= k <= 30:
return 1 - k
if s[-1] == 'd' and 1 <= k <= 9:
return k
return None
a, b = x
va, vb = val(a), val(b)
if va is None or vb is None:
return 'invalid'
diff = abs(va - vb)
weaker = a if va < vb else b
if diff == 0:
return [a, 0, 65]
if diff == 1:
return [weaker, 0, 5]
return [weaker, diff, 5]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['30k', '3k'], ['30k', 9, 5]], [['20k', '2d'], ['20k', 9, 5]], [['20k', '5d'], ['20k', 9, 5]], [['20k', '9d'], ['20k', 9, 5]], [['20k', '3p'], 'invalid'], [['10k', '5k'], ['10k', 5, 5]], [['10k', 'k'], 'invalid'], [['2k', '10k'], ['10k', 8, 5]]], [[['20k', '1k'], ['20k', 9, 5]], [['10k', '6d'], ['10k', 9, 5]], [['5k', '1k'], ['5k', 4, 5]], [['5k', '0k'], 'invalid'], [['5k', 'k'], 'invalid'], [['3k', '2d'], ['3k', 4, 5]], [['3k', '3d'], ['3k', 5, 5]], [['1k', '5d'], ['1k', 5, 5]]], [[['20k', '5d'], ['20k', 9, 5]], [['3k', '9d'], ['3k', 9, 5]], [['3k', '0k'], 'invalid'], [['2k', '30k'], ['30k', 9, 5]], [['2k', '10k'], ['10k', 8, 5]], [['2k', '1d'], ['2k', 2, 5]], [['2k', '3d'], ['2k', 4, 5]], [['1d', '6d'], ['1d', 5, 5]]], [[['3k', '9d'], ['3k', 9, 5]], [['1k', '3k'], ['3k', 2, 5]], [['1k', '2k'], ['2k', 0, 5]], [['1k', '1k'], ['1k', 0, 65]], [['1k', '5d'], ['1k', 5, 5]], [['1k', '9d'], ['1k', 9, 5]], [['1k', '0k'], 'invalid'], [['3d', '4k'], ['4k', 6, 5]]], [[['1k', '8k'], ['8k', 7, 5]], [['1d', '30k'], ['30k', 9, 5]], [['1d', '20k'], ['20k', 9, 5]], [['1d', '2k'], ['2k', 2, 5]], [['1d', '8k'], ['8k', 8, 5]], [['1d', '6d'], ['1d', 5, 5]], [['1d', '4k'], ['4k', 4, 5]], [['12k', '20k'], ['20k', 8, 5]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("handicap 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| handicap case 0 | ['30k', 27, 5] | ['30k', 9, 5] | Failed |
| handicap case 1 | ['20k', 21, 5] | ['20k', 9, 5] | Failed |
| handicap case 2 | ['20k', 24, 5] | ['20k', 9, 5] | Failed |
| handicap case 3 | ['20k', 28, 5] | ['20k', 9, 5] | Failed |
| handicap case 4 | invalid | invalid | Passed |
| handicap case 5 | ['10k', 5, 5] | ['10k', 5, 5] | Passed |
| handicap case 6 | invalid | invalid | Passed |
| handicap case 7 | ['10k', 8, 5] | ['10k', 8, 5] | Passed |
SHA-256 / c93d2c6f571917f24fc113f104721eb788c38f1584cd5d97362f98a90cef6f46
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def val(s):
if len(s) < 2 or not s[:-1].isdigit():
return None
k = int(s[:-1])
if s[-1] == 'k' and 1 <= k <= 30:
return 1 - k
if s[-1] == 'd' and 1 <= k <= 9:
return k
return None
a, b = x
va, vb = val(a), val(b)
if va is None or vb is None:
return 'invalid'
diff = abs(va - vb)
weaker = a if va < vb else b
if diff == 0:
return [a, 0, 65]
if diff == 1:
return [weaker, 0, 5]
return [weaker, min(diff - 1, 9), 5]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['30k', '3k'], ['30k', 9, 5]], [['20k', '2d'], ['20k', 9, 5]], [['20k', '5d'], ['20k', 9, 5]], [['20k', '9d'], ['20k', 9, 5]], [['20k', '3p'], 'invalid'], [['10k', '5k'], ['10k', 5, 5]], [['10k', 'k'], 'invalid'], [['2k', '10k'], ['10k', 8, 5]]], [[['20k', '1k'], ['20k', 9, 5]], [['10k', '6d'], ['10k', 9, 5]], [['5k', '1k'], ['5k', 4, 5]], [['5k', '0k'], 'invalid'], [['5k', 'k'], 'invalid'], [['3k', '2d'], ['3k', 4, 5]], [['3k', '3d'], ['3k', 5, 5]], [['1k', '5d'], ['1k', 5, 5]]], [[['20k', '5d'], ['20k', 9, 5]], [['3k', '9d'], ['3k', 9, 5]], [['3k', '0k'], 'invalid'], [['2k', '30k'], ['30k', 9, 5]], [['2k', '10k'], ['10k', 8, 5]], [['2k', '1d'], ['2k', 2, 5]], [['2k', '3d'], ['2k', 4, 5]], [['1d', '6d'], ['1d', 5, 5]]], [[['3k', '9d'], ['3k', 9, 5]], [['1k', '3k'], ['3k', 2, 5]], [['1k', '2k'], ['2k', 0, 5]], [['1k', '1k'], ['1k', 0, 65]], [['1k', '5d'], ['1k', 5, 5]], [['1k', '9d'], ['1k', 9, 5]], [['1k', '0k'], 'invalid'], [['3d', '4k'], ['4k', 6, 5]]], [[['1k', '8k'], ['8k', 7, 5]], [['1d', '30k'], ['30k', 9, 5]], [['1d', '20k'], ['20k', 9, 5]], [['1d', '2k'], ['2k', 2, 5]], [['1d', '8k'], ['8k', 8, 5]], [['1d', '6d'], ['1d', 5, 5]], [['1d', '4k'], ['4k', 4, 5]], [['12k', '20k'], ['20k', 8, 5]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("handicap 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| handicap case 0 | ['30k', 9, 5] | ['30k', 9, 5] | Passed |
| handicap case 1 | ['20k', 9, 5] | ['20k', 9, 5] | Passed |
| handicap case 2 | ['20k', 9, 5] | ['20k', 9, 5] | Passed |
| handicap case 3 | ['20k', 9, 5] | ['20k', 9, 5] | Passed |
| handicap case 4 | invalid | invalid | Passed |
| handicap case 5 | ['10k', 4, 5] | ['10k', 5, 5] | Failed |
| handicap case 6 | invalid | invalid | Passed |
| handicap case 7 | ['10k', 7, 5] | ['10k', 8, 5] | Failed |
SHA-256 / 6344beab2be31f7951349461fa0e249d1ed2facb5223b877e9cab2bd00de07a1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def val(s):
if len(s) < 2 or not s[:-1].isdigit():
return None
k = int(s[:-1])
if s[-1] == 'k' and 1 <= k <= 30:
return 1 - k
if s[-1] == 'd' and 1 <= k <= 9:
return k
return None
a, b = x
va, vb = val(a), val(b)
if va is None or vb is None:
return 'invalid'
diff = abs(va - vb)
weaker = a if va < vb else b
if diff == 0:
return [a, 0, 65]
if diff == 1:
return [weaker, 0, 5]
return [weaker, min(diff, 9), 5]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['30k', '3k'], ['30k', 9, 5]], [['20k', '2d'], ['20k', 9, 5]], [['20k', '5d'], ['20k', 9, 5]], [['20k', '9d'], ['20k', 9, 5]], [['20k', '3p'], 'invalid'], [['10k', '5k'], ['10k', 5, 5]], [['10k', 'k'], 'invalid'], [['2k', '10k'], ['10k', 8, 5]]], [[['20k', '1k'], ['20k', 9, 5]], [['10k', '6d'], ['10k', 9, 5]], [['5k', '1k'], ['5k', 4, 5]], [['5k', '0k'], 'invalid'], [['5k', 'k'], 'invalid'], [['3k', '2d'], ['3k', 4, 5]], [['3k', '3d'], ['3k', 5, 5]], [['1k', '5d'], ['1k', 5, 5]]], [[['20k', '5d'], ['20k', 9, 5]], [['3k', '9d'], ['3k', 9, 5]], [['3k', '0k'], 'invalid'], [['2k', '30k'], ['30k', 9, 5]], [['2k', '10k'], ['10k', 8, 5]], [['2k', '1d'], ['2k', 2, 5]], [['2k', '3d'], ['2k', 4, 5]], [['1d', '6d'], ['1d', 5, 5]]], [[['3k', '9d'], ['3k', 9, 5]], [['1k', '3k'], ['3k', 2, 5]], [['1k', '2k'], ['2k', 0, 5]], [['1k', '1k'], ['1k', 0, 65]], [['1k', '5d'], ['1k', 5, 5]], [['1k', '9d'], ['1k', 9, 5]], [['1k', '0k'], 'invalid'], [['3d', '4k'], ['4k', 6, 5]]], [[['1k', '8k'], ['8k', 7, 5]], [['1d', '30k'], ['30k', 9, 5]], [['1d', '20k'], ['20k', 9, 5]], [['1d', '2k'], ['2k', 2, 5]], [['1d', '8k'], ['8k', 8, 5]], [['1d', '6d'], ['1d', 5, 5]], [['1d', '4k'], ['4k', 4, 5]], [['12k', '20k'], ['20k', 8, 5]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("handicap 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| handicap case 0 | ['30k', 9, 5] | ['30k', 9, 5] | Passed |
| handicap case 1 | ['20k', 9, 5] | ['20k', 9, 5] | Passed |
| handicap case 2 | ['20k', 9, 5] | ['20k', 9, 5] | Passed |
| handicap case 3 | ['20k', 9, 5] | ['20k', 9, 5] | Passed |
| handicap case 4 | invalid | invalid | Passed |
| handicap case 5 | ['10k', 5, 5] | ['10k', 5, 5] | Passed |
| handicap case 6 | invalid | invalid | Passed |
| handicap case 7 | ['10k', 8, 5] | ['10k', 8, 5] | Passed |
SHA-256 / 4dc50856dfd1b603d2dce8780012e06ecbb771236fc1b13d0719519afdfaf71a
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:19.410558+00:00.
Case digest / d7b59cb5b13726ef10432e9d31cf32fe42850dbd44837f43c46ae7d30d21f900