FA-83871 / Sports scoring and tiebreakers / Open access
Tiebreak server rotation is off by one point · case 01
The server indicator shows the wrong player after the first point of a tiebreak.
ROOT CAUSE
The rotation groups points as 0-1, 2-3 instead of 0, 1-2, 3-4.
VERIFIED REPAIR
Use ((played + 1) // 2) % 2 so the first server serves only the opening point.
Unsuccessful approach: Alternating the server on every point matches only the first two points.
Case contract
Tiebreak game. points is a string of A/B point winners; target is 7 (standard) or 10 (match tiebreak). The tiebreak ends at the first point where a player has at least target points and a two-point lead; later points are ignored. first_server serves point 0, then serve alternates every two points (point k is served by first_server when ((k + 1) // 2) is even). Return [a, b, winner or None, server of the next point or None when finished, ends_change] where ends_change is true when the tiebreak is unfinished and a positive multiple of 6 points has been played.
Why this case matters
Chair-umpire scoring software must drive the server indicator and change-of-ends prompt during tiebreaks.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(points, first_server, target):
def finished(x, y):
return max(x, y) >= target and abs(x - y) >= 2
a = b = 0
for p in points:
if p == 'A':
a += 1
else:
b += 1
if finished(a, b):
break
played = a + b
winner = None
if finished(a, b):
winner = 'A' if a > b else 'B'
other = 'B' if first_server == 'A' else 'A'
server = first_server if (played // 2) % 2 == 0 else other
ends_change = played > 0 and played % 6 == 0 and winner is None
return [a, b, winner, None if winner else server, ends_change]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
try:
return solve(*args)
except Exception as exc:
return 'raised ' + type(exc).__name__
cases = [[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('BAABAAABB', 'B', 7), [5, 4, None, 'A', False]),
('regression: service rotation phase', ('BABAAA', 'B', 7), [4, 2, None, 'A', True]),
('variant scenario 1', ('BBAABBBABBBB', 'B', 7), [3, 7, 'B', None, False]),
('variant scenario 2', ('AAAB', 'A', 7), [3, 1, None, 'A', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('ABBAAAA', 'B', 10), [5, 2, None, 'B', False]),
('variant scenario 1', ('AABBAAABABAAABB', 'A', 7), [7, 4, 'A', None, False]),
('variant scenario 2', ('BBBB', 'B', 7), [0, 4, None, 'B', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('AAAAAA', 'B', 7), [6, 0, None, 'A', True]),
('regression: service rotation phase', ('BBABB', 'B', 7), [1, 4, None, 'A', False]),
('variant scenario 1', ('BBABBA', 'A', 7), [2, 4, None, 'B', True]),
('variant scenario 2', ('BAB', 'B', 7), [1, 2, None, 'B', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('BAABBAABBBABAAA', 'B', 10), [8, 7, None, 'B', False]),
('variant scenario 1', ('BBABAAABAABB', 'B', 7), [6, 6, None, 'B', True]),
('variant scenario 2', ('ABAAABBBBBAAAAABBABAB', 'A', 7), [8, 6, 'A', None, False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('AABABBABAABBAB', 'A', 10), [7, 7, None, 'B', False]),
('regression: service rotation phase', ('BABBB', 'A', 7), [1, 4, None, 'B', False]),
('variant scenario 1', ('BAAABBBBBAABBBAABAABAB', 'A', 10), [7, 10, 'B', None, False]),
('variant scenario 2', ('BBAAABBBABBBA', 'B', 7), [4, 7, 'B', None, False])]]
for label, args, expected in cases[N - 1]:
check(label, run(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 |
|---|---|---|---|
| control opening point | [0, 0, None, 'A', False] | [0, 0, None, 'A', False] | Passed |
| boundary second server pair | [1, 0, None, 'A', False] | [1, 0, None, 'B', False] | Failed |
| boundary third point back to first | [1, 1, None, 'A', False] | [1, 1, None, 'A', False] | Passed |
| control seven-five tiebreak | [7, 5, 'A', None, False] | [7, 5, 'A', None, False] | Passed |
| boundary change of ends at six | [3, 3, None, 'B', True] | [3, 3, None, 'B', True] | Passed |
| control match tiebreak not over at seven | [7, 0, None, 'A', False] | [7, 0, None, 'B', False] | Failed |
| regression: service rotation phase | [5, 4, None, 'B', False] | [5, 4, None, 'A', False] | Failed |
| regression: service rotation phase | [4, 2, None, 'A', True] | [4, 2, None, 'A', True] | Passed |
| variant scenario 1 | [3, 7, 'B', None, False] | [3, 7, 'B', None, False] | Passed |
| variant scenario 2 | [3, 1, None, 'A', False] | [3, 1, None, 'A', False] | Passed |
SHA-256 / aee638ffb733e422abf83dae867a9b877ac68fec290f75baecfde664c552a27c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(points, first_server, target):
def finished(x, y):
return max(x, y) >= target and abs(x - y) >= 2
a = b = 0
for p in points:
if p == 'A':
a += 1
else:
b += 1
if finished(a, b):
break
played = a + b
winner = None
if finished(a, b):
winner = 'A' if a > b else 'B'
other = 'B' if first_server == 'A' else 'A'
server = first_server if played % 2 == 0 else other
ends_change = played > 0 and played % 6 == 0 and winner is None
return [a, b, winner, None if winner else server, ends_change]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
try:
return solve(*args)
except Exception as exc:
return 'raised ' + type(exc).__name__
cases = [[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('BAABAAABB', 'B', 7), [5, 4, None, 'A', False]),
('regression: service rotation phase', ('BABAAA', 'B', 7), [4, 2, None, 'A', True]),
('variant scenario 1', ('BBAABBBABBBB', 'B', 7), [3, 7, 'B', None, False]),
('variant scenario 2', ('AAAB', 'A', 7), [3, 1, None, 'A', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('ABBAAAA', 'B', 10), [5, 2, None, 'B', False]),
('variant scenario 1', ('AABBAAABABAAABB', 'A', 7), [7, 4, 'A', None, False]),
('variant scenario 2', ('BBBB', 'B', 7), [0, 4, None, 'B', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('AAAAAA', 'B', 7), [6, 0, None, 'A', True]),
('regression: service rotation phase', ('BBABB', 'B', 7), [1, 4, None, 'A', False]),
('variant scenario 1', ('BBABBA', 'A', 7), [2, 4, None, 'B', True]),
('variant scenario 2', ('BAB', 'B', 7), [1, 2, None, 'B', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('BAABBAABBBABAAA', 'B', 10), [8, 7, None, 'B', False]),
('variant scenario 1', ('BBABAAABAABB', 'B', 7), [6, 6, None, 'B', True]),
('variant scenario 2', ('ABAAABBBBBAAAAABBABAB', 'A', 7), [8, 6, 'A', None, False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('AABABBABAABBAB', 'A', 10), [7, 7, None, 'B', False]),
('regression: service rotation phase', ('BABBB', 'A', 7), [1, 4, None, 'B', False]),
('variant scenario 1', ('BAAABBBBBAABBBAABAABAB', 'A', 10), [7, 10, 'B', None, False]),
('variant scenario 2', ('BBAAABBBABBBA', 'B', 7), [4, 7, 'B', None, False])]]
for label, args, expected in cases[N - 1]:
check(label, run(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 |
|---|---|---|---|
| control opening point | [0, 0, None, 'A', False] | [0, 0, None, 'A', False] | Passed |
| boundary second server pair | [1, 0, None, 'B', False] | [1, 0, None, 'B', False] | Passed |
| boundary third point back to first | [1, 1, None, 'B', False] | [1, 1, None, 'A', False] | Failed |
| control seven-five tiebreak | [7, 5, 'A', None, False] | [7, 5, 'A', None, False] | Passed |
| boundary change of ends at six | [3, 3, None, 'A', True] | [3, 3, None, 'B', True] | Failed |
| control match tiebreak not over at seven | [7, 0, None, 'A', False] | [7, 0, None, 'B', False] | Failed |
| regression: service rotation phase | [5, 4, None, 'A', False] | [5, 4, None, 'A', False] | Passed |
| regression: service rotation phase | [4, 2, None, 'B', True] | [4, 2, None, 'A', True] | Failed |
| variant scenario 1 | [3, 7, 'B', None, False] | [3, 7, 'B', None, False] | Passed |
| variant scenario 2 | [3, 1, None, 'A', False] | [3, 1, None, 'A', False] | Passed |
SHA-256 / b0bf38bfc42591b8d194c7c723d8873c8b2bd683d7573fd19578a1e6190a7df6
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(points, first_server, target):
def finished(x, y):
return max(x, y) >= target and abs(x - y) >= 2
a = b = 0
for p in points:
if p == 'A':
a += 1
else:
b += 1
if finished(a, b):
break
played = a + b
winner = None
if finished(a, b):
winner = 'A' if a > b else 'B'
other = 'B' if first_server == 'A' else 'A'
server = first_server if ((played + 1) // 2) % 2 == 0 else other
ends_change = played > 0 and played % 6 == 0 and winner is None
return [a, b, winner, None if winner else server, ends_change]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
try:
return solve(*args)
except Exception as exc:
return 'raised ' + type(exc).__name__
cases = [[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('BAABAAABB', 'B', 7), [5, 4, None, 'A', False]),
('regression: service rotation phase', ('BABAAA', 'B', 7), [4, 2, None, 'A', True]),
('variant scenario 1', ('BBAABBBABBBB', 'B', 7), [3, 7, 'B', None, False]),
('variant scenario 2', ('AAAB', 'A', 7), [3, 1, None, 'A', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('ABBAAAA', 'B', 10), [5, 2, None, 'B', False]),
('variant scenario 1', ('AABBAAABABAAABB', 'A', 7), [7, 4, 'A', None, False]),
('variant scenario 2', ('BBBB', 'B', 7), [0, 4, None, 'B', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('AAAAAA', 'B', 7), [6, 0, None, 'A', True]),
('regression: service rotation phase', ('BBABB', 'B', 7), [1, 4, None, 'A', False]),
('variant scenario 1', ('BBABBA', 'A', 7), [2, 4, None, 'B', True]),
('variant scenario 2', ('BAB', 'B', 7), [1, 2, None, 'B', False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('BAABBAABBBABAAA', 'B', 10), [8, 7, None, 'B', False]),
('variant scenario 1', ('BBABAAABAABB', 'B', 7), [6, 6, None, 'B', True]),
('variant scenario 2', ('ABAAABBBBBAAAAABBABAB', 'A', 7), [8, 6, 'A', None, False])],
[('control opening point', ('', 'A', 7), [0, 0, None, 'A', False]),
('boundary second server pair', ('A', 'A', 7), [1, 0, None, 'B', False]),
('boundary third point back to first', ('AB', 'B', 7), [1, 1, None, 'A', False]),
('control seven-five tiebreak', ('AAAAABBBBBAA', 'A', 7), [7, 5, 'A', None, False]),
('boundary change of ends at six', ('ABABAB', 'A', 7), [3, 3, None, 'B', True]),
('control match tiebreak not over at seven', ('AAAAAAA', 'B', 10), [7, 0, None, 'B', False]),
('regression: service rotation phase', ('AABABBABAABBAB', 'A', 10), [7, 7, None, 'B', False]),
('regression: service rotation phase', ('BABBB', 'A', 7), [1, 4, None, 'B', False]),
('variant scenario 1', ('BAAABBBBBAABBBAABAABAB', 'A', 10), [7, 10, 'B', None, False]),
('variant scenario 2', ('BBAAABBBABBBA', 'B', 7), [4, 7, 'B', None, False])]]
for label, args, expected in cases[N - 1]:
check(label, run(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 |
|---|---|---|---|
| control opening point | [0, 0, None, 'A', False] | [0, 0, None, 'A', False] | Passed |
| boundary second server pair | [1, 0, None, 'B', False] | [1, 0, None, 'B', False] | Passed |
| boundary third point back to first | [1, 1, None, 'A', False] | [1, 1, None, 'A', False] | Passed |
| control seven-five tiebreak | [7, 5, 'A', None, False] | [7, 5, 'A', None, False] | Passed |
| boundary change of ends at six | [3, 3, None, 'B', True] | [3, 3, None, 'B', True] | Passed |
| control match tiebreak not over at seven | [7, 0, None, 'B', False] | [7, 0, None, 'B', False] | Passed |
| regression: service rotation phase | [5, 4, None, 'A', False] | [5, 4, None, 'A', False] | Passed |
| regression: service rotation phase | [4, 2, None, 'A', True] | [4, 2, None, 'A', True] | Passed |
| variant scenario 1 | [3, 7, 'B', None, False] | [3, 7, 'B', None, False] | Passed |
| variant scenario 2 | [3, 1, None, 'A', False] | [3, 1, None, 'A', False] | Passed |
SHA-256 / f39ef3157e9b12a6da46753948c21e80eb33b5a88d61f5c426428c659ec939db
Verification & scope
Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any governing body rulebook or operator house rules. 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:25.693801+00:00.
Case digest / 170c43d4521fb2eac8ccaedadba7efaa6e79bd11718bce3f8a92bca099e1ab61