FA-84051 / Sports scoring and tiebreakers / Open access
Losing bonus granted to winners or drawn sides · case 01
Drawn and winning teams collect a losing bonus point.
ROOT CAUSE
The losing bonus only checks the margin, not that the team lost.
VERIFIED REPAIR
Require s < o before checking the margin.
Unsuccessful approach: Allowing s <= o still awards a losing bonus for a draw.
Case contract
Rugby union league points. results rows are [team, tries, score, opponent, opp_tries, opp_score]. Win 4 points, draw 2, loss 0. A try bonus point is earned by any team scoring 4 or more tries, and a losing bonus point by a team that loses by 7 points or fewer (both can apply to a loser). Rank by points, then wins, then points difference, then name. Return [team, points, wins, points difference] rows for teams that appear.
Why this case matters
Bonus-point tables are tight; each threshold changes qualification.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(results):
table = {}
for t1, tr1, s1, t2, tr2, s2 in results:
for team, tries, s, o in ((t1, tr1, s1, s2), (t2, tr2, s2, s1)):
row = table.setdefault(team, [0, 0, 0])
if s > o:
row[0] += 4
row[1] += 1
elif s == o:
row[0] += 2
if tries >= 4:
row[0] += 1
if o - s <= 7:
row[0] += 1
row[2] += s - o
order = sorted(table, key=lambda t: (-table[t][0], -table[t][1], -table[t][2], t))
return [[t] + table[t] for t in order]
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 plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Leeds', 1, 24, 'Wasps', 4, 3],
['Bath', 3, 30, 'Wasps', 6, 3],
['Leeds', 0, 15, 'Wasps', 5, 30],
['Wasps', 3, 22, 'Bath', 2, 7],
['Sale', 5, 7, 'Bath', 3, 5]],),
[['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]]),
('regression: losing bonus result guard',
([['Leeds', 2, 7, 'Wasps', 0, 5],
['Bath', 4, 17, 'Sale', 6, 17],
['Sale', 3, 15, 'Leeds', 1, 24],
['Wasps', 0, 30, 'Leeds', 5, 20],
['Leeds', 0, 3, 'Wasps', 2, 30]],),
[['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]]),
('variant scenario 1',
([['Bath', 2, 20, 'Sale', 1, 24],
['Wasps', 1, 30, 'Leeds', 1, 3],
['Leeds', 2, 15, 'Bath', 5, 12],
['Bath', 0, 22, 'Leeds', 4, 7],
['Bath', 1, 30, 'Leeds', 1, 20]],),
[['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]]),
('variant scenario 2',
([['Wasps', 6, 15, 'Sale', 2, 5], ['Leeds', 3, 20, 'Bath', 0, 17]],),
[['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Sale', 1, 24, 'Bath', 5, 5], ['Bath', 2, 15, 'Sale', 6, 5]],),
[['Sale', 5, 1, 9], ['Bath', 5, 1, -9]]),
('regression: losing bonus result guard',
([['Leeds', 4, 12, 'Wasps', 2, 12],
['Wasps', 5, 22, 'Sale', 2, 17],
['Wasps', 2, 30, 'Leeds', 4, 24]],),
[['Wasps', 11, 2, 11], ['Leeds', 5, 0, -6], ['Sale', 1, 0, -5]]),
('variant scenario 1',
([['Sale', 6, 20, 'Bath', 6, 22],
['Leeds', 1, 22, 'Wasps', 1, 20],
['Wasps', 0, 17, 'Bath', 3, 10],
['Leeds', 6, 15, 'Bath', 3, 30],
['Leeds', 3, 33, 'Bath', 5, 22],
['Wasps', 2, 3, 'Sale', 1, 5]],),
[['Bath', 11, 2, -1], ['Leeds', 9, 2, -2], ['Wasps', 6, 1, 3], ['Sale', 6, 1, 0]]),
('variant scenario 2',
([['Wasps', 1, 27, 'Sale', 0, 24],
['Leeds', 1, 24, 'Bath', 1, 15],
['Sale', 4, 10, 'Bath', 2, 27]],),
[['Leeds', 4, 1, 9], ['Bath', 4, 1, 8], ['Wasps', 4, 1, 3], ['Sale', 2, 0, -20]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Wasps', 3, 33, 'Bath', 5, 10],
['Sale', 3, 5, 'Wasps', 5, 15],
['Sale', 1, 22, 'Leeds', 4, 7],
['Sale', 5, 10, 'Wasps', 1, 3],
['Leeds', 0, 10, 'Wasps', 3, 30],
['Leeds', 3, 17, 'Wasps', 4, 27]],),
[['Wasps', 19, 4, 56], ['Sale', 9, 2, 12], ['Bath', 1, 0, -23], ['Leeds', 1, 0, -45]]),
('regression: losing bonus result guard',
([['Wasps', 0, 7, 'Bath', 5, 22],
['Bath', 2, 22, 'Leeds', 5, 27],
['Bath', 3, 5, 'Wasps', 5, 30],
['Bath', 0, 5, 'Wasps', 6, 3],
['Sale', 1, 10, 'Bath', 1, 10],
['Wasps', 5, 15, 'Sale', 2, 10]],),
[['Wasps', 12, 2, 13], ['Bath', 12, 2, -13], ['Leeds', 5, 1, 5], ['Sale', 3, 0, -5]]),
('variant scenario 1',
([['Sale', 5, 24, 'Wasps', 1, 17],
['Sale', 2, 24, 'Wasps', 6, 27],
['Leeds', 2, 24, 'Wasps', 3, 30]],),
[['Wasps', 10, 2, 2], ['Sale', 6, 1, 4], ['Leeds', 1, 0, -6]]),
('variant scenario 2',
([['Leeds', 4, 30, 'Bath', 5, 3],
['Wasps', 3, 5, 'Bath', 6, 30],
['Leeds', 2, 27, 'Wasps', 1, 12],
['Leeds', 3, 17, 'Sale', 1, 7]],),
[['Leeds', 13, 3, 52], ['Bath', 6, 1, -2], ['Sale', 0, 0, -10], ['Wasps', 0, 0, -40]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Bath', 1, 5, 'Leeds', 1, 10],
['Sale', 0, 30, 'Bath', 4, 5],
['Leeds', 3, 5, 'Wasps', 1, 17],
['Bath', 4, 15, 'Leeds', 3, 7],
['Bath', 5, 27, 'Wasps', 0, 7]],),
[['Bath', 12, 2, -2], ['Sale', 4, 1, 25], ['Wasps', 4, 1, -8], ['Leeds', 4, 1, -15]]),
('regression: losing bonus result guard',
([['Wasps', 6, 12, 'Sale', 1, 12],
['Bath', 3, 12, 'Wasps', 1, 24],
['Wasps', 6, 27, 'Bath', 2, 10],
['Bath', 3, 33, 'Wasps', 5, 3]],),
[['Wasps', 13, 2, -1], ['Bath', 4, 1, 1], ['Sale', 2, 0, 0]]),
('variant scenario 1',
([['Leeds', 0, 33, 'Wasps', 5, 30],
['Leeds', 1, 22, 'Sale', 2, 12],
['Leeds', 3, 22, 'Wasps', 0, 10],
['Wasps', 5, 17, 'Bath', 1, 24],
['Wasps', 3, 7, 'Sale', 2, 10],
['Bath', 5, 17, 'Leeds', 3, 3],
['Wasps', 2, 10, 'Leeds', 5, 30],
['Leeds', 4, 12, 'Bath', 2, 30]],),
[['Leeds', 18, 4, 13], ['Bath', 13, 3, 39], ['Wasps', 5, 0, -45], ['Sale', 4, 1, -7]]),
('variant scenario 2',
([['Leeds', 0, 3, 'Bath', 1, 10],
['Sale', 5, 5, 'Wasps', 3, 20],
['Bath', 6, 20, 'Sale', 3, 10],
['Sale', 4, 17, 'Bath', 5, 7],
['Sale', 6, 15, 'Leeds', 0, 10],
['Wasps', 3, 22, 'Bath', 0, 27]],),
[['Bath', 14, 3, 12], ['Sale', 11, 2, -10], ['Wasps', 5, 1, 10], ['Leeds', 2, 0, -12]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Leeds', 3, 20, 'Bath', 1, 22],
['Sale', 1, 3, 'Leeds', 0, 20],
['Wasps', 4, 5, 'Bath', 1, 12],
['Sale', 3, 22, 'Leeds', 0, 20]],),
[['Bath', 8, 2, 9], ['Leeds', 6, 1, 13], ['Sale', 4, 1, -15], ['Wasps', 2, 0, -7]]),
('regression: losing bonus result guard',
([['Leeds', 1, 33, 'Wasps', 6, 27],
['Sale', 3, 7, 'Bath', 3, 30],
['Sale', 0, 5, 'Wasps', 2, 5],
['Leeds', 6, 7, 'Sale', 5, 7],
['Bath', 0, 5, 'Wasps', 4, 10]],),
[['Wasps', 9, 1, -1], ['Leeds', 7, 1, 6], ['Bath', 5, 1, 18], ['Sale', 5, 0, -23]]),
('variant scenario 1',
([['Sale', 1, 22, 'Bath', 1, 3],
['Bath', 0, 15, 'Leeds', 1, 22],
['Wasps', 3, 5, 'Bath', 3, 17],
['Leeds', 5, 12, 'Wasps', 0, 3],
['Sale', 2, 24, 'Bath', 3, 20],
['Sale', 0, 27, 'Leeds', 2, 15],
['Wasps', 6, 20, 'Bath', 6, 24]],),
[['Sale', 12, 3, 35], ['Bath', 11, 2, -14], ['Leeds', 9, 2, 4], ['Wasps', 2, 0, -25]]),
('variant scenario 2',
([['Bath', 2, 33, 'Wasps', 2, 27], ['Bath', 3, 12, 'Leeds', 1, 20]],),
[['Leeds', 4, 1, 8], ['Bath', 4, 1, -2], ['Wasps', 1, 0, -6]])]]
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 plain win | [['Bath', 5, 1, 10], ['Leeds', 0, 0, -10]] | [['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]] | Failed |
| boundary losing by seven | [['Bath', 5, 1, 7], ['Leeds', 1, 0, -7]] | [['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]] | Failed |
| boundary four tries in defeat | [['Bath', 5, 1, 6], ['Leeds', 2, 0, -6]] | [['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]] | Failed |
| control draw | [['Bath', 3, 0, 0], ['Leeds', 3, 0, 0]] | [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]] | Failed |
| boundary losing by eight | [['Sale', 5, 1, 8], ['Wasps', 0, 0, -8]] | [['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]] | Failed |
| regression: losing bonus result guard | [['Wasps', 13, 2, -18], ['Bath', 6, 1, 10], ['Sale', 6, 1, 2], ['Leeds', 5, 1, 6]] | [['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]] | Failed |
| regression: losing bonus result guard | [['Wasps', 11, 2, 35], ['Leeds', 11, 2, -26], ['Bath', 4, 0, 0], ['Sale', 4, 0, -9]] | [['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]] | Failed |
| variant scenario 1 | [['Bath', 13, 2, 18], ['Leeds', 6, 1, -49], ['Wasps', 5, 1, 27], ['Sale', 5, 1, 4]] | [['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]] | Failed |
| variant scenario 2 | [['Wasps', 6, 1, 10], ['Leeds', 5, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]] | [['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]] | Failed |
SHA-256 / cbd62f9afcad064f5651a678ea2e51dc671bf4b168693ba9feec8718d81e6fbd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(results):
table = {}
for t1, tr1, s1, t2, tr2, s2 in results:
for team, tries, s, o in ((t1, tr1, s1, s2), (t2, tr2, s2, s1)):
row = table.setdefault(team, [0, 0, 0])
if s > o:
row[0] += 4
row[1] += 1
elif s == o:
row[0] += 2
if tries >= 4:
row[0] += 1
if s <= o and o - s <= 7:
row[0] += 1
row[2] += s - o
order = sorted(table, key=lambda t: (-table[t][0], -table[t][1], -table[t][2], t))
return [[t] + table[t] for t in order]
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 plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Leeds', 1, 24, 'Wasps', 4, 3],
['Bath', 3, 30, 'Wasps', 6, 3],
['Leeds', 0, 15, 'Wasps', 5, 30],
['Wasps', 3, 22, 'Bath', 2, 7],
['Sale', 5, 7, 'Bath', 3, 5]],),
[['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]]),
('regression: losing bonus result guard',
([['Leeds', 2, 7, 'Wasps', 0, 5],
['Bath', 4, 17, 'Sale', 6, 17],
['Sale', 3, 15, 'Leeds', 1, 24],
['Wasps', 0, 30, 'Leeds', 5, 20],
['Leeds', 0, 3, 'Wasps', 2, 30]],),
[['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]]),
('variant scenario 1',
([['Bath', 2, 20, 'Sale', 1, 24],
['Wasps', 1, 30, 'Leeds', 1, 3],
['Leeds', 2, 15, 'Bath', 5, 12],
['Bath', 0, 22, 'Leeds', 4, 7],
['Bath', 1, 30, 'Leeds', 1, 20]],),
[['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]]),
('variant scenario 2',
([['Wasps', 6, 15, 'Sale', 2, 5], ['Leeds', 3, 20, 'Bath', 0, 17]],),
[['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Sale', 1, 24, 'Bath', 5, 5], ['Bath', 2, 15, 'Sale', 6, 5]],),
[['Sale', 5, 1, 9], ['Bath', 5, 1, -9]]),
('regression: losing bonus result guard',
([['Leeds', 4, 12, 'Wasps', 2, 12],
['Wasps', 5, 22, 'Sale', 2, 17],
['Wasps', 2, 30, 'Leeds', 4, 24]],),
[['Wasps', 11, 2, 11], ['Leeds', 5, 0, -6], ['Sale', 1, 0, -5]]),
('variant scenario 1',
([['Sale', 6, 20, 'Bath', 6, 22],
['Leeds', 1, 22, 'Wasps', 1, 20],
['Wasps', 0, 17, 'Bath', 3, 10],
['Leeds', 6, 15, 'Bath', 3, 30],
['Leeds', 3, 33, 'Bath', 5, 22],
['Wasps', 2, 3, 'Sale', 1, 5]],),
[['Bath', 11, 2, -1], ['Leeds', 9, 2, -2], ['Wasps', 6, 1, 3], ['Sale', 6, 1, 0]]),
('variant scenario 2',
([['Wasps', 1, 27, 'Sale', 0, 24],
['Leeds', 1, 24, 'Bath', 1, 15],
['Sale', 4, 10, 'Bath', 2, 27]],),
[['Leeds', 4, 1, 9], ['Bath', 4, 1, 8], ['Wasps', 4, 1, 3], ['Sale', 2, 0, -20]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Wasps', 3, 33, 'Bath', 5, 10],
['Sale', 3, 5, 'Wasps', 5, 15],
['Sale', 1, 22, 'Leeds', 4, 7],
['Sale', 5, 10, 'Wasps', 1, 3],
['Leeds', 0, 10, 'Wasps', 3, 30],
['Leeds', 3, 17, 'Wasps', 4, 27]],),
[['Wasps', 19, 4, 56], ['Sale', 9, 2, 12], ['Bath', 1, 0, -23], ['Leeds', 1, 0, -45]]),
('regression: losing bonus result guard',
([['Wasps', 0, 7, 'Bath', 5, 22],
['Bath', 2, 22, 'Leeds', 5, 27],
['Bath', 3, 5, 'Wasps', 5, 30],
['Bath', 0, 5, 'Wasps', 6, 3],
['Sale', 1, 10, 'Bath', 1, 10],
['Wasps', 5, 15, 'Sale', 2, 10]],),
[['Wasps', 12, 2, 13], ['Bath', 12, 2, -13], ['Leeds', 5, 1, 5], ['Sale', 3, 0, -5]]),
('variant scenario 1',
([['Sale', 5, 24, 'Wasps', 1, 17],
['Sale', 2, 24, 'Wasps', 6, 27],
['Leeds', 2, 24, 'Wasps', 3, 30]],),
[['Wasps', 10, 2, 2], ['Sale', 6, 1, 4], ['Leeds', 1, 0, -6]]),
('variant scenario 2',
([['Leeds', 4, 30, 'Bath', 5, 3],
['Wasps', 3, 5, 'Bath', 6, 30],
['Leeds', 2, 27, 'Wasps', 1, 12],
['Leeds', 3, 17, 'Sale', 1, 7]],),
[['Leeds', 13, 3, 52], ['Bath', 6, 1, -2], ['Sale', 0, 0, -10], ['Wasps', 0, 0, -40]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Bath', 1, 5, 'Leeds', 1, 10],
['Sale', 0, 30, 'Bath', 4, 5],
['Leeds', 3, 5, 'Wasps', 1, 17],
['Bath', 4, 15, 'Leeds', 3, 7],
['Bath', 5, 27, 'Wasps', 0, 7]],),
[['Bath', 12, 2, -2], ['Sale', 4, 1, 25], ['Wasps', 4, 1, -8], ['Leeds', 4, 1, -15]]),
('regression: losing bonus result guard',
([['Wasps', 6, 12, 'Sale', 1, 12],
['Bath', 3, 12, 'Wasps', 1, 24],
['Wasps', 6, 27, 'Bath', 2, 10],
['Bath', 3, 33, 'Wasps', 5, 3]],),
[['Wasps', 13, 2, -1], ['Bath', 4, 1, 1], ['Sale', 2, 0, 0]]),
('variant scenario 1',
([['Leeds', 0, 33, 'Wasps', 5, 30],
['Leeds', 1, 22, 'Sale', 2, 12],
['Leeds', 3, 22, 'Wasps', 0, 10],
['Wasps', 5, 17, 'Bath', 1, 24],
['Wasps', 3, 7, 'Sale', 2, 10],
['Bath', 5, 17, 'Leeds', 3, 3],
['Wasps', 2, 10, 'Leeds', 5, 30],
['Leeds', 4, 12, 'Bath', 2, 30]],),
[['Leeds', 18, 4, 13], ['Bath', 13, 3, 39], ['Wasps', 5, 0, -45], ['Sale', 4, 1, -7]]),
('variant scenario 2',
([['Leeds', 0, 3, 'Bath', 1, 10],
['Sale', 5, 5, 'Wasps', 3, 20],
['Bath', 6, 20, 'Sale', 3, 10],
['Sale', 4, 17, 'Bath', 5, 7],
['Sale', 6, 15, 'Leeds', 0, 10],
['Wasps', 3, 22, 'Bath', 0, 27]],),
[['Bath', 14, 3, 12], ['Sale', 11, 2, -10], ['Wasps', 5, 1, 10], ['Leeds', 2, 0, -12]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Leeds', 3, 20, 'Bath', 1, 22],
['Sale', 1, 3, 'Leeds', 0, 20],
['Wasps', 4, 5, 'Bath', 1, 12],
['Sale', 3, 22, 'Leeds', 0, 20]],),
[['Bath', 8, 2, 9], ['Leeds', 6, 1, 13], ['Sale', 4, 1, -15], ['Wasps', 2, 0, -7]]),
('regression: losing bonus result guard',
([['Leeds', 1, 33, 'Wasps', 6, 27],
['Sale', 3, 7, 'Bath', 3, 30],
['Sale', 0, 5, 'Wasps', 2, 5],
['Leeds', 6, 7, 'Sale', 5, 7],
['Bath', 0, 5, 'Wasps', 4, 10]],),
[['Wasps', 9, 1, -1], ['Leeds', 7, 1, 6], ['Bath', 5, 1, 18], ['Sale', 5, 0, -23]]),
('variant scenario 1',
([['Sale', 1, 22, 'Bath', 1, 3],
['Bath', 0, 15, 'Leeds', 1, 22],
['Wasps', 3, 5, 'Bath', 3, 17],
['Leeds', 5, 12, 'Wasps', 0, 3],
['Sale', 2, 24, 'Bath', 3, 20],
['Sale', 0, 27, 'Leeds', 2, 15],
['Wasps', 6, 20, 'Bath', 6, 24]],),
[['Sale', 12, 3, 35], ['Bath', 11, 2, -14], ['Leeds', 9, 2, 4], ['Wasps', 2, 0, -25]]),
('variant scenario 2',
([['Bath', 2, 33, 'Wasps', 2, 27], ['Bath', 3, 12, 'Leeds', 1, 20]],),
[['Leeds', 4, 1, 8], ['Bath', 4, 1, -2], ['Wasps', 1, 0, -6]])]]
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 plain win | [['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]] | [['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]] | Passed |
| boundary losing by seven | [['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]] | [['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]] | Passed |
| boundary four tries in defeat | [['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]] | [['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]] | Passed |
| control draw | [['Bath', 3, 0, 0], ['Leeds', 3, 0, 0]] | [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]] | Failed |
| boundary losing by eight | [['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]] | [['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]] | Passed |
| regression: losing bonus result guard | [['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]] | [['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]] | Passed |
| regression: losing bonus result guard | [['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 4, 0, 0], ['Sale', 4, 0, -9]] | [['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]] | Failed |
| variant scenario 1 | [['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]] | [['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]] | Passed |
| variant scenario 2 | [['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]] | [['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]] | Passed |
SHA-256 / 17e8d4544b8f23e63b9f9ca63ebaa1326aef605a7dca3129bad03e3f9e05a0cb
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(results):
table = {}
for t1, tr1, s1, t2, tr2, s2 in results:
for team, tries, s, o in ((t1, tr1, s1, s2), (t2, tr2, s2, s1)):
row = table.setdefault(team, [0, 0, 0])
if s > o:
row[0] += 4
row[1] += 1
elif s == o:
row[0] += 2
if tries >= 4:
row[0] += 1
if s < o and o - s <= 7:
row[0] += 1
row[2] += s - o
order = sorted(table, key=lambda t: (-table[t][0], -table[t][1], -table[t][2], t))
return [[t] + table[t] for t in order]
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 plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Leeds', 1, 24, 'Wasps', 4, 3],
['Bath', 3, 30, 'Wasps', 6, 3],
['Leeds', 0, 15, 'Wasps', 5, 30],
['Wasps', 3, 22, 'Bath', 2, 7],
['Sale', 5, 7, 'Bath', 3, 5]],),
[['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]]),
('regression: losing bonus result guard',
([['Leeds', 2, 7, 'Wasps', 0, 5],
['Bath', 4, 17, 'Sale', 6, 17],
['Sale', 3, 15, 'Leeds', 1, 24],
['Wasps', 0, 30, 'Leeds', 5, 20],
['Leeds', 0, 3, 'Wasps', 2, 30]],),
[['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]]),
('variant scenario 1',
([['Bath', 2, 20, 'Sale', 1, 24],
['Wasps', 1, 30, 'Leeds', 1, 3],
['Leeds', 2, 15, 'Bath', 5, 12],
['Bath', 0, 22, 'Leeds', 4, 7],
['Bath', 1, 30, 'Leeds', 1, 20]],),
[['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]]),
('variant scenario 2',
([['Wasps', 6, 15, 'Sale', 2, 5], ['Leeds', 3, 20, 'Bath', 0, 17]],),
[['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Sale', 1, 24, 'Bath', 5, 5], ['Bath', 2, 15, 'Sale', 6, 5]],),
[['Sale', 5, 1, 9], ['Bath', 5, 1, -9]]),
('regression: losing bonus result guard',
([['Leeds', 4, 12, 'Wasps', 2, 12],
['Wasps', 5, 22, 'Sale', 2, 17],
['Wasps', 2, 30, 'Leeds', 4, 24]],),
[['Wasps', 11, 2, 11], ['Leeds', 5, 0, -6], ['Sale', 1, 0, -5]]),
('variant scenario 1',
([['Sale', 6, 20, 'Bath', 6, 22],
['Leeds', 1, 22, 'Wasps', 1, 20],
['Wasps', 0, 17, 'Bath', 3, 10],
['Leeds', 6, 15, 'Bath', 3, 30],
['Leeds', 3, 33, 'Bath', 5, 22],
['Wasps', 2, 3, 'Sale', 1, 5]],),
[['Bath', 11, 2, -1], ['Leeds', 9, 2, -2], ['Wasps', 6, 1, 3], ['Sale', 6, 1, 0]]),
('variant scenario 2',
([['Wasps', 1, 27, 'Sale', 0, 24],
['Leeds', 1, 24, 'Bath', 1, 15],
['Sale', 4, 10, 'Bath', 2, 27]],),
[['Leeds', 4, 1, 9], ['Bath', 4, 1, 8], ['Wasps', 4, 1, 3], ['Sale', 2, 0, -20]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Wasps', 3, 33, 'Bath', 5, 10],
['Sale', 3, 5, 'Wasps', 5, 15],
['Sale', 1, 22, 'Leeds', 4, 7],
['Sale', 5, 10, 'Wasps', 1, 3],
['Leeds', 0, 10, 'Wasps', 3, 30],
['Leeds', 3, 17, 'Wasps', 4, 27]],),
[['Wasps', 19, 4, 56], ['Sale', 9, 2, 12], ['Bath', 1, 0, -23], ['Leeds', 1, 0, -45]]),
('regression: losing bonus result guard',
([['Wasps', 0, 7, 'Bath', 5, 22],
['Bath', 2, 22, 'Leeds', 5, 27],
['Bath', 3, 5, 'Wasps', 5, 30],
['Bath', 0, 5, 'Wasps', 6, 3],
['Sale', 1, 10, 'Bath', 1, 10],
['Wasps', 5, 15, 'Sale', 2, 10]],),
[['Wasps', 12, 2, 13], ['Bath', 12, 2, -13], ['Leeds', 5, 1, 5], ['Sale', 3, 0, -5]]),
('variant scenario 1',
([['Sale', 5, 24, 'Wasps', 1, 17],
['Sale', 2, 24, 'Wasps', 6, 27],
['Leeds', 2, 24, 'Wasps', 3, 30]],),
[['Wasps', 10, 2, 2], ['Sale', 6, 1, 4], ['Leeds', 1, 0, -6]]),
('variant scenario 2',
([['Leeds', 4, 30, 'Bath', 5, 3],
['Wasps', 3, 5, 'Bath', 6, 30],
['Leeds', 2, 27, 'Wasps', 1, 12],
['Leeds', 3, 17, 'Sale', 1, 7]],),
[['Leeds', 13, 3, 52], ['Bath', 6, 1, -2], ['Sale', 0, 0, -10], ['Wasps', 0, 0, -40]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Bath', 1, 5, 'Leeds', 1, 10],
['Sale', 0, 30, 'Bath', 4, 5],
['Leeds', 3, 5, 'Wasps', 1, 17],
['Bath', 4, 15, 'Leeds', 3, 7],
['Bath', 5, 27, 'Wasps', 0, 7]],),
[['Bath', 12, 2, -2], ['Sale', 4, 1, 25], ['Wasps', 4, 1, -8], ['Leeds', 4, 1, -15]]),
('regression: losing bonus result guard',
([['Wasps', 6, 12, 'Sale', 1, 12],
['Bath', 3, 12, 'Wasps', 1, 24],
['Wasps', 6, 27, 'Bath', 2, 10],
['Bath', 3, 33, 'Wasps', 5, 3]],),
[['Wasps', 13, 2, -1], ['Bath', 4, 1, 1], ['Sale', 2, 0, 0]]),
('variant scenario 1',
([['Leeds', 0, 33, 'Wasps', 5, 30],
['Leeds', 1, 22, 'Sale', 2, 12],
['Leeds', 3, 22, 'Wasps', 0, 10],
['Wasps', 5, 17, 'Bath', 1, 24],
['Wasps', 3, 7, 'Sale', 2, 10],
['Bath', 5, 17, 'Leeds', 3, 3],
['Wasps', 2, 10, 'Leeds', 5, 30],
['Leeds', 4, 12, 'Bath', 2, 30]],),
[['Leeds', 18, 4, 13], ['Bath', 13, 3, 39], ['Wasps', 5, 0, -45], ['Sale', 4, 1, -7]]),
('variant scenario 2',
([['Leeds', 0, 3, 'Bath', 1, 10],
['Sale', 5, 5, 'Wasps', 3, 20],
['Bath', 6, 20, 'Sale', 3, 10],
['Sale', 4, 17, 'Bath', 5, 7],
['Sale', 6, 15, 'Leeds', 0, 10],
['Wasps', 3, 22, 'Bath', 0, 27]],),
[['Bath', 14, 3, 12], ['Sale', 11, 2, -10], ['Wasps', 5, 1, 10], ['Leeds', 2, 0, -12]])],
[('control plain win',
([['Bath', 2, 20, 'Leeds', 1, 10]],),
[['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]]),
('boundary losing by seven',
([['Bath', 1, 17, 'Leeds', 2, 10]],),
[['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]]),
('boundary four tries in defeat',
([['Bath', 3, 30, 'Leeds', 4, 24]],),
[['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]]),
('control draw', ([['Bath', 1, 10, 'Leeds', 1, 10]],), [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]]),
('boundary losing by eight',
([['Sale', 2, 18, 'Wasps', 1, 10]],),
[['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]]),
('regression: losing bonus result guard',
([['Leeds', 3, 20, 'Bath', 1, 22],
['Sale', 1, 3, 'Leeds', 0, 20],
['Wasps', 4, 5, 'Bath', 1, 12],
['Sale', 3, 22, 'Leeds', 0, 20]],),
[['Bath', 8, 2, 9], ['Leeds', 6, 1, 13], ['Sale', 4, 1, -15], ['Wasps', 2, 0, -7]]),
('regression: losing bonus result guard',
([['Leeds', 1, 33, 'Wasps', 6, 27],
['Sale', 3, 7, 'Bath', 3, 30],
['Sale', 0, 5, 'Wasps', 2, 5],
['Leeds', 6, 7, 'Sale', 5, 7],
['Bath', 0, 5, 'Wasps', 4, 10]],),
[['Wasps', 9, 1, -1], ['Leeds', 7, 1, 6], ['Bath', 5, 1, 18], ['Sale', 5, 0, -23]]),
('variant scenario 1',
([['Sale', 1, 22, 'Bath', 1, 3],
['Bath', 0, 15, 'Leeds', 1, 22],
['Wasps', 3, 5, 'Bath', 3, 17],
['Leeds', 5, 12, 'Wasps', 0, 3],
['Sale', 2, 24, 'Bath', 3, 20],
['Sale', 0, 27, 'Leeds', 2, 15],
['Wasps', 6, 20, 'Bath', 6, 24]],),
[['Sale', 12, 3, 35], ['Bath', 11, 2, -14], ['Leeds', 9, 2, 4], ['Wasps', 2, 0, -25]]),
('variant scenario 2',
([['Bath', 2, 33, 'Wasps', 2, 27], ['Bath', 3, 12, 'Leeds', 1, 20]],),
[['Leeds', 4, 1, 8], ['Bath', 4, 1, -2], ['Wasps', 1, 0, -6]])]]
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 plain win | [['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]] | [['Bath', 4, 1, 10], ['Leeds', 0, 0, -10]] | Passed |
| boundary losing by seven | [['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]] | [['Bath', 4, 1, 7], ['Leeds', 1, 0, -7]] | Passed |
| boundary four tries in defeat | [['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]] | [['Bath', 4, 1, 6], ['Leeds', 2, 0, -6]] | Passed |
| control draw | [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]] | [['Bath', 2, 0, 0], ['Leeds', 2, 0, 0]] | Passed |
| boundary losing by eight | [['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]] | [['Sale', 4, 1, 8], ['Wasps', 0, 0, -8]] | Passed |
| regression: losing bonus result guard | [['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]] | [['Wasps', 11, 2, -18], ['Bath', 5, 1, 10], ['Sale', 5, 1, 2], ['Leeds', 4, 1, 6]] | Passed |
| regression: losing bonus result guard | [['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]] | [['Wasps', 9, 2, 35], ['Leeds', 9, 2, -26], ['Bath', 3, 0, 0], ['Sale', 3, 0, -9]] | Passed |
| variant scenario 1 | [['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]] | [['Bath', 11, 2, 18], ['Leeds', 5, 1, -49], ['Wasps', 4, 1, 27], ['Sale', 4, 1, 4]] | Passed |
| variant scenario 2 | [['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]] | [['Wasps', 5, 1, 10], ['Leeds', 4, 1, 3], ['Bath', 1, 0, -3], ['Sale', 0, 0, -10]] | Passed |
SHA-256 / a817e89aa518408ccce01ccd59ba31e2ca18aef0f986a839493d20eea55fdf76
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:27.214907+00:00.
Case digest / 1516f5073e47baecf3682e8987d3fbd21408f52c9f0b869eed3da3fd59bec417