FA-84061 / Sports scoring and tiebreakers / Open access
Overtime losers denied their point · case 01
Teams losing in overtime get zero points while shootout losers get one.
ROOT CAUSE
The loser point is only awarded when the game was decided by shootout.
VERIFIED REPAIR
Award the loser point for any game decided after regulation (OT or SO).
Unsuccessful approach: Awarding it only for OT still leaves shootout losers without their point.
Case contract
Ice hockey standings. games rows are [home, home_goals, away, away_goals, decided, so_winner] with decided in REG, OT, SO; for SO the listed goals are tied and so_winner names the winner. A win is 2 points and an OT or SO loss 1 point. The shootout winner is credited with one extra goal for, the loser one extra goal against. RW counts regulation wins, ROW regulation plus overtime wins (not shootouts). Rank by points, then RW, then ROW, then total wins, then goal difference, then name. Return [team, points, RW, ROW, W, GD].
Why this case matters
Playoff races are often decided by the RW/ROW cascade and the shootout goal convention.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(games):
t = {}
for h, hg, a, ag, decided, so_winner in games:
if decided == 'SO':
if so_winner == h:
hg += 1
else:
ag += 1
for team, f, g in ((h, hg, ag), (a, ag, hg)):
row = t.setdefault(team, {'pts': 0, 'rw': 0, 'row': 0, 'w': 0, 'gd': 0})
row['gd'] += f - g
if f > g:
row['pts'] += 2
row['w'] += 1
if decided == 'REG':
row['rw'] += 1
if decided != 'SO':
row['row'] += 1
elif decided == 'SO':
row['pts'] += 1
order = sorted(t, key=lambda k: (-t[k]['pts'], -t[k]['rw'], -t[k]['row'], -t[k]['w'], -t[k]['gd'], k))
return [[k, t[k]['pts'], t[k]['rw'], t[k]['row'], t[k]['w'], t[k]['gd']] for k 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 regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Bears', 3, 'Lynx', 3, 'SO', 'Bears'],
['Lynx', 4, 'Hawks', 1, 'REG', None],
['Otters', 0, 'Bears', 3, 'REG', None],
['Hawks', 0, 'Otters', 4, 'REG', None],
['Lynx', 5, 'Otters', 3, 'REG', None],
['Lynx', 3, 'Otters', 3, 'SO', 'Lynx']],),
[['Lynx', 7, 2, 2, 3, 5],
['Bears', 4, 1, 1, 2, 4],
['Otters', 3, 1, 1, 1, -2],
['Hawks', 0, 0, 0, 0, -7]]),
('regression: overtime loser point',
([['Otters', 5, 'Hawks', 4, 'OT', None],
['Bears', 0, 'Lynx', 0, 'SO', 'Lynx'],
['Hawks', 3, 'Otters', 5, 'REG', None],
['Hawks', 0, 'Otters', 1, 'REG', None]],),
[['Otters', 6, 2, 3, 3, 4],
['Lynx', 2, 0, 0, 1, 1],
['Bears', 1, 0, 0, 0, -1],
['Hawks', 1, 0, 0, 0, -4]]),
('variant scenario 1',
([['Lynx', 0, 'Hawks', 0, 'SO', 'Lynx'],
['Bears', 1, 'Lynx', 1, 'SO', 'Lynx'],
['Hawks', 4, 'Lynx', 3, 'REG', None],
['Otters', 2, 'Hawks', 2, 'SO', 'Hawks'],
['Bears', 2, 'Hawks', 5, 'REG', None],
['Bears', 0, 'Lynx', 0, 'SO', 'Lynx']],),
[['Hawks', 7, 2, 2, 3, 4],
['Lynx', 6, 0, 0, 3, 2],
['Bears', 2, 0, 0, 0, -5],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Hawks', 2, 'Bears', 2, 'SO', 'Bears'],
['Lynx', 3, 'Otters', 2, 'REG', None],
['Lynx', 2, 'Bears', 4, 'REG', None],
['Otters', 1, 'Bears', 0, 'OT', None]],),
[['Bears', 5, 1, 1, 2, 2],
['Lynx', 2, 1, 1, 1, -1],
['Otters', 2, 0, 1, 1, 0],
['Hawks', 1, 0, 0, 0, -1]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Otters', 3, 'Lynx', 0, 'REG', None],
['Bears', 3, 'Otters', 3, 'SO', 'Bears'],
['Bears', 2, 'Lynx', 0, 'REG', None],
['Bears', 2, 'Otters', 3, 'OT', None],
['Lynx', 4, 'Hawks', 4, 'SO', 'Hawks']],),
[['Otters', 5, 1, 2, 2, 3],
['Bears', 5, 1, 1, 2, 2],
['Hawks', 2, 0, 0, 1, 1],
['Lynx', 1, 0, 0, 0, -6]]),
('variant scenario 1',
([['Bears', 3, 'Hawks', 4, 'REG', None],
['Otters', 1, 'Bears', 1, 'SO', 'Bears'],
['Hawks', 5, 'Lynx', 4, 'OT', None],
['Hawks', 1, 'Bears', 1, 'SO', 'Hawks']],),
[['Hawks', 6, 1, 2, 3, 3],
['Bears', 3, 0, 0, 1, -1],
['Lynx', 1, 0, 0, 0, -1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Lynx', 0, 'Bears', 0, 'SO', 'Bears'],
['Lynx', 4, 'Bears', 0, 'REG', None],
['Hawks', 0, 'Otters', 0, 'SO', 'Hawks'],
['Otters', 3, 'Hawks', 2, 'REG', None],
['Hawks', 4, 'Bears', 5, 'REG', None],
['Lynx', 0, 'Hawks', 0, 'SO', 'Hawks'],
['Lynx', 4, 'Bears', 5, 'OT', None]],),
[['Bears', 6, 1, 2, 3, -1],
['Lynx', 5, 1, 1, 1, 1],
['Hawks', 4, 0, 0, 2, 0],
['Otters', 3, 1, 1, 1, 0]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Lynx', 3, 'Hawks', 4, 'REG', None],
['Bears', 4, 'Otters', 3, 'REG', None],
['Hawks', 3, 'Lynx', 3, 'SO', 'Lynx'],
['Otters', 5, 'Lynx', 1, 'REG', None]],),
[['Hawks', 3, 1, 1, 1, 0],
['Otters', 2, 1, 1, 1, 3],
['Bears', 2, 1, 1, 1, 1],
['Lynx', 2, 0, 0, 1, -4]]),
('regression: overtime loser point',
([['Otters', 2, 'Lynx', 2, 'SO', 'Otters'],
['Hawks', 2, 'Bears', 3, 'OT', None],
['Bears', 0, 'Otters', 1, 'OT', None],
['Otters', 2, 'Hawks', 3, 'REG', None],
['Otters', 4, 'Lynx', 0, 'REG', None]],),
[['Otters', 6, 1, 2, 3, 5],
['Hawks', 3, 1, 1, 1, 0],
['Bears', 3, 0, 1, 1, 0],
['Lynx', 1, 0, 0, 0, -5]]),
('variant scenario 1',
([['Bears', 5, 'Lynx', 0, 'REG', None],
['Otters', 2, 'Bears', 2, 'SO', 'Otters'],
['Bears', 2, 'Hawks', 3, 'OT', None],
['Bears', 5, 'Hawks', 3, 'REG', None],
['Lynx', 2, 'Hawks', 1, 'OT', None]],),
[['Bears', 6, 2, 2, 2, 5],
['Hawks', 3, 0, 1, 1, -2],
['Lynx', 2, 0, 1, 1, -4],
['Otters', 2, 0, 0, 1, 1]]),
('variant scenario 2',
([['Bears', 0, 'Otters', 1, 'REG', None],
['Hawks', 4, 'Lynx', 1, 'REG', None],
['Lynx', 5, 'Otters', 4, 'OT', None]],),
[['Otters', 3, 1, 1, 1, 0],
['Hawks', 2, 1, 1, 1, 3],
['Lynx', 2, 0, 1, 1, -2],
['Bears', 0, 0, 0, 0, -1]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Bears', 3, 'Lynx', 2, 'OT', None],
['Lynx', 4, 'Hawks', 3, 'REG', None],
['Hawks', 5, 'Otters', 4, 'OT', None],
['Lynx', 1, 'Hawks', 1, 'SO', 'Lynx']],),
[['Lynx', 5, 1, 1, 2, 1],
['Hawks', 3, 0, 1, 1, -1],
['Bears', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 1',
([['Bears', 4, 'Lynx', 4, 'SO', 'Lynx'],
['Bears', 5, 'Lynx', 2, 'REG', None],
['Hawks', 2, 'Bears', 2, 'SO', 'Bears'],
['Otters', 0, 'Bears', 1, 'OT', None]],),
[['Bears', 7, 1, 2, 3, 4],
['Lynx', 2, 0, 0, 1, -2],
['Hawks', 1, 0, 0, 0, -1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Bears', 1, 'Otters', 1, 'SO', 'Otters'],
['Bears', 4, 'Lynx', 2, 'REG', None],
['Lynx', 0, 'Bears', 0, 'SO', 'Bears'],
['Otters', 0, 'Hawks', 0, 'SO', 'Hawks'],
['Bears', 2, 'Hawks', 3, 'OT', None],
['Otters', 1, 'Lynx', 2, 'OT', None],
['Lynx', 1, 'Otters', 0, 'REG', None]],),
[['Bears', 6, 1, 1, 2, 1],
['Lynx', 5, 1, 2, 2, -1],
['Hawks', 4, 0, 1, 2, 2],
['Otters', 4, 0, 0, 1, -2]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Otters', 0, 'Bears', 2, 'REG', None],
['Bears', 4, 'Hawks', 5, 'REG', None],
['Otters', 1, 'Hawks', 1, 'SO', 'Otters'],
['Otters', 5, 'Hawks', 2, 'REG', None],
['Hawks', 2, 'Lynx', 1, 'REG', None],
['Lynx', 3, 'Bears', 3, 'SO', 'Bears'],
['Lynx', 3, 'Hawks', 5, 'REG', None],
['Hawks', 0, 'Bears', 3, 'REG', None]],),
[['Hawks', 7, 3, 3, 3, -3],
['Bears', 6, 2, 2, 3, 5],
['Otters', 4, 1, 1, 2, 2],
['Lynx', 1, 0, 0, 0, -4]]),
('regression: overtime loser point',
([['Otters', 3, 'Bears', 0, 'REG', None],
['Lynx', 5, 'Otters', 4, 'REG', None],
['Lynx', 0, 'Bears', 4, 'REG', None],
['Otters', 2, 'Lynx', 3, 'OT', None],
['Otters', 5, 'Lynx', 4, 'OT', None]],),
[['Otters', 5, 1, 2, 2, 2], ['Lynx', 5, 1, 2, 2, -3], ['Bears', 2, 1, 1, 1, 1]]),
('variant scenario 1',
([['Otters', 2, 'Bears', 1, 'REG', None],
['Otters', 3, 'Bears', 3, 'SO', 'Bears'],
['Lynx', 1, 'Hawks', 5, 'REG', None],
['Bears', 4, 'Hawks', 3, 'REG', None],
['Lynx', 1, 'Otters', 3, 'REG', None],
['Lynx', 1, 'Otters', 2, 'REG', None],
['Hawks', 2, 'Otters', 2, 'SO', 'Otters'],
['Hawks', 4, 'Lynx', 2, 'REG', None],
['Bears', 4, 'Lynx', 2, 'REG', None]],),
[['Otters', 9, 3, 3, 4, 4],
['Bears', 6, 2, 2, 3, 3],
['Hawks', 5, 2, 2, 2, 4],
['Lynx', 0, 0, 0, 0, -11]]),
('variant scenario 2',
([['Otters', 3, 'Hawks', 3, 'SO', 'Otters'],
['Hawks', 3, 'Otters', 3, 'SO', 'Hawks'],
['Hawks', 1, 'Otters', 4, 'REG', None],
['Lynx', 4, 'Otters', 2, 'REG', None]],),
[['Otters', 5, 1, 1, 2, 1], ['Hawks', 3, 0, 0, 1, -3], ['Lynx', 2, 1, 1, 1, 2]])]]
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 regulation win | [['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]] | [['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]] | Passed |
| boundary overtime loss point | [['Hawks', 2, 0, 1, 1, 1], ['Bears', 0, 0, 0, 0, -1]] | [['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | Failed |
| boundary shootout goal credit | [['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | [['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | Passed |
| boundary RW breaks tie | [['Bears', 2, 1, 1, 1, 1], ['Hawks', 2, 0, 1, 1, 1], ['Lynx', 0, 0, 0, 0, -1], ['Otters', 0, 0, 0, 0, -1]] | [['Bears', 2, 1, 1, 1, 1], ['Hawks', 2, 0, 1, 1, 1], ['Otters', 1, 0, 0, 0, -1], ['Lynx', 0, 0, 0, 0, -1]] | Failed |
| regression: overtime loser point | [['Lynx', 7, 2, 2, 3, 5], ['Bears', 4, 1, 1, 2, 4], ['Otters', 3, 1, 1, 1, -2], ['Hawks', 0, 0, 0, 0, -7]] | [['Lynx', 7, 2, 2, 3, 5], ['Bears', 4, 1, 1, 2, 4], ['Otters', 3, 1, 1, 1, -2], ['Hawks', 0, 0, 0, 0, -7]] | Passed |
| regression: overtime loser point | [['Otters', 6, 2, 3, 3, 4], ['Lynx', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1], ['Hawks', 0, 0, 0, 0, -4]] | [['Otters', 6, 2, 3, 3, 4], ['Lynx', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1], ['Hawks', 1, 0, 0, 0, -4]] | Failed |
| variant scenario 1 | [['Hawks', 7, 2, 2, 3, 4], ['Lynx', 6, 0, 0, 3, 2], ['Bears', 2, 0, 0, 0, -5], ['Otters', 1, 0, 0, 0, -1]] | [['Hawks', 7, 2, 2, 3, 4], ['Lynx', 6, 0, 0, 3, 2], ['Bears', 2, 0, 0, 0, -5], ['Otters', 1, 0, 0, 0, -1]] | Passed |
| variant scenario 2 | [['Bears', 4, 1, 1, 2, 2], ['Lynx', 2, 1, 1, 1, -1], ['Otters', 2, 0, 1, 1, 0], ['Hawks', 1, 0, 0, 0, -1]] | [['Bears', 5, 1, 1, 2, 2], ['Lynx', 2, 1, 1, 1, -1], ['Otters', 2, 0, 1, 1, 0], ['Hawks', 1, 0, 0, 0, -1]] | Failed |
SHA-256 / df536380f7dc5b8b592fb7683063737d2db9f66b6e40e5629381fec9c3c1842e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(games):
t = {}
for h, hg, a, ag, decided, so_winner in games:
if decided == 'SO':
if so_winner == h:
hg += 1
else:
ag += 1
for team, f, g in ((h, hg, ag), (a, ag, hg)):
row = t.setdefault(team, {'pts': 0, 'rw': 0, 'row': 0, 'w': 0, 'gd': 0})
row['gd'] += f - g
if f > g:
row['pts'] += 2
row['w'] += 1
if decided == 'REG':
row['rw'] += 1
if decided != 'SO':
row['row'] += 1
elif decided == 'OT':
row['pts'] += 1
order = sorted(t, key=lambda k: (-t[k]['pts'], -t[k]['rw'], -t[k]['row'], -t[k]['w'], -t[k]['gd'], k))
return [[k, t[k]['pts'], t[k]['rw'], t[k]['row'], t[k]['w'], t[k]['gd']] for k 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 regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Bears', 3, 'Lynx', 3, 'SO', 'Bears'],
['Lynx', 4, 'Hawks', 1, 'REG', None],
['Otters', 0, 'Bears', 3, 'REG', None],
['Hawks', 0, 'Otters', 4, 'REG', None],
['Lynx', 5, 'Otters', 3, 'REG', None],
['Lynx', 3, 'Otters', 3, 'SO', 'Lynx']],),
[['Lynx', 7, 2, 2, 3, 5],
['Bears', 4, 1, 1, 2, 4],
['Otters', 3, 1, 1, 1, -2],
['Hawks', 0, 0, 0, 0, -7]]),
('regression: overtime loser point',
([['Otters', 5, 'Hawks', 4, 'OT', None],
['Bears', 0, 'Lynx', 0, 'SO', 'Lynx'],
['Hawks', 3, 'Otters', 5, 'REG', None],
['Hawks', 0, 'Otters', 1, 'REG', None]],),
[['Otters', 6, 2, 3, 3, 4],
['Lynx', 2, 0, 0, 1, 1],
['Bears', 1, 0, 0, 0, -1],
['Hawks', 1, 0, 0, 0, -4]]),
('variant scenario 1',
([['Lynx', 0, 'Hawks', 0, 'SO', 'Lynx'],
['Bears', 1, 'Lynx', 1, 'SO', 'Lynx'],
['Hawks', 4, 'Lynx', 3, 'REG', None],
['Otters', 2, 'Hawks', 2, 'SO', 'Hawks'],
['Bears', 2, 'Hawks', 5, 'REG', None],
['Bears', 0, 'Lynx', 0, 'SO', 'Lynx']],),
[['Hawks', 7, 2, 2, 3, 4],
['Lynx', 6, 0, 0, 3, 2],
['Bears', 2, 0, 0, 0, -5],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Hawks', 2, 'Bears', 2, 'SO', 'Bears'],
['Lynx', 3, 'Otters', 2, 'REG', None],
['Lynx', 2, 'Bears', 4, 'REG', None],
['Otters', 1, 'Bears', 0, 'OT', None]],),
[['Bears', 5, 1, 1, 2, 2],
['Lynx', 2, 1, 1, 1, -1],
['Otters', 2, 0, 1, 1, 0],
['Hawks', 1, 0, 0, 0, -1]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Otters', 3, 'Lynx', 0, 'REG', None],
['Bears', 3, 'Otters', 3, 'SO', 'Bears'],
['Bears', 2, 'Lynx', 0, 'REG', None],
['Bears', 2, 'Otters', 3, 'OT', None],
['Lynx', 4, 'Hawks', 4, 'SO', 'Hawks']],),
[['Otters', 5, 1, 2, 2, 3],
['Bears', 5, 1, 1, 2, 2],
['Hawks', 2, 0, 0, 1, 1],
['Lynx', 1, 0, 0, 0, -6]]),
('variant scenario 1',
([['Bears', 3, 'Hawks', 4, 'REG', None],
['Otters', 1, 'Bears', 1, 'SO', 'Bears'],
['Hawks', 5, 'Lynx', 4, 'OT', None],
['Hawks', 1, 'Bears', 1, 'SO', 'Hawks']],),
[['Hawks', 6, 1, 2, 3, 3],
['Bears', 3, 0, 0, 1, -1],
['Lynx', 1, 0, 0, 0, -1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Lynx', 0, 'Bears', 0, 'SO', 'Bears'],
['Lynx', 4, 'Bears', 0, 'REG', None],
['Hawks', 0, 'Otters', 0, 'SO', 'Hawks'],
['Otters', 3, 'Hawks', 2, 'REG', None],
['Hawks', 4, 'Bears', 5, 'REG', None],
['Lynx', 0, 'Hawks', 0, 'SO', 'Hawks'],
['Lynx', 4, 'Bears', 5, 'OT', None]],),
[['Bears', 6, 1, 2, 3, -1],
['Lynx', 5, 1, 1, 1, 1],
['Hawks', 4, 0, 0, 2, 0],
['Otters', 3, 1, 1, 1, 0]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Lynx', 3, 'Hawks', 4, 'REG', None],
['Bears', 4, 'Otters', 3, 'REG', None],
['Hawks', 3, 'Lynx', 3, 'SO', 'Lynx'],
['Otters', 5, 'Lynx', 1, 'REG', None]],),
[['Hawks', 3, 1, 1, 1, 0],
['Otters', 2, 1, 1, 1, 3],
['Bears', 2, 1, 1, 1, 1],
['Lynx', 2, 0, 0, 1, -4]]),
('regression: overtime loser point',
([['Otters', 2, 'Lynx', 2, 'SO', 'Otters'],
['Hawks', 2, 'Bears', 3, 'OT', None],
['Bears', 0, 'Otters', 1, 'OT', None],
['Otters', 2, 'Hawks', 3, 'REG', None],
['Otters', 4, 'Lynx', 0, 'REG', None]],),
[['Otters', 6, 1, 2, 3, 5],
['Hawks', 3, 1, 1, 1, 0],
['Bears', 3, 0, 1, 1, 0],
['Lynx', 1, 0, 0, 0, -5]]),
('variant scenario 1',
([['Bears', 5, 'Lynx', 0, 'REG', None],
['Otters', 2, 'Bears', 2, 'SO', 'Otters'],
['Bears', 2, 'Hawks', 3, 'OT', None],
['Bears', 5, 'Hawks', 3, 'REG', None],
['Lynx', 2, 'Hawks', 1, 'OT', None]],),
[['Bears', 6, 2, 2, 2, 5],
['Hawks', 3, 0, 1, 1, -2],
['Lynx', 2, 0, 1, 1, -4],
['Otters', 2, 0, 0, 1, 1]]),
('variant scenario 2',
([['Bears', 0, 'Otters', 1, 'REG', None],
['Hawks', 4, 'Lynx', 1, 'REG', None],
['Lynx', 5, 'Otters', 4, 'OT', None]],),
[['Otters', 3, 1, 1, 1, 0],
['Hawks', 2, 1, 1, 1, 3],
['Lynx', 2, 0, 1, 1, -2],
['Bears', 0, 0, 0, 0, -1]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Bears', 3, 'Lynx', 2, 'OT', None],
['Lynx', 4, 'Hawks', 3, 'REG', None],
['Hawks', 5, 'Otters', 4, 'OT', None],
['Lynx', 1, 'Hawks', 1, 'SO', 'Lynx']],),
[['Lynx', 5, 1, 1, 2, 1],
['Hawks', 3, 0, 1, 1, -1],
['Bears', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 1',
([['Bears', 4, 'Lynx', 4, 'SO', 'Lynx'],
['Bears', 5, 'Lynx', 2, 'REG', None],
['Hawks', 2, 'Bears', 2, 'SO', 'Bears'],
['Otters', 0, 'Bears', 1, 'OT', None]],),
[['Bears', 7, 1, 2, 3, 4],
['Lynx', 2, 0, 0, 1, -2],
['Hawks', 1, 0, 0, 0, -1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Bears', 1, 'Otters', 1, 'SO', 'Otters'],
['Bears', 4, 'Lynx', 2, 'REG', None],
['Lynx', 0, 'Bears', 0, 'SO', 'Bears'],
['Otters', 0, 'Hawks', 0, 'SO', 'Hawks'],
['Bears', 2, 'Hawks', 3, 'OT', None],
['Otters', 1, 'Lynx', 2, 'OT', None],
['Lynx', 1, 'Otters', 0, 'REG', None]],),
[['Bears', 6, 1, 1, 2, 1],
['Lynx', 5, 1, 2, 2, -1],
['Hawks', 4, 0, 1, 2, 2],
['Otters', 4, 0, 0, 1, -2]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Otters', 0, 'Bears', 2, 'REG', None],
['Bears', 4, 'Hawks', 5, 'REG', None],
['Otters', 1, 'Hawks', 1, 'SO', 'Otters'],
['Otters', 5, 'Hawks', 2, 'REG', None],
['Hawks', 2, 'Lynx', 1, 'REG', None],
['Lynx', 3, 'Bears', 3, 'SO', 'Bears'],
['Lynx', 3, 'Hawks', 5, 'REG', None],
['Hawks', 0, 'Bears', 3, 'REG', None]],),
[['Hawks', 7, 3, 3, 3, -3],
['Bears', 6, 2, 2, 3, 5],
['Otters', 4, 1, 1, 2, 2],
['Lynx', 1, 0, 0, 0, -4]]),
('regression: overtime loser point',
([['Otters', 3, 'Bears', 0, 'REG', None],
['Lynx', 5, 'Otters', 4, 'REG', None],
['Lynx', 0, 'Bears', 4, 'REG', None],
['Otters', 2, 'Lynx', 3, 'OT', None],
['Otters', 5, 'Lynx', 4, 'OT', None]],),
[['Otters', 5, 1, 2, 2, 2], ['Lynx', 5, 1, 2, 2, -3], ['Bears', 2, 1, 1, 1, 1]]),
('variant scenario 1',
([['Otters', 2, 'Bears', 1, 'REG', None],
['Otters', 3, 'Bears', 3, 'SO', 'Bears'],
['Lynx', 1, 'Hawks', 5, 'REG', None],
['Bears', 4, 'Hawks', 3, 'REG', None],
['Lynx', 1, 'Otters', 3, 'REG', None],
['Lynx', 1, 'Otters', 2, 'REG', None],
['Hawks', 2, 'Otters', 2, 'SO', 'Otters'],
['Hawks', 4, 'Lynx', 2, 'REG', None],
['Bears', 4, 'Lynx', 2, 'REG', None]],),
[['Otters', 9, 3, 3, 4, 4],
['Bears', 6, 2, 2, 3, 3],
['Hawks', 5, 2, 2, 2, 4],
['Lynx', 0, 0, 0, 0, -11]]),
('variant scenario 2',
([['Otters', 3, 'Hawks', 3, 'SO', 'Otters'],
['Hawks', 3, 'Otters', 3, 'SO', 'Hawks'],
['Hawks', 1, 'Otters', 4, 'REG', None],
['Lynx', 4, 'Otters', 2, 'REG', None]],),
[['Otters', 5, 1, 1, 2, 1], ['Hawks', 3, 0, 0, 1, -3], ['Lynx', 2, 1, 1, 1, 2]])]]
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 regulation win | [['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]] | [['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]] | Passed |
| boundary overtime loss point | [['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | [['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | Passed |
| boundary shootout goal credit | [['Hawks', 2, 0, 0, 1, 1], ['Bears', 0, 0, 0, 0, -1]] | [['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | Failed |
| boundary RW breaks tie | [['Bears', 2, 1, 1, 1, 1], ['Hawks', 2, 0, 1, 1, 1], ['Otters', 1, 0, 0, 0, -1], ['Lynx', 0, 0, 0, 0, -1]] | [['Bears', 2, 1, 1, 1, 1], ['Hawks', 2, 0, 1, 1, 1], ['Otters', 1, 0, 0, 0, -1], ['Lynx', 0, 0, 0, 0, -1]] | Passed |
| regression: overtime loser point | [['Lynx', 6, 2, 2, 3, 5], ['Bears', 4, 1, 1, 2, 4], ['Otters', 2, 1, 1, 1, -2], ['Hawks', 0, 0, 0, 0, -7]] | [['Lynx', 7, 2, 2, 3, 5], ['Bears', 4, 1, 1, 2, 4], ['Otters', 3, 1, 1, 1, -2], ['Hawks', 0, 0, 0, 0, -7]] | Failed |
| regression: overtime loser point | [['Otters', 6, 2, 3, 3, 4], ['Lynx', 2, 0, 0, 1, 1], ['Hawks', 1, 0, 0, 0, -4], ['Bears', 0, 0, 0, 0, -1]] | [['Otters', 6, 2, 3, 3, 4], ['Lynx', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1], ['Hawks', 1, 0, 0, 0, -4]] | Failed |
| variant scenario 1 | [['Hawks', 6, 2, 2, 3, 4], ['Lynx', 6, 0, 0, 3, 2], ['Otters', 0, 0, 0, 0, -1], ['Bears', 0, 0, 0, 0, -5]] | [['Hawks', 7, 2, 2, 3, 4], ['Lynx', 6, 0, 0, 3, 2], ['Bears', 2, 0, 0, 0, -5], ['Otters', 1, 0, 0, 0, -1]] | Failed |
| variant scenario 2 | [['Bears', 5, 1, 1, 2, 2], ['Lynx', 2, 1, 1, 1, -1], ['Otters', 2, 0, 1, 1, 0], ['Hawks', 0, 0, 0, 0, -1]] | [['Bears', 5, 1, 1, 2, 2], ['Lynx', 2, 1, 1, 1, -1], ['Otters', 2, 0, 1, 1, 0], ['Hawks', 1, 0, 0, 0, -1]] | Failed |
SHA-256 / 5aab2dc38c5fd1d3a501fb81b5acef5bc166b199e4ca6fa97b716bafa00b0078
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(games):
t = {}
for h, hg, a, ag, decided, so_winner in games:
if decided == 'SO':
if so_winner == h:
hg += 1
else:
ag += 1
for team, f, g in ((h, hg, ag), (a, ag, hg)):
row = t.setdefault(team, {'pts': 0, 'rw': 0, 'row': 0, 'w': 0, 'gd': 0})
row['gd'] += f - g
if f > g:
row['pts'] += 2
row['w'] += 1
if decided == 'REG':
row['rw'] += 1
if decided != 'SO':
row['row'] += 1
elif decided != 'REG':
row['pts'] += 1
order = sorted(t, key=lambda k: (-t[k]['pts'], -t[k]['rw'], -t[k]['row'], -t[k]['w'], -t[k]['gd'], k))
return [[k, t[k]['pts'], t[k]['rw'], t[k]['row'], t[k]['w'], t[k]['gd']] for k 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 regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Bears', 3, 'Lynx', 3, 'SO', 'Bears'],
['Lynx', 4, 'Hawks', 1, 'REG', None],
['Otters', 0, 'Bears', 3, 'REG', None],
['Hawks', 0, 'Otters', 4, 'REG', None],
['Lynx', 5, 'Otters', 3, 'REG', None],
['Lynx', 3, 'Otters', 3, 'SO', 'Lynx']],),
[['Lynx', 7, 2, 2, 3, 5],
['Bears', 4, 1, 1, 2, 4],
['Otters', 3, 1, 1, 1, -2],
['Hawks', 0, 0, 0, 0, -7]]),
('regression: overtime loser point',
([['Otters', 5, 'Hawks', 4, 'OT', None],
['Bears', 0, 'Lynx', 0, 'SO', 'Lynx'],
['Hawks', 3, 'Otters', 5, 'REG', None],
['Hawks', 0, 'Otters', 1, 'REG', None]],),
[['Otters', 6, 2, 3, 3, 4],
['Lynx', 2, 0, 0, 1, 1],
['Bears', 1, 0, 0, 0, -1],
['Hawks', 1, 0, 0, 0, -4]]),
('variant scenario 1',
([['Lynx', 0, 'Hawks', 0, 'SO', 'Lynx'],
['Bears', 1, 'Lynx', 1, 'SO', 'Lynx'],
['Hawks', 4, 'Lynx', 3, 'REG', None],
['Otters', 2, 'Hawks', 2, 'SO', 'Hawks'],
['Bears', 2, 'Hawks', 5, 'REG', None],
['Bears', 0, 'Lynx', 0, 'SO', 'Lynx']],),
[['Hawks', 7, 2, 2, 3, 4],
['Lynx', 6, 0, 0, 3, 2],
['Bears', 2, 0, 0, 0, -5],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Hawks', 2, 'Bears', 2, 'SO', 'Bears'],
['Lynx', 3, 'Otters', 2, 'REG', None],
['Lynx', 2, 'Bears', 4, 'REG', None],
['Otters', 1, 'Bears', 0, 'OT', None]],),
[['Bears', 5, 1, 1, 2, 2],
['Lynx', 2, 1, 1, 1, -1],
['Otters', 2, 0, 1, 1, 0],
['Hawks', 1, 0, 0, 0, -1]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Otters', 3, 'Lynx', 0, 'REG', None],
['Bears', 3, 'Otters', 3, 'SO', 'Bears'],
['Bears', 2, 'Lynx', 0, 'REG', None],
['Bears', 2, 'Otters', 3, 'OT', None],
['Lynx', 4, 'Hawks', 4, 'SO', 'Hawks']],),
[['Otters', 5, 1, 2, 2, 3],
['Bears', 5, 1, 1, 2, 2],
['Hawks', 2, 0, 0, 1, 1],
['Lynx', 1, 0, 0, 0, -6]]),
('variant scenario 1',
([['Bears', 3, 'Hawks', 4, 'REG', None],
['Otters', 1, 'Bears', 1, 'SO', 'Bears'],
['Hawks', 5, 'Lynx', 4, 'OT', None],
['Hawks', 1, 'Bears', 1, 'SO', 'Hawks']],),
[['Hawks', 6, 1, 2, 3, 3],
['Bears', 3, 0, 0, 1, -1],
['Lynx', 1, 0, 0, 0, -1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Lynx', 0, 'Bears', 0, 'SO', 'Bears'],
['Lynx', 4, 'Bears', 0, 'REG', None],
['Hawks', 0, 'Otters', 0, 'SO', 'Hawks'],
['Otters', 3, 'Hawks', 2, 'REG', None],
['Hawks', 4, 'Bears', 5, 'REG', None],
['Lynx', 0, 'Hawks', 0, 'SO', 'Hawks'],
['Lynx', 4, 'Bears', 5, 'OT', None]],),
[['Bears', 6, 1, 2, 3, -1],
['Lynx', 5, 1, 1, 1, 1],
['Hawks', 4, 0, 0, 2, 0],
['Otters', 3, 1, 1, 1, 0]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Lynx', 3, 'Hawks', 4, 'REG', None],
['Bears', 4, 'Otters', 3, 'REG', None],
['Hawks', 3, 'Lynx', 3, 'SO', 'Lynx'],
['Otters', 5, 'Lynx', 1, 'REG', None]],),
[['Hawks', 3, 1, 1, 1, 0],
['Otters', 2, 1, 1, 1, 3],
['Bears', 2, 1, 1, 1, 1],
['Lynx', 2, 0, 0, 1, -4]]),
('regression: overtime loser point',
([['Otters', 2, 'Lynx', 2, 'SO', 'Otters'],
['Hawks', 2, 'Bears', 3, 'OT', None],
['Bears', 0, 'Otters', 1, 'OT', None],
['Otters', 2, 'Hawks', 3, 'REG', None],
['Otters', 4, 'Lynx', 0, 'REG', None]],),
[['Otters', 6, 1, 2, 3, 5],
['Hawks', 3, 1, 1, 1, 0],
['Bears', 3, 0, 1, 1, 0],
['Lynx', 1, 0, 0, 0, -5]]),
('variant scenario 1',
([['Bears', 5, 'Lynx', 0, 'REG', None],
['Otters', 2, 'Bears', 2, 'SO', 'Otters'],
['Bears', 2, 'Hawks', 3, 'OT', None],
['Bears', 5, 'Hawks', 3, 'REG', None],
['Lynx', 2, 'Hawks', 1, 'OT', None]],),
[['Bears', 6, 2, 2, 2, 5],
['Hawks', 3, 0, 1, 1, -2],
['Lynx', 2, 0, 1, 1, -4],
['Otters', 2, 0, 0, 1, 1]]),
('variant scenario 2',
([['Bears', 0, 'Otters', 1, 'REG', None],
['Hawks', 4, 'Lynx', 1, 'REG', None],
['Lynx', 5, 'Otters', 4, 'OT', None]],),
[['Otters', 3, 1, 1, 1, 0],
['Hawks', 2, 1, 1, 1, 3],
['Lynx', 2, 0, 1, 1, -2],
['Bears', 0, 0, 0, 0, -1]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Bears', 3, 'Lynx', 2, 'OT', None],
['Lynx', 4, 'Hawks', 3, 'REG', None],
['Hawks', 5, 'Otters', 4, 'OT', None],
['Lynx', 1, 'Hawks', 1, 'SO', 'Lynx']],),
[['Lynx', 5, 1, 1, 2, 1],
['Hawks', 3, 0, 1, 1, -1],
['Bears', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 1',
([['Bears', 4, 'Lynx', 4, 'SO', 'Lynx'],
['Bears', 5, 'Lynx', 2, 'REG', None],
['Hawks', 2, 'Bears', 2, 'SO', 'Bears'],
['Otters', 0, 'Bears', 1, 'OT', None]],),
[['Bears', 7, 1, 2, 3, 4],
['Lynx', 2, 0, 0, 1, -2],
['Hawks', 1, 0, 0, 0, -1],
['Otters', 1, 0, 0, 0, -1]]),
('variant scenario 2',
([['Bears', 1, 'Otters', 1, 'SO', 'Otters'],
['Bears', 4, 'Lynx', 2, 'REG', None],
['Lynx', 0, 'Bears', 0, 'SO', 'Bears'],
['Otters', 0, 'Hawks', 0, 'SO', 'Hawks'],
['Bears', 2, 'Hawks', 3, 'OT', None],
['Otters', 1, 'Lynx', 2, 'OT', None],
['Lynx', 1, 'Otters', 0, 'REG', None]],),
[['Bears', 6, 1, 1, 2, 1],
['Lynx', 5, 1, 2, 2, -1],
['Hawks', 4, 0, 1, 2, 2],
['Otters', 4, 0, 0, 1, -2]])],
[('control regulation win',
([['Bears', 3, 'Hawks', 1, 'REG', None]],),
[['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]]),
('boundary overtime loss point',
([['Bears', 2, 'Hawks', 3, 'OT', None]],),
[['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary shootout goal credit',
([['Bears', 2, 'Hawks', 2, 'SO', 'Hawks']],),
[['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]]),
('boundary RW breaks tie',
([['Bears', 1, 'Lynx', 0, 'REG', None], ['Hawks', 1, 'Otters', 0, 'OT', None]],),
[['Bears', 2, 1, 1, 1, 1],
['Hawks', 2, 0, 1, 1, 1],
['Otters', 1, 0, 0, 0, -1],
['Lynx', 0, 0, 0, 0, -1]]),
('regression: overtime loser point',
([['Otters', 0, 'Bears', 2, 'REG', None],
['Bears', 4, 'Hawks', 5, 'REG', None],
['Otters', 1, 'Hawks', 1, 'SO', 'Otters'],
['Otters', 5, 'Hawks', 2, 'REG', None],
['Hawks', 2, 'Lynx', 1, 'REG', None],
['Lynx', 3, 'Bears', 3, 'SO', 'Bears'],
['Lynx', 3, 'Hawks', 5, 'REG', None],
['Hawks', 0, 'Bears', 3, 'REG', None]],),
[['Hawks', 7, 3, 3, 3, -3],
['Bears', 6, 2, 2, 3, 5],
['Otters', 4, 1, 1, 2, 2],
['Lynx', 1, 0, 0, 0, -4]]),
('regression: overtime loser point',
([['Otters', 3, 'Bears', 0, 'REG', None],
['Lynx', 5, 'Otters', 4, 'REG', None],
['Lynx', 0, 'Bears', 4, 'REG', None],
['Otters', 2, 'Lynx', 3, 'OT', None],
['Otters', 5, 'Lynx', 4, 'OT', None]],),
[['Otters', 5, 1, 2, 2, 2], ['Lynx', 5, 1, 2, 2, -3], ['Bears', 2, 1, 1, 1, 1]]),
('variant scenario 1',
([['Otters', 2, 'Bears', 1, 'REG', None],
['Otters', 3, 'Bears', 3, 'SO', 'Bears'],
['Lynx', 1, 'Hawks', 5, 'REG', None],
['Bears', 4, 'Hawks', 3, 'REG', None],
['Lynx', 1, 'Otters', 3, 'REG', None],
['Lynx', 1, 'Otters', 2, 'REG', None],
['Hawks', 2, 'Otters', 2, 'SO', 'Otters'],
['Hawks', 4, 'Lynx', 2, 'REG', None],
['Bears', 4, 'Lynx', 2, 'REG', None]],),
[['Otters', 9, 3, 3, 4, 4],
['Bears', 6, 2, 2, 3, 3],
['Hawks', 5, 2, 2, 2, 4],
['Lynx', 0, 0, 0, 0, -11]]),
('variant scenario 2',
([['Otters', 3, 'Hawks', 3, 'SO', 'Otters'],
['Hawks', 3, 'Otters', 3, 'SO', 'Hawks'],
['Hawks', 1, 'Otters', 4, 'REG', None],
['Lynx', 4, 'Otters', 2, 'REG', None]],),
[['Otters', 5, 1, 1, 2, 1], ['Hawks', 3, 0, 0, 1, -3], ['Lynx', 2, 1, 1, 1, 2]])]]
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 regulation win | [['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]] | [['Bears', 2, 1, 1, 1, 2], ['Hawks', 0, 0, 0, 0, -2]] | Passed |
| boundary overtime loss point | [['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | [['Hawks', 2, 0, 1, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | Passed |
| boundary shootout goal credit | [['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | [['Hawks', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1]] | Passed |
| boundary RW breaks tie | [['Bears', 2, 1, 1, 1, 1], ['Hawks', 2, 0, 1, 1, 1], ['Otters', 1, 0, 0, 0, -1], ['Lynx', 0, 0, 0, 0, -1]] | [['Bears', 2, 1, 1, 1, 1], ['Hawks', 2, 0, 1, 1, 1], ['Otters', 1, 0, 0, 0, -1], ['Lynx', 0, 0, 0, 0, -1]] | Passed |
| regression: overtime loser point | [['Lynx', 7, 2, 2, 3, 5], ['Bears', 4, 1, 1, 2, 4], ['Otters', 3, 1, 1, 1, -2], ['Hawks', 0, 0, 0, 0, -7]] | [['Lynx', 7, 2, 2, 3, 5], ['Bears', 4, 1, 1, 2, 4], ['Otters', 3, 1, 1, 1, -2], ['Hawks', 0, 0, 0, 0, -7]] | Passed |
| regression: overtime loser point | [['Otters', 6, 2, 3, 3, 4], ['Lynx', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1], ['Hawks', 1, 0, 0, 0, -4]] | [['Otters', 6, 2, 3, 3, 4], ['Lynx', 2, 0, 0, 1, 1], ['Bears', 1, 0, 0, 0, -1], ['Hawks', 1, 0, 0, 0, -4]] | Passed |
| variant scenario 1 | [['Hawks', 7, 2, 2, 3, 4], ['Lynx', 6, 0, 0, 3, 2], ['Bears', 2, 0, 0, 0, -5], ['Otters', 1, 0, 0, 0, -1]] | [['Hawks', 7, 2, 2, 3, 4], ['Lynx', 6, 0, 0, 3, 2], ['Bears', 2, 0, 0, 0, -5], ['Otters', 1, 0, 0, 0, -1]] | Passed |
| variant scenario 2 | [['Bears', 5, 1, 1, 2, 2], ['Lynx', 2, 1, 1, 1, -1], ['Otters', 2, 0, 1, 1, 0], ['Hawks', 1, 0, 0, 0, -1]] | [['Bears', 5, 1, 1, 2, 2], ['Lynx', 2, 1, 1, 1, -1], ['Otters', 2, 0, 1, 1, 0], ['Hawks', 1, 0, 0, 0, -1]] | Passed |
SHA-256 / ee214febcb611e3c3efdd8aa8b749586ce00e445fa734caf55a5a7c48aeee8ad
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.225255+00:00.
Case digest / 8fc3ee5f0f91ad23da3b4002be9e85355b8badf960a82c98a56d92749a8f604c