FAILURE MAP
← Case archive

FA-84056 / Sports scoring and tiebreakers / Open access

Points difference ranked ahead of wins · case 01

Teams level on points are ordered by points difference instead of wins.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The sort key compares points difference before wins.

VERIFIED REPAIR

Order by points, wins, points difference, name.

Unsuccessful approach: Keeping wins second but sorting points difference ascending ranks the weaker side first.

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 s < o and o - s <= 7:
                row[0] += 1
            row[2] += s - o
    order = sorted(table, key=lambda t: (-table[t][0], -table[t][2], -table[t][1], 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: table tiebreak order',
   ([['Sale', 1, 10, 'Wasps', 5, 15], ['Bath', 3, 17, 'Leeds', 4, 5]],),
   [['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]]),
  ('regression: table tiebreak order',
   ([['Wasps', 6, 27, 'Sale', 0, 27],
     ['Sale', 0, 5, 'Bath', 2, 12],
     ['Bath', 2, 7, 'Sale', 4, 3],
     ['Wasps', 5, 33, 'Sale', 4, 10]],),
   [['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]]),
  ('variant scenario 1',
   ([['Bath', 5, 3, 'Leeds', 3, 3],
     ['Wasps', 2, 3, 'Bath', 4, 27],
     ['Wasps', 0, 3, 'Sale', 4, 7],
     ['Leeds', 5, 33, 'Wasps', 0, 17]],),
   [['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]]),
  ('variant scenario 2',
   ([['Bath', 0, 5, 'Sale', 3, 12],
     ['Wasps', 0, 12, 'Leeds', 6, 27],
     ['Wasps', 2, 5, 'Leeds', 0, 12],
     ['Sale', 1, 10, 'Leeds', 5, 30]],),
   [['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]])],
 [('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: table tiebreak order',
   ([['Wasps', 1, 10, 'Bath', 0, 17], ['Bath', 4, 7, 'Sale', 4, 24]],),
   [['Sale', 5, 1, 17], ['Bath', 5, 1, -10], ['Wasps', 1, 0, -7]]),
  ('regression: table tiebreak order',
   ([['Sale', 0, 3, 'Wasps', 1, 5],
     ['Bath', 6, 15, 'Leeds', 3, 27],
     ['Sale', 6, 7, 'Bath', 2, 7],
     ['Bath', 3, 27, 'Wasps', 0, 17],
     ['Wasps', 3, 7, 'Leeds', 3, 17]],),
   [['Leeds', 8, 2, 22], ['Bath', 7, 1, -2], ['Wasps', 4, 1, -18], ['Sale', 4, 0, -2]]),
  ('variant scenario 1',
   ([['Wasps', 4, 7, 'Leeds', 3, 30],
     ['Leeds', 4, 20, 'Sale', 2, 3],
     ['Sale', 0, 7, 'Leeds', 1, 17],
     ['Bath', 4, 3, 'Sale', 0, 20],
     ['Sale', 5, 10, 'Bath', 6, 17],
     ['Sale', 2, 12, 'Bath', 2, 5]],),
   [['Leeds', 13, 3, 50], ['Sale', 10, 2, -10], ['Bath', 7, 1, -17], ['Wasps', 1, 0, -23]]),
  ('variant scenario 2',
   ([['Wasps', 5, 5, 'Bath', 0, 12],
     ['Sale', 4, 27, 'Bath', 5, 27],
     ['Sale', 1, 3, 'Wasps', 3, 24]],),
   [['Bath', 7, 1, 7], ['Wasps', 6, 1, 14], ['Sale', 3, 0, -21]])],
 [('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: table tiebreak order',
   ([['Leeds', 6, 30, 'Wasps', 6, 27],
     ['Wasps', 3, 5, 'Leeds', 6, 10],
     ['Sale', 6, 10, 'Bath', 6, 10]],),
   [['Leeds', 10, 2, 8], ['Bath', 3, 0, 0], ['Sale', 3, 0, 0], ['Wasps', 3, 0, -8]]),
  ('regression: table tiebreak order',
   ([['Sale', 5, 33, 'Bath', 0, 7],
     ['Wasps', 3, 7, 'Bath', 3, 24],
     ['Wasps', 2, 27, 'Bath', 1, 17],
     ['Bath', 4, 24, 'Sale', 2, 22],
     ['Bath', 5, 20, 'Wasps', 0, 24],
     ['Sale', 3, 5, 'Bath', 0, 7],
     ['Leeds', 0, 30, 'Sale', 5, 17]],),
   [['Bath', 15, 3, -19], ['Wasps', 8, 2, -3], ['Sale', 8, 1, 9], ['Leeds', 4, 1, 13]]),
  ('variant scenario 1',
   ([['Leeds', 6, 22, 'Sale', 2, 27],
     ['Leeds', 1, 20, 'Wasps', 6, 24],
     ['Sale', 3, 33, 'Bath', 4, 24],
     ['Wasps', 0, 24, 'Leeds', 6, 17],
     ['Leeds', 6, 15, 'Wasps', 5, 17],
     ['Wasps', 2, 24, 'Sale', 3, 3]],),
   [['Wasps', 18, 4, 34], ['Sale', 8, 2, -7], ['Leeds', 7, 0, -18], ['Bath', 1, 0, -9]]),
  ('variant scenario 2',
   ([['Wasps', 3, 7, 'Sale', 3, 5], ['Sale', 0, 30, 'Wasps', 0, 30]],),
   [['Wasps', 6, 1, 2], ['Sale', 3, 0, -2]])],
 [('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: table tiebreak order',
   ([['Leeds', 2, 7, 'Bath', 2, 27],
     ['Sale', 5, 30, 'Bath', 3, 12],
     ['Sale', 3, 15, 'Leeds', 5, 30],
     ['Bath', 2, 10, 'Sale', 2, 27],
     ['Bath', 4, 5, 'Wasps', 6, 22]],),
   [['Sale', 9, 2, 20], ['Wasps', 5, 1, 17], ['Leeds', 5, 1, -5], ['Bath', 5, 1, -32]]),
  ('regression: table tiebreak order',
   ([['Bath', 5, 5, 'Wasps', 3, 7],
     ['Sale', 0, 30, 'Wasps', 0, 27],
     ['Wasps', 1, 33, 'Bath', 5, 22],
     ['Wasps', 4, 12, 'Bath', 3, 7],
     ['Sale', 3, 7, 'Bath', 5, 27],
     ['Sale', 4, 22, 'Wasps', 5, 5]],),
   [['Wasps', 15, 3, -2], ['Sale', 9, 2, 0], ['Bath', 9, 1, 2]]),
  ('variant scenario 1',
   ([['Bath', 4, 3, 'Wasps', 1, 7],
     ['Bath', 6, 30, 'Sale', 3, 15],
     ['Sale', 1, 12, 'Bath', 2, 10],
     ['Bath', 3, 12, 'Wasps', 4, 17]],),
   [['Wasps', 9, 2, 9], ['Bath', 9, 1, 4], ['Sale', 4, 1, -13]]),
  ('variant scenario 2',
   ([['Leeds', 5, 12, 'Sale', 6, 22],
     ['Wasps', 6, 3, 'Sale', 1, 15],
     ['Sale', 3, 33, 'Leeds', 2, 7],
     ['Bath', 0, 30, 'Leeds', 4, 17],
     ['Sale', 1, 33, 'Bath', 1, 27],
     ['Leeds', 5, 15, 'Bath', 2, 22],
     ['Wasps', 1, 12, 'Sale', 2, 15]],),
   [['Sale', 21, 5, 57], ['Bath', 9, 2, 14], ['Leeds', 4, 0, -56], ['Wasps', 2, 0, -15]])],
 [('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: table tiebreak order',
   ([['Leeds', 5, 3, 'Wasps', 4, 24], ['Bath', 3, 10, 'Sale', 6, 20]],),
   [['Wasps', 5, 1, 21], ['Sale', 5, 1, 10], ['Leeds', 1, 0, -21], ['Bath', 0, 0, -10]]),
  ('regression: table tiebreak order',
   ([['Bath', 4, 17, 'Sale', 0, 30],
     ['Wasps', 2, 5, 'Sale', 0, 17],
     ['Wasps', 1, 22, 'Leeds', 2, 3],
     ['Bath', 1, 22, 'Sale', 3, 22],
     ['Wasps', 2, 3, 'Leeds', 3, 24],
     ['Bath', 3, 20, 'Wasps', 0, 20],
     ['Bath', 5, 33, 'Sale', 2, 7]],),
   [['Sale', 10, 2, -1], ['Bath', 10, 1, 13], ['Wasps', 6, 1, -14], ['Leeds', 4, 1, 2]]),
  ('variant scenario 1',
   ([['Leeds', 5, 15, 'Bath', 4, 10],
     ['Bath', 1, 22, 'Wasps', 2, 7],
     ['Wasps', 6, 22, 'Sale', 4, 27],
     ['Bath', 4, 12, 'Sale', 1, 27],
     ['Leeds', 1, 15, 'Sale', 1, 24],
     ['Leeds', 5, 30, 'Wasps', 4, 5]],),
   [['Sale', 13, 3, 29], ['Leeds', 10, 2, 21], ['Bath', 7, 1, -5], ['Wasps', 3, 0, -45]]),
  ('variant scenario 2',
   ([['Leeds', 0, 33, 'Wasps', 4, 30],
     ['Wasps', 3, 22, 'Sale', 6, 12],
     ['Wasps', 3, 20, 'Bath', 5, 27]],),
   [['Wasps', 7, 1, 0], ['Bath', 5, 1, 7], ['Leeds', 4, 1, 3], ['Sale', 1, 0, -10]])]]
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 fixtureActualExpectedOutcome
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: table tiebreak order[['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]][['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]]Passed
regression: table tiebreak order[['Wasps', 8, 1, 23], ['Bath', 8, 2, 11], ['Sale', 6, 0, -34]][['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]]Failed
variant scenario 1[['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]][['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]]Passed
variant scenario 2[['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]][['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]]Passed

SHA-256 / d53884680352fa81cef2edcae0f73283fa7f5a17ad86fef721f064792e1e4ee6

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: table tiebreak order',
   ([['Sale', 1, 10, 'Wasps', 5, 15], ['Bath', 3, 17, 'Leeds', 4, 5]],),
   [['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]]),
  ('regression: table tiebreak order',
   ([['Wasps', 6, 27, 'Sale', 0, 27],
     ['Sale', 0, 5, 'Bath', 2, 12],
     ['Bath', 2, 7, 'Sale', 4, 3],
     ['Wasps', 5, 33, 'Sale', 4, 10]],),
   [['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]]),
  ('variant scenario 1',
   ([['Bath', 5, 3, 'Leeds', 3, 3],
     ['Wasps', 2, 3, 'Bath', 4, 27],
     ['Wasps', 0, 3, 'Sale', 4, 7],
     ['Leeds', 5, 33, 'Wasps', 0, 17]],),
   [['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]]),
  ('variant scenario 2',
   ([['Bath', 0, 5, 'Sale', 3, 12],
     ['Wasps', 0, 12, 'Leeds', 6, 27],
     ['Wasps', 2, 5, 'Leeds', 0, 12],
     ['Sale', 1, 10, 'Leeds', 5, 30]],),
   [['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]])],
 [('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: table tiebreak order',
   ([['Wasps', 1, 10, 'Bath', 0, 17], ['Bath', 4, 7, 'Sale', 4, 24]],),
   [['Sale', 5, 1, 17], ['Bath', 5, 1, -10], ['Wasps', 1, 0, -7]]),
  ('regression: table tiebreak order',
   ([['Sale', 0, 3, 'Wasps', 1, 5],
     ['Bath', 6, 15, 'Leeds', 3, 27],
     ['Sale', 6, 7, 'Bath', 2, 7],
     ['Bath', 3, 27, 'Wasps', 0, 17],
     ['Wasps', 3, 7, 'Leeds', 3, 17]],),
   [['Leeds', 8, 2, 22], ['Bath', 7, 1, -2], ['Wasps', 4, 1, -18], ['Sale', 4, 0, -2]]),
  ('variant scenario 1',
   ([['Wasps', 4, 7, 'Leeds', 3, 30],
     ['Leeds', 4, 20, 'Sale', 2, 3],
     ['Sale', 0, 7, 'Leeds', 1, 17],
     ['Bath', 4, 3, 'Sale', 0, 20],
     ['Sale', 5, 10, 'Bath', 6, 17],
     ['Sale', 2, 12, 'Bath', 2, 5]],),
   [['Leeds', 13, 3, 50], ['Sale', 10, 2, -10], ['Bath', 7, 1, -17], ['Wasps', 1, 0, -23]]),
  ('variant scenario 2',
   ([['Wasps', 5, 5, 'Bath', 0, 12],
     ['Sale', 4, 27, 'Bath', 5, 27],
     ['Sale', 1, 3, 'Wasps', 3, 24]],),
   [['Bath', 7, 1, 7], ['Wasps', 6, 1, 14], ['Sale', 3, 0, -21]])],
 [('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: table tiebreak order',
   ([['Leeds', 6, 30, 'Wasps', 6, 27],
     ['Wasps', 3, 5, 'Leeds', 6, 10],
     ['Sale', 6, 10, 'Bath', 6, 10]],),
   [['Leeds', 10, 2, 8], ['Bath', 3, 0, 0], ['Sale', 3, 0, 0], ['Wasps', 3, 0, -8]]),
  ('regression: table tiebreak order',
   ([['Sale', 5, 33, 'Bath', 0, 7],
     ['Wasps', 3, 7, 'Bath', 3, 24],
     ['Wasps', 2, 27, 'Bath', 1, 17],
     ['Bath', 4, 24, 'Sale', 2, 22],
     ['Bath', 5, 20, 'Wasps', 0, 24],
     ['Sale', 3, 5, 'Bath', 0, 7],
     ['Leeds', 0, 30, 'Sale', 5, 17]],),
   [['Bath', 15, 3, -19], ['Wasps', 8, 2, -3], ['Sale', 8, 1, 9], ['Leeds', 4, 1, 13]]),
  ('variant scenario 1',
   ([['Leeds', 6, 22, 'Sale', 2, 27],
     ['Leeds', 1, 20, 'Wasps', 6, 24],
     ['Sale', 3, 33, 'Bath', 4, 24],
     ['Wasps', 0, 24, 'Leeds', 6, 17],
     ['Leeds', 6, 15, 'Wasps', 5, 17],
     ['Wasps', 2, 24, 'Sale', 3, 3]],),
   [['Wasps', 18, 4, 34], ['Sale', 8, 2, -7], ['Leeds', 7, 0, -18], ['Bath', 1, 0, -9]]),
  ('variant scenario 2',
   ([['Wasps', 3, 7, 'Sale', 3, 5], ['Sale', 0, 30, 'Wasps', 0, 30]],),
   [['Wasps', 6, 1, 2], ['Sale', 3, 0, -2]])],
 [('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: table tiebreak order',
   ([['Leeds', 2, 7, 'Bath', 2, 27],
     ['Sale', 5, 30, 'Bath', 3, 12],
     ['Sale', 3, 15, 'Leeds', 5, 30],
     ['Bath', 2, 10, 'Sale', 2, 27],
     ['Bath', 4, 5, 'Wasps', 6, 22]],),
   [['Sale', 9, 2, 20], ['Wasps', 5, 1, 17], ['Leeds', 5, 1, -5], ['Bath', 5, 1, -32]]),
  ('regression: table tiebreak order',
   ([['Bath', 5, 5, 'Wasps', 3, 7],
     ['Sale', 0, 30, 'Wasps', 0, 27],
     ['Wasps', 1, 33, 'Bath', 5, 22],
     ['Wasps', 4, 12, 'Bath', 3, 7],
     ['Sale', 3, 7, 'Bath', 5, 27],
     ['Sale', 4, 22, 'Wasps', 5, 5]],),
   [['Wasps', 15, 3, -2], ['Sale', 9, 2, 0], ['Bath', 9, 1, 2]]),
  ('variant scenario 1',
   ([['Bath', 4, 3, 'Wasps', 1, 7],
     ['Bath', 6, 30, 'Sale', 3, 15],
     ['Sale', 1, 12, 'Bath', 2, 10],
     ['Bath', 3, 12, 'Wasps', 4, 17]],),
   [['Wasps', 9, 2, 9], ['Bath', 9, 1, 4], ['Sale', 4, 1, -13]]),
  ('variant scenario 2',
   ([['Leeds', 5, 12, 'Sale', 6, 22],
     ['Wasps', 6, 3, 'Sale', 1, 15],
     ['Sale', 3, 33, 'Leeds', 2, 7],
     ['Bath', 0, 30, 'Leeds', 4, 17],
     ['Sale', 1, 33, 'Bath', 1, 27],
     ['Leeds', 5, 15, 'Bath', 2, 22],
     ['Wasps', 1, 12, 'Sale', 2, 15]],),
   [['Sale', 21, 5, 57], ['Bath', 9, 2, 14], ['Leeds', 4, 0, -56], ['Wasps', 2, 0, -15]])],
 [('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: table tiebreak order',
   ([['Leeds', 5, 3, 'Wasps', 4, 24], ['Bath', 3, 10, 'Sale', 6, 20]],),
   [['Wasps', 5, 1, 21], ['Sale', 5, 1, 10], ['Leeds', 1, 0, -21], ['Bath', 0, 0, -10]]),
  ('regression: table tiebreak order',
   ([['Bath', 4, 17, 'Sale', 0, 30],
     ['Wasps', 2, 5, 'Sale', 0, 17],
     ['Wasps', 1, 22, 'Leeds', 2, 3],
     ['Bath', 1, 22, 'Sale', 3, 22],
     ['Wasps', 2, 3, 'Leeds', 3, 24],
     ['Bath', 3, 20, 'Wasps', 0, 20],
     ['Bath', 5, 33, 'Sale', 2, 7]],),
   [['Sale', 10, 2, -1], ['Bath', 10, 1, 13], ['Wasps', 6, 1, -14], ['Leeds', 4, 1, 2]]),
  ('variant scenario 1',
   ([['Leeds', 5, 15, 'Bath', 4, 10],
     ['Bath', 1, 22, 'Wasps', 2, 7],
     ['Wasps', 6, 22, 'Sale', 4, 27],
     ['Bath', 4, 12, 'Sale', 1, 27],
     ['Leeds', 1, 15, 'Sale', 1, 24],
     ['Leeds', 5, 30, 'Wasps', 4, 5]],),
   [['Sale', 13, 3, 29], ['Leeds', 10, 2, 21], ['Bath', 7, 1, -5], ['Wasps', 3, 0, -45]]),
  ('variant scenario 2',
   ([['Leeds', 0, 33, 'Wasps', 4, 30],
     ['Wasps', 3, 22, 'Sale', 6, 12],
     ['Wasps', 3, 20, 'Bath', 5, 27]],),
   [['Wasps', 7, 1, 0], ['Bath', 5, 1, 7], ['Leeds', 4, 1, 3], ['Sale', 1, 0, -10]])]]
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 fixtureActualExpectedOutcome
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: table tiebreak order[['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Leeds', 1, 0, -12], ['Sale', 1, 0, -5]][['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]]Failed
regression: table tiebreak order[['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]][['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]]Passed
variant scenario 1[['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]][['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]]Passed
variant scenario 2[['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Wasps', 1, 0, -22], ['Bath', 1, 0, -7]][['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]]Failed

SHA-256 / 29cd70a3679345c5867b57a9c9796c3d419af0bf604ec7cc366c198bb32c6520

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: table tiebreak order',
   ([['Sale', 1, 10, 'Wasps', 5, 15], ['Bath', 3, 17, 'Leeds', 4, 5]],),
   [['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]]),
  ('regression: table tiebreak order',
   ([['Wasps', 6, 27, 'Sale', 0, 27],
     ['Sale', 0, 5, 'Bath', 2, 12],
     ['Bath', 2, 7, 'Sale', 4, 3],
     ['Wasps', 5, 33, 'Sale', 4, 10]],),
   [['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]]),
  ('variant scenario 1',
   ([['Bath', 5, 3, 'Leeds', 3, 3],
     ['Wasps', 2, 3, 'Bath', 4, 27],
     ['Wasps', 0, 3, 'Sale', 4, 7],
     ['Leeds', 5, 33, 'Wasps', 0, 17]],),
   [['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]]),
  ('variant scenario 2',
   ([['Bath', 0, 5, 'Sale', 3, 12],
     ['Wasps', 0, 12, 'Leeds', 6, 27],
     ['Wasps', 2, 5, 'Leeds', 0, 12],
     ['Sale', 1, 10, 'Leeds', 5, 30]],),
   [['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]])],
 [('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: table tiebreak order',
   ([['Wasps', 1, 10, 'Bath', 0, 17], ['Bath', 4, 7, 'Sale', 4, 24]],),
   [['Sale', 5, 1, 17], ['Bath', 5, 1, -10], ['Wasps', 1, 0, -7]]),
  ('regression: table tiebreak order',
   ([['Sale', 0, 3, 'Wasps', 1, 5],
     ['Bath', 6, 15, 'Leeds', 3, 27],
     ['Sale', 6, 7, 'Bath', 2, 7],
     ['Bath', 3, 27, 'Wasps', 0, 17],
     ['Wasps', 3, 7, 'Leeds', 3, 17]],),
   [['Leeds', 8, 2, 22], ['Bath', 7, 1, -2], ['Wasps', 4, 1, -18], ['Sale', 4, 0, -2]]),
  ('variant scenario 1',
   ([['Wasps', 4, 7, 'Leeds', 3, 30],
     ['Leeds', 4, 20, 'Sale', 2, 3],
     ['Sale', 0, 7, 'Leeds', 1, 17],
     ['Bath', 4, 3, 'Sale', 0, 20],
     ['Sale', 5, 10, 'Bath', 6, 17],
     ['Sale', 2, 12, 'Bath', 2, 5]],),
   [['Leeds', 13, 3, 50], ['Sale', 10, 2, -10], ['Bath', 7, 1, -17], ['Wasps', 1, 0, -23]]),
  ('variant scenario 2',
   ([['Wasps', 5, 5, 'Bath', 0, 12],
     ['Sale', 4, 27, 'Bath', 5, 27],
     ['Sale', 1, 3, 'Wasps', 3, 24]],),
   [['Bath', 7, 1, 7], ['Wasps', 6, 1, 14], ['Sale', 3, 0, -21]])],
 [('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: table tiebreak order',
   ([['Leeds', 6, 30, 'Wasps', 6, 27],
     ['Wasps', 3, 5, 'Leeds', 6, 10],
     ['Sale', 6, 10, 'Bath', 6, 10]],),
   [['Leeds', 10, 2, 8], ['Bath', 3, 0, 0], ['Sale', 3, 0, 0], ['Wasps', 3, 0, -8]]),
  ('regression: table tiebreak order',
   ([['Sale', 5, 33, 'Bath', 0, 7],
     ['Wasps', 3, 7, 'Bath', 3, 24],
     ['Wasps', 2, 27, 'Bath', 1, 17],
     ['Bath', 4, 24, 'Sale', 2, 22],
     ['Bath', 5, 20, 'Wasps', 0, 24],
     ['Sale', 3, 5, 'Bath', 0, 7],
     ['Leeds', 0, 30, 'Sale', 5, 17]],),
   [['Bath', 15, 3, -19], ['Wasps', 8, 2, -3], ['Sale', 8, 1, 9], ['Leeds', 4, 1, 13]]),
  ('variant scenario 1',
   ([['Leeds', 6, 22, 'Sale', 2, 27],
     ['Leeds', 1, 20, 'Wasps', 6, 24],
     ['Sale', 3, 33, 'Bath', 4, 24],
     ['Wasps', 0, 24, 'Leeds', 6, 17],
     ['Leeds', 6, 15, 'Wasps', 5, 17],
     ['Wasps', 2, 24, 'Sale', 3, 3]],),
   [['Wasps', 18, 4, 34], ['Sale', 8, 2, -7], ['Leeds', 7, 0, -18], ['Bath', 1, 0, -9]]),
  ('variant scenario 2',
   ([['Wasps', 3, 7, 'Sale', 3, 5], ['Sale', 0, 30, 'Wasps', 0, 30]],),
   [['Wasps', 6, 1, 2], ['Sale', 3, 0, -2]])],
 [('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: table tiebreak order',
   ([['Leeds', 2, 7, 'Bath', 2, 27],
     ['Sale', 5, 30, 'Bath', 3, 12],
     ['Sale', 3, 15, 'Leeds', 5, 30],
     ['Bath', 2, 10, 'Sale', 2, 27],
     ['Bath', 4, 5, 'Wasps', 6, 22]],),
   [['Sale', 9, 2, 20], ['Wasps', 5, 1, 17], ['Leeds', 5, 1, -5], ['Bath', 5, 1, -32]]),
  ('regression: table tiebreak order',
   ([['Bath', 5, 5, 'Wasps', 3, 7],
     ['Sale', 0, 30, 'Wasps', 0, 27],
     ['Wasps', 1, 33, 'Bath', 5, 22],
     ['Wasps', 4, 12, 'Bath', 3, 7],
     ['Sale', 3, 7, 'Bath', 5, 27],
     ['Sale', 4, 22, 'Wasps', 5, 5]],),
   [['Wasps', 15, 3, -2], ['Sale', 9, 2, 0], ['Bath', 9, 1, 2]]),
  ('variant scenario 1',
   ([['Bath', 4, 3, 'Wasps', 1, 7],
     ['Bath', 6, 30, 'Sale', 3, 15],
     ['Sale', 1, 12, 'Bath', 2, 10],
     ['Bath', 3, 12, 'Wasps', 4, 17]],),
   [['Wasps', 9, 2, 9], ['Bath', 9, 1, 4], ['Sale', 4, 1, -13]]),
  ('variant scenario 2',
   ([['Leeds', 5, 12, 'Sale', 6, 22],
     ['Wasps', 6, 3, 'Sale', 1, 15],
     ['Sale', 3, 33, 'Leeds', 2, 7],
     ['Bath', 0, 30, 'Leeds', 4, 17],
     ['Sale', 1, 33, 'Bath', 1, 27],
     ['Leeds', 5, 15, 'Bath', 2, 22],
     ['Wasps', 1, 12, 'Sale', 2, 15]],),
   [['Sale', 21, 5, 57], ['Bath', 9, 2, 14], ['Leeds', 4, 0, -56], ['Wasps', 2, 0, -15]])],
 [('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: table tiebreak order',
   ([['Leeds', 5, 3, 'Wasps', 4, 24], ['Bath', 3, 10, 'Sale', 6, 20]],),
   [['Wasps', 5, 1, 21], ['Sale', 5, 1, 10], ['Leeds', 1, 0, -21], ['Bath', 0, 0, -10]]),
  ('regression: table tiebreak order',
   ([['Bath', 4, 17, 'Sale', 0, 30],
     ['Wasps', 2, 5, 'Sale', 0, 17],
     ['Wasps', 1, 22, 'Leeds', 2, 3],
     ['Bath', 1, 22, 'Sale', 3, 22],
     ['Wasps', 2, 3, 'Leeds', 3, 24],
     ['Bath', 3, 20, 'Wasps', 0, 20],
     ['Bath', 5, 33, 'Sale', 2, 7]],),
   [['Sale', 10, 2, -1], ['Bath', 10, 1, 13], ['Wasps', 6, 1, -14], ['Leeds', 4, 1, 2]]),
  ('variant scenario 1',
   ([['Leeds', 5, 15, 'Bath', 4, 10],
     ['Bath', 1, 22, 'Wasps', 2, 7],
     ['Wasps', 6, 22, 'Sale', 4, 27],
     ['Bath', 4, 12, 'Sale', 1, 27],
     ['Leeds', 1, 15, 'Sale', 1, 24],
     ['Leeds', 5, 30, 'Wasps', 4, 5]],),
   [['Sale', 13, 3, 29], ['Leeds', 10, 2, 21], ['Bath', 7, 1, -5], ['Wasps', 3, 0, -45]]),
  ('variant scenario 2',
   ([['Leeds', 0, 33, 'Wasps', 4, 30],
     ['Wasps', 3, 22, 'Sale', 6, 12],
     ['Wasps', 3, 20, 'Bath', 5, 27]],),
   [['Wasps', 7, 1, 0], ['Bath', 5, 1, 7], ['Leeds', 4, 1, 3], ['Sale', 1, 0, -10]])]]
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 fixtureActualExpectedOutcome
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: table tiebreak order[['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]][['Wasps', 5, 1, 5], ['Bath', 4, 1, 12], ['Sale', 1, 0, -5], ['Leeds', 1, 0, -12]]Passed
regression: table tiebreak order[['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]][['Bath', 8, 2, 11], ['Wasps', 8, 1, 23], ['Sale', 6, 0, -34]]Passed
variant scenario 1[['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]][['Bath', 8, 1, 24], ['Leeds', 7, 1, 16], ['Sale', 5, 1, 4], ['Wasps', 1, 0, -44]]Passed
variant scenario 2[['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]][['Leeds', 14, 3, 42], ['Sale', 4, 1, -13], ['Bath', 1, 0, -7], ['Wasps', 1, 0, -22]]Passed

SHA-256 / 476f24ee36c795ee84cde4d72f52b0730f852ee9f1e111d0cbfbcc6ff605aa69

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.225443+00:00.

Case digest / b78e79d76646a963564d5e8a3f02461224d7defa4e905b44b6129ad24c00e790