{"abstract":"Games across the kyu/dan boundary get an extra handicap stone.","category":"Go territory scoring","checks":8,"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.","evaluation_group":"w2-go-territory-scoring-rank-handicap","failed_approach":"Shifting dan ranks down by one maps 1k and 1d to the same value.","family":"w2-go-territory-scoring-rank-handicap-kyu-dan-boundary","id":"FA-83201","implementations":{"attempt":{"sha256":"cfa666152fa0d7fe8179ff5828dd3d28a108ed8a76ef6ff6f28e8621a8865a2c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def val(s):\n        if len(s) < 2 or not s[:-1].isdigit():\n            return None\n        k = int(s[:-1])\n        if s[-1] == 'k' and 1 <= k <= 30:\n            return 1 - k\n        if s[-1] == 'd' and 1 <= k <= 9:\n            return k - 1\n        return None\n    a, b = x\n    va, vb = val(a), val(b)\n    if va is None or vb is None:\n        return 'invalid'\n    diff = abs(va - vb)\n    weaker = a if va < vb else b\n    if diff == 0:\n        return [a, 0, 65]\n    if diff == 1:\n        return [weaker, 0, 5]\n    return [weaker, min(diff, 9), 5]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[['20k', '1d'], ['20k', 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]], [['3k', '2d'], ['3k', 4, 5]], [['1k', '9d'], ['1k', 9, 5]]], [[['10k', '8k'], ['10k', 2, 5]], [['10k', '6d'], ['10k', 9, 5]], [['5k', '1k'], ['5k', 4, 5]], [['5k', '0k'], 'invalid'], [['5k', 'k'], 'invalid'], [['3k', '2d'], ['3k', 4, 5]], [['2k', '1d'], ['2k', 2, 5]], [['5d', '3k'], ['3k', 7, 5]]], [[['3k', '5d'], ['3k', 7, 5]], [['3k', '9d'], ['3k', 9, 5]], [['3k', '0k'], 'invalid'], [['2k', '30k'], ['30k', 9, 5]], [['2k', '10k'], ['10k', 8, 5]], [['2k', '1d'], ['2k', 2, 5]], [['1d', '2k'], ['2k', 2, 5]], [['6d', '1k'], ['1k', 6, 5]]], [[['2k', '4k'], ['4k', 2, 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]], [['3d', '4k'], ['4k', 6, 5]], [['2k', '1d'], ['2k', 2, 5]]], [[['2k', '3d'], ['2k', 4, 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]], [['6d', '3k'], ['3k', 8, 5]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"handicap case %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"b1dd415bc300b6f53f8698853f75a4b9592b2175c89b3c6d69421600f9823cf2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def val(s):\n        if len(s) < 2 or not s[:-1].isdigit():\n            return None\n        k = int(s[:-1])\n        if s[-1] == 'k' and 1 <= k <= 30:\n            return -k\n        if s[-1] == 'd' and 1 <= k <= 9:\n            return k\n        return None\n    a, b = x\n    va, vb = val(a), val(b)\n    if va is None or vb is None:\n        return 'invalid'\n    diff = abs(va - vb)\n    weaker = a if va < vb else b\n    if diff == 0:\n        return [a, 0, 65]\n    if diff == 1:\n        return [weaker, 0, 5]\n    return [weaker, min(diff, 9), 5]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[['20k', '1d'], ['20k', 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]], [['3k', '2d'], ['3k', 4, 5]], [['1k', '9d'], ['1k', 9, 5]]], [[['10k', '8k'], ['10k', 2, 5]], [['10k', '6d'], ['10k', 9, 5]], [['5k', '1k'], ['5k', 4, 5]], [['5k', '0k'], 'invalid'], [['5k', 'k'], 'invalid'], [['3k', '2d'], ['3k', 4, 5]], [['2k', '1d'], ['2k', 2, 5]], [['5d', '3k'], ['3k', 7, 5]]], [[['3k', '5d'], ['3k', 7, 5]], [['3k', '9d'], ['3k', 9, 5]], [['3k', '0k'], 'invalid'], [['2k', '30k'], ['30k', 9, 5]], [['2k', '10k'], ['10k', 8, 5]], [['2k', '1d'], ['2k', 2, 5]], [['1d', '2k'], ['2k', 2, 5]], [['6d', '1k'], ['1k', 6, 5]]], [[['2k', '4k'], ['4k', 2, 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]], [['3d', '4k'], ['4k', 6, 5]], [['2k', '1d'], ['2k', 2, 5]]], [[['2k', '3d'], ['2k', 4, 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]], [['6d', '3k'], ['3k', 8, 5]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"handicap case %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"63470d326d5ee49489460180b14614178510be6c58a6b82702d701b6de09df2f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def val(s):\n        if len(s) < 2 or not s[:-1].isdigit():\n            return None\n        k = int(s[:-1])\n        if s[-1] == 'k' and 1 <= k <= 30:\n            return 1 - k\n        if s[-1] == 'd' and 1 <= k <= 9:\n            return k\n        return None\n    a, b = x\n    va, vb = val(a), val(b)\n    if va is None or vb is None:\n        return 'invalid'\n    diff = abs(va - vb)\n    weaker = a if va < vb else b\n    if diff == 0:\n        return [a, 0, 65]\n    if diff == 1:\n        return [weaker, 0, 5]\n    return [weaker, min(diff, 9), 5]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[['20k', '1d'], ['20k', 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]], [['3k', '2d'], ['3k', 4, 5]], [['1k', '9d'], ['1k', 9, 5]]], [[['10k', '8k'], ['10k', 2, 5]], [['10k', '6d'], ['10k', 9, 5]], [['5k', '1k'], ['5k', 4, 5]], [['5k', '0k'], 'invalid'], [['5k', 'k'], 'invalid'], [['3k', '2d'], ['3k', 4, 5]], [['2k', '1d'], ['2k', 2, 5]], [['5d', '3k'], ['3k', 7, 5]]], [[['3k', '5d'], ['3k', 7, 5]], [['3k', '9d'], ['3k', 9, 5]], [['3k', '0k'], 'invalid'], [['2k', '30k'], ['30k', 9, 5]], [['2k', '10k'], ['10k', 8, 5]], [['2k', '1d'], ['2k', 2, 5]], [['1d', '2k'], ['2k', 2, 5]], [['6d', '1k'], ['1k', 6, 5]]], [[['2k', '4k'], ['4k', 2, 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]], [['3d', '4k'], ['4k', 6, 5]], [['2k', '1d'], ['2k', 2, 5]]], [[['2k', '3d'], ['2k', 4, 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]], [['6d', '3k'], ['3k', 8, 5]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"handicap case %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-go-territory-scoring-rank-handicap-kyu-dan-boundary","generated_at":"2026-09-29T14:50:19.371561+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Go servers and scoring tools compute this value automatically; a wrong answer changes a game result.","repair":"Map Nk to 1-N and Nd to N.","root_cause":"Kyu ranks map to -k, leaving a phantom rank zero.","sha256":"ba158ab9d6a122ddb11147565c228f0944c803b12613cdb640d143eb793d3545","title":"The 1k to 1d step is counted as two ranks · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.707,"exit_code":1,"observations":[{"actual":["20k",9,5],"check":"handicap case 0","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 1","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 2","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 3","expected":["20k",9,5],"passed":true},{"actual":"invalid","check":"handicap case 4","expected":"invalid","passed":true},{"actual":["10k",5,5],"check":"handicap case 5","expected":["10k",5,5],"passed":true},{"actual":["3k",3,5],"check":"handicap case 6","expected":["3k",4,5],"passed":false},{"actual":["1k",8,5],"check":"handicap case 7","expected":["1k",9,5],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"handicap case 0\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 1\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 2\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 3\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 4\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"handicap case 5\", \"actual\": [\"10k\", 5, 5], \"expected\": [\"10k\", 5, 5], \"passed\": true}, {\"check\": \"handicap case 6\", \"actual\": [\"3k\", 3, 5], \"expected\": [\"3k\", 4, 5], \"passed\": false}, {\"check\": \"handicap case 7\", \"actual\": [\"1k\", 8, 5], \"expected\": [\"1k\", 9, 5], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.431,"exit_code":1,"observations":[{"actual":["20k",9,5],"check":"handicap case 0","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 1","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 2","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 3","expected":["20k",9,5],"passed":true},{"actual":"invalid","check":"handicap case 4","expected":"invalid","passed":true},{"actual":["10k",5,5],"check":"handicap case 5","expected":["10k",5,5],"passed":true},{"actual":["3k",5,5],"check":"handicap case 6","expected":["3k",4,5],"passed":false},{"actual":["1k",9,5],"check":"handicap case 7","expected":["1k",9,5],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"handicap case 0\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 1\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 2\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 3\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 4\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"handicap case 5\", \"actual\": [\"10k\", 5, 5], \"expected\": [\"10k\", 5, 5], \"passed\": true}, {\"check\": \"handicap case 6\", \"actual\": [\"3k\", 5, 5], \"expected\": [\"3k\", 4, 5], \"passed\": false}, {\"check\": \"handicap case 7\", \"actual\": [\"1k\", 9, 5], \"expected\": [\"1k\", 9, 5], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.734,"exit_code":0,"observations":[{"actual":["20k",9,5],"check":"handicap case 0","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 1","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 2","expected":["20k",9,5],"passed":true},{"actual":["20k",9,5],"check":"handicap case 3","expected":["20k",9,5],"passed":true},{"actual":"invalid","check":"handicap case 4","expected":"invalid","passed":true},{"actual":["10k",5,5],"check":"handicap case 5","expected":["10k",5,5],"passed":true},{"actual":["3k",4,5],"check":"handicap case 6","expected":["3k",4,5],"passed":true},{"actual":["1k",9,5],"check":"handicap case 7","expected":["1k",9,5],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"handicap case 0\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 1\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 2\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 3\", \"actual\": [\"20k\", 9, 5], \"expected\": [\"20k\", 9, 5], \"passed\": true}, {\"check\": \"handicap case 4\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"handicap case 5\", \"actual\": [\"10k\", 5, 5], \"expected\": [\"10k\", 5, 5], \"passed\": true}, {\"check\": \"handicap case 6\", \"actual\": [\"3k\", 4, 5], \"expected\": [\"3k\", 4, 5], \"passed\": true}, {\"check\": \"handicap case 7\", \"actual\": [\"1k\", 9, 5], \"expected\": [\"1k\", 9, 5], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}