FA-83986 / Sports scoring and tiebreakers / Open access
Wides counted as legal deliveries · case 01
The over ends after five legal balls when a wide was bowled in it.
ROOT CAUSE
The wide branch increments the legal-ball counter.
VERIFIED REPAIR
Never count a wide as a legal ball.
Unsuccessful approach: Counting only run wides as legal still shortens overs containing a wide that was run.
Case contract
Ball-by-ball innings tally. Events: "0".."6" runs off the bat (legal ball); "W" wicket (legal ball, no runs, the new batter takes strike); "wdK" wide: 1 penalty + K run wides, all extras, not a legal ball, K runs completed; "nbK" no-ball: 1 penalty extra + K runs off the bat, not a legal ball; "bK"/"lbK" byes/leg byes: K extras on a legal ball. Batters change ends when an odd number of runs is completed, and again after the 6th legal ball of an over. Batters are numbered 1, 2 and then 3, 4, ... as they come in; batter 1 starts on strike. Return [total, wickets, overs "O.B", extras, batter on strike].
Why this case matters
Scoring apps derive totals, overs and strike from ball events; extras and strike rotation are error-prone.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
total = wickets = legal = extras = 0
striker, non = 1, 2
next_bat = 3
for e in events:
if e == 'W':
wickets += 1
legal += 1
striker = next_bat
next_bat += 1
ran = 0
elif e.startswith('wd'):
k = int(e[2:] or 0)
total += 1 + k
extras += 1 + k
legal += 1
ran = k
elif e.startswith('nb'):
k = int(e[2:] or 0)
total += 1 + k
extras += 1
ran = k
elif e[0] in 'bl':
k = int(e.lstrip('lb'))
total += k
extras += k
legal += 1
ran = k
else:
k = int(e)
total += k
legal += 1
ran = k
if ran % 2 == 1:
striker, non = non, striker
if e[:2] not in ('wd', 'nb') and legal % 6 == 0:
striker, non = non, striker
return [total, wickets, '%d.%d' % (legal // 6, legal % 6), extras, striker]
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 maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality', (['1', 'lb2', '1', 'wd1'],), [6, 0, '0.3', 4, 2]),
('variant scenario 1',
(['4', '3', 'wd4', '2', 'lb1', '0', 'wd1', '1', '1'],),
[19, 0, '1.1', 8, 1]),
('variant scenario 2', (['nb1', '4', '1', 'wd1', '3', '1', '3'],), [16, 0, '0.5', 3, 1])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality', (['W', 'b4', 'b4', 'wd'],), [9, 1, '0.3', 9, 3]),
('regression: wide legality', (['lb2', 'b1', '4', 'wd1'],), [9, 0, '0.3', 5, 1]),
('variant scenario 1',
(['W', '1', 'b1', 'lb1', 'lb1', '4', '3', '2', '0'],),
[13, 1, '1.3', 3, 3]),
('variant scenario 2',
(['0', '4', 'b1', '1', '0', '1', '1', '0', 'nb4', 'lb1', '2'],),
[16, 0, '1.4', 3, 1])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['wd', '2', '4', '0', '1', 'wd4', 'nb1', '0'],),
[15, 0, '0.5', 7, 1]),
('variant scenario 1', (['1', 'wd', '4'],), [6, 0, '0.2', 1, 2]),
('variant scenario 2',
(['0', 'lb1', '2', '1', '0', 'wd1', '4', 'nb1', 'b1', '3', '1', '0', '2', '0', '0'],),
[19, 0, '2.1', 5, 2])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['4', '0', '0', '6', '1', 'nb', '0', '0', '1', 'wd', 'b1'],),
[15, 0, '1.3', 3, 1]),
('regression: wide legality',
(['2',
'2',
'wd1',
'nb1',
'wd1',
'1',
'nb',
'lb1',
'1',
'nb4',
'0',
'2',
'lb2',
'0',
'nb',
'1',
'wd4',
'1'],),
[31, 0, '1.5', 16, 2]),
('variant scenario 1',
(['0', 'W', '1', '6', '0', '0', '2', '4', '4', '2', 'lb1', 'b4', 'nb4', '1', '0'],),
[30, 1, '2.2', 6, 2]),
('variant scenario 2',
(['1', '3', '4', '0', '0', '0', 'lb2', '1', 'nb4', '0', '4', 'nb', '3'],),
[24, 0, '1.5', 4, 2])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['1',
'nb',
'0',
'3',
'2',
'b4',
'wd1',
'0',
'0',
'0',
'0',
'nb1',
'wd',
'wd1',
'2',
'nb',
'0',
'0',
'0',
'0',
'1',
'2',
'3',
'4',
'2',
'1'],),
[34, 0, '3.2', 12, 2]),
('variant scenario 1',
(['nb4',
'0',
'b1',
'0',
'0',
'0',
'0',
'wd4',
'2',
'1',
'4',
'2',
'0',
'nb',
'b4',
'2',
'1',
'nb',
'wd1',
'wd1',
'6',
'6',
'nb'],),
[46, 0, '2.4', 18, 2]),
('variant scenario 2',
(['6',
'1',
'nb1',
'wd4',
'4',
'0',
'0',
'1',
'2',
'nb4',
'2',
'0',
'0',
'wd',
'2',
'1',
'nb4',
'4',
'4',
'2',
'b1',
'0',
'W',
'1',
'wd1'],),
[51, 1, '3.1', 12, 1])]]
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 maiden over | [0, 0, '1.0', 0, 2] | [0, 0, '1.0', 0, 2] | Passed |
| boundary single rotates strike | [1, 0, '0.1', 0, 2] | [1, 0, '0.1', 0, 2] | Passed |
| boundary wide is not a legal ball | [5, 0, '0.2', 1, 1] | [5, 0, '0.1', 1, 1] | Failed |
| control no-ball boundary | [5, 0, '0.0', 1, 1] | [5, 0, '0.0', 1, 1] | Passed |
| boundary wicket brings new striker | [0, 1, '0.2', 0, 3] | [0, 1, '0.2', 0, 3] | Passed |
| control leg byes | [3, 0, '0.2', 1, 2] | [3, 0, '0.2', 1, 2] | Passed |
| regression: wide legality | [6, 0, '0.4', 4, 2] | [6, 0, '0.3', 4, 2] | Failed |
| variant scenario 1 | [19, 0, '1.3', 8, 1] | [19, 0, '1.1', 8, 1] | Failed |
| variant scenario 2 | [16, 0, '1.0', 3, 2] | [16, 0, '0.5', 3, 1] | Failed |
SHA-256 / 24e0ab67d406e88dcc9314fa63dd5fbb3d5f13f507d09739f1e1860637bc234d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
total = wickets = legal = extras = 0
striker, non = 1, 2
next_bat = 3
for e in events:
if e == 'W':
wickets += 1
legal += 1
striker = next_bat
next_bat += 1
ran = 0
elif e.startswith('wd'):
k = int(e[2:] or 0)
total += 1 + k
extras += 1 + k
legal += 1 if k else 0
ran = k
elif e.startswith('nb'):
k = int(e[2:] or 0)
total += 1 + k
extras += 1
ran = k
elif e[0] in 'bl':
k = int(e.lstrip('lb'))
total += k
extras += k
legal += 1
ran = k
else:
k = int(e)
total += k
legal += 1
ran = k
if ran % 2 == 1:
striker, non = non, striker
if e[:2] not in ('wd', 'nb') and legal % 6 == 0:
striker, non = non, striker
return [total, wickets, '%d.%d' % (legal // 6, legal % 6), extras, striker]
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 maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality', (['1', 'lb2', '1', 'wd1'],), [6, 0, '0.3', 4, 2]),
('variant scenario 1',
(['4', '3', 'wd4', '2', 'lb1', '0', 'wd1', '1', '1'],),
[19, 0, '1.1', 8, 1]),
('variant scenario 2', (['nb1', '4', '1', 'wd1', '3', '1', '3'],), [16, 0, '0.5', 3, 1])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality', (['W', 'b4', 'b4', 'wd'],), [9, 1, '0.3', 9, 3]),
('regression: wide legality', (['lb2', 'b1', '4', 'wd1'],), [9, 0, '0.3', 5, 1]),
('variant scenario 1',
(['W', '1', 'b1', 'lb1', 'lb1', '4', '3', '2', '0'],),
[13, 1, '1.3', 3, 3]),
('variant scenario 2',
(['0', '4', 'b1', '1', '0', '1', '1', '0', 'nb4', 'lb1', '2'],),
[16, 0, '1.4', 3, 1])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['wd', '2', '4', '0', '1', 'wd4', 'nb1', '0'],),
[15, 0, '0.5', 7, 1]),
('variant scenario 1', (['1', 'wd', '4'],), [6, 0, '0.2', 1, 2]),
('variant scenario 2',
(['0', 'lb1', '2', '1', '0', 'wd1', '4', 'nb1', 'b1', '3', '1', '0', '2', '0', '0'],),
[19, 0, '2.1', 5, 2])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['4', '0', '0', '6', '1', 'nb', '0', '0', '1', 'wd', 'b1'],),
[15, 0, '1.3', 3, 1]),
('regression: wide legality',
(['2',
'2',
'wd1',
'nb1',
'wd1',
'1',
'nb',
'lb1',
'1',
'nb4',
'0',
'2',
'lb2',
'0',
'nb',
'1',
'wd4',
'1'],),
[31, 0, '1.5', 16, 2]),
('variant scenario 1',
(['0', 'W', '1', '6', '0', '0', '2', '4', '4', '2', 'lb1', 'b4', 'nb4', '1', '0'],),
[30, 1, '2.2', 6, 2]),
('variant scenario 2',
(['1', '3', '4', '0', '0', '0', 'lb2', '1', 'nb4', '0', '4', 'nb', '3'],),
[24, 0, '1.5', 4, 2])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['1',
'nb',
'0',
'3',
'2',
'b4',
'wd1',
'0',
'0',
'0',
'0',
'nb1',
'wd',
'wd1',
'2',
'nb',
'0',
'0',
'0',
'0',
'1',
'2',
'3',
'4',
'2',
'1'],),
[34, 0, '3.2', 12, 2]),
('variant scenario 1',
(['nb4',
'0',
'b1',
'0',
'0',
'0',
'0',
'wd4',
'2',
'1',
'4',
'2',
'0',
'nb',
'b4',
'2',
'1',
'nb',
'wd1',
'wd1',
'6',
'6',
'nb'],),
[46, 0, '2.4', 18, 2]),
('variant scenario 2',
(['6',
'1',
'nb1',
'wd4',
'4',
'0',
'0',
'1',
'2',
'nb4',
'2',
'0',
'0',
'wd',
'2',
'1',
'nb4',
'4',
'4',
'2',
'b1',
'0',
'W',
'1',
'wd1'],),
[51, 1, '3.1', 12, 1])]]
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 maiden over | [0, 0, '1.0', 0, 2] | [0, 0, '1.0', 0, 2] | Passed |
| boundary single rotates strike | [1, 0, '0.1', 0, 2] | [1, 0, '0.1', 0, 2] | Passed |
| boundary wide is not a legal ball | [5, 0, '0.1', 1, 1] | [5, 0, '0.1', 1, 1] | Passed |
| control no-ball boundary | [5, 0, '0.0', 1, 1] | [5, 0, '0.0', 1, 1] | Passed |
| boundary wicket brings new striker | [0, 1, '0.2', 0, 3] | [0, 1, '0.2', 0, 3] | Passed |
| control leg byes | [3, 0, '0.2', 1, 2] | [3, 0, '0.2', 1, 2] | Passed |
| regression: wide legality | [6, 0, '0.4', 4, 2] | [6, 0, '0.3', 4, 2] | Failed |
| variant scenario 1 | [19, 0, '1.3', 8, 1] | [19, 0, '1.1', 8, 1] | Failed |
| variant scenario 2 | [16, 0, '1.0', 3, 2] | [16, 0, '0.5', 3, 1] | Failed |
SHA-256 / 9914b59d37caff516269f47222973cc3ded432cd50bb4e2347b9f60ed9aaff04
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
total = wickets = legal = extras = 0
striker, non = 1, 2
next_bat = 3
for e in events:
if e == 'W':
wickets += 1
legal += 1
striker = next_bat
next_bat += 1
ran = 0
elif e.startswith('wd'):
k = int(e[2:] or 0)
total += 1 + k
extras += 1 + k
ran = k
elif e.startswith('nb'):
k = int(e[2:] or 0)
total += 1 + k
extras += 1
ran = k
elif e[0] in 'bl':
k = int(e.lstrip('lb'))
total += k
extras += k
legal += 1
ran = k
else:
k = int(e)
total += k
legal += 1
ran = k
if ran % 2 == 1:
striker, non = non, striker
if e[:2] not in ('wd', 'nb') and legal % 6 == 0:
striker, non = non, striker
return [total, wickets, '%d.%d' % (legal // 6, legal % 6), extras, striker]
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 maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality', (['1', 'lb2', '1', 'wd1'],), [6, 0, '0.3', 4, 2]),
('variant scenario 1',
(['4', '3', 'wd4', '2', 'lb1', '0', 'wd1', '1', '1'],),
[19, 0, '1.1', 8, 1]),
('variant scenario 2', (['nb1', '4', '1', 'wd1', '3', '1', '3'],), [16, 0, '0.5', 3, 1])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality', (['W', 'b4', 'b4', 'wd'],), [9, 1, '0.3', 9, 3]),
('regression: wide legality', (['lb2', 'b1', '4', 'wd1'],), [9, 0, '0.3', 5, 1]),
('variant scenario 1',
(['W', '1', 'b1', 'lb1', 'lb1', '4', '3', '2', '0'],),
[13, 1, '1.3', 3, 3]),
('variant scenario 2',
(['0', '4', 'b1', '1', '0', '1', '1', '0', 'nb4', 'lb1', '2'],),
[16, 0, '1.4', 3, 1])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['wd', '2', '4', '0', '1', 'wd4', 'nb1', '0'],),
[15, 0, '0.5', 7, 1]),
('variant scenario 1', (['1', 'wd', '4'],), [6, 0, '0.2', 1, 2]),
('variant scenario 2',
(['0', 'lb1', '2', '1', '0', 'wd1', '4', 'nb1', 'b1', '3', '1', '0', '2', '0', '0'],),
[19, 0, '2.1', 5, 2])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['4', '0', '0', '6', '1', 'nb', '0', '0', '1', 'wd', 'b1'],),
[15, 0, '1.3', 3, 1]),
('regression: wide legality',
(['2',
'2',
'wd1',
'nb1',
'wd1',
'1',
'nb',
'lb1',
'1',
'nb4',
'0',
'2',
'lb2',
'0',
'nb',
'1',
'wd4',
'1'],),
[31, 0, '1.5', 16, 2]),
('variant scenario 1',
(['0', 'W', '1', '6', '0', '0', '2', '4', '4', '2', 'lb1', 'b4', 'nb4', '1', '0'],),
[30, 1, '2.2', 6, 2]),
('variant scenario 2',
(['1', '3', '4', '0', '0', '0', 'lb2', '1', 'nb4', '0', '4', 'nb', '3'],),
[24, 0, '1.5', 4, 2])],
[('control maiden over', (['0', '0', '0', '0', '0', '0'],), [0, 0, '1.0', 0, 2]),
('boundary single rotates strike', (['1'],), [1, 0, '0.1', 0, 2]),
('boundary wide is not a legal ball', (['wd', '4'],), [5, 0, '0.1', 1, 1]),
('control no-ball boundary', (['nb4'],), [5, 0, '0.0', 1, 1]),
('boundary wicket brings new striker', (['W', '0'],), [0, 1, '0.2', 0, 3]),
('control leg byes', (['lb1', '2'],), [3, 0, '0.2', 1, 2]),
('regression: wide legality',
(['1',
'nb',
'0',
'3',
'2',
'b4',
'wd1',
'0',
'0',
'0',
'0',
'nb1',
'wd',
'wd1',
'2',
'nb',
'0',
'0',
'0',
'0',
'1',
'2',
'3',
'4',
'2',
'1'],),
[34, 0, '3.2', 12, 2]),
('variant scenario 1',
(['nb4',
'0',
'b1',
'0',
'0',
'0',
'0',
'wd4',
'2',
'1',
'4',
'2',
'0',
'nb',
'b4',
'2',
'1',
'nb',
'wd1',
'wd1',
'6',
'6',
'nb'],),
[46, 0, '2.4', 18, 2]),
('variant scenario 2',
(['6',
'1',
'nb1',
'wd4',
'4',
'0',
'0',
'1',
'2',
'nb4',
'2',
'0',
'0',
'wd',
'2',
'1',
'nb4',
'4',
'4',
'2',
'b1',
'0',
'W',
'1',
'wd1'],),
[51, 1, '3.1', 12, 1])]]
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 maiden over | [0, 0, '1.0', 0, 2] | [0, 0, '1.0', 0, 2] | Passed |
| boundary single rotates strike | [1, 0, '0.1', 0, 2] | [1, 0, '0.1', 0, 2] | Passed |
| boundary wide is not a legal ball | [5, 0, '0.1', 1, 1] | [5, 0, '0.1', 1, 1] | Passed |
| control no-ball boundary | [5, 0, '0.0', 1, 1] | [5, 0, '0.0', 1, 1] | Passed |
| boundary wicket brings new striker | [0, 1, '0.2', 0, 3] | [0, 1, '0.2', 0, 3] | Passed |
| control leg byes | [3, 0, '0.2', 1, 2] | [3, 0, '0.2', 1, 2] | Passed |
| regression: wide legality | [6, 0, '0.3', 4, 2] | [6, 0, '0.3', 4, 2] | Passed |
| variant scenario 1 | [19, 0, '1.1', 8, 1] | [19, 0, '1.1', 8, 1] | Passed |
| variant scenario 2 | [16, 0, '0.5', 3, 1] | [16, 0, '0.5', 3, 1] | Passed |
SHA-256 / 168d1eb611723dcfb219ee1c816344fee63d4f1a7230f98bc8237f775abfc7b9
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:26.584370+00:00.
Case digest / 81b1b55384a372db2e65857aef4adeb6722f0db04c80b3d867a8b81af5c376ee