FAILURE MAP
← Case archive

FA-83971 / Sports scoring and tiebreakers / Open access

Net run rate rounded before subtracting the two rates · case 01

The published net run rate differs by 0.001 from the exact value.

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

ROOT CAUSE

Each run rate is rounded to three decimals before the subtraction.

THE FAILURE

Each run rate is rounded to three decimals before the subtraction.

Unsuccessful approach: Truncating the exact difference to three decimals still misreports values that should round up.

Case contract

Tournament net run rate. Each match row is [runs_for, overs_faced, all_out_for, runs_against, overs_bowled, all_out_against]. Overs strings use cricket notation "O.B" where B is balls 0-5 ("43.4" = 43 overs 4 balls); a ball digit above 5 returns "invalid overs". When a side was all out its innings counts as the full quota of overs. NRR = total runs for / total overs faced - total runs against / total overs bowled, aggregated over all matches before dividing, formatted as "%+.3f" of the exact value. If either overs total is zero return "no overs".

Why this case matters

Group-stage standings use net run rate as the first tiebreaker after points.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(matches, quota):
    def balls(text):
        whole, _, part = text.partition('.')
        part = int(part or 0)
        if part > 5:
            return None
        return int(whole) * 6 + part
    rf = bf = ra = ba = 0
    for runs_for, faced, out_for, runs_against, bowled, out_against in matches:
        f = quota * 6 if out_for else balls(faced)
        g = quota * 6 if out_against else balls(bowled)
        if f is None or g is None:
            return 'invalid overs'
        rf += runs_for
        bf += f
        ra += runs_against
        ba += g
    if bf == 0 or ba == 0:
        return 'no overs'
    value = round(rf * 6 / bf, 3) - round(ra * 6 / ba, 3)
    return '%+.3f' % float(value)
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 single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[218, '27.4', True, 90, '20.1', False], [291, '6.3', False, 179, '41.5', False]], 20),
   '+14.869'),
  ('regression: rounding stage', ([[174, '18.3', False, 263, '40.2', False]], 50), '+2.885'),
  ('variant scenario 1',
   ([[252, '41.5', True, 332, '8.6', False],
     [269, '15', False, 97, '2.1', False],
     [178, '38.2', False, 191, '44.2', False]],
    20),
   'invalid overs'),
  ('variant scenario 2', ([[162, '6', False, 336, '45.4', False]], 20), '+19.642')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[152, '43.1', True, 326, '11.5', True],
     [145, '2.2', False, 253, '19', False],
     [325, '47.2', True, 136, '6.5', True]],
    50),
   '+0.070'),
  ('regression: rounding stage', ([[261, '42.5', False, 211, '37.4', False]], 50), '+0.492'),
  ('variant scenario 1',
   ([[82, '11.4', False, 275, '31.4', False],
     [97, '49', False, 113, '3.1', False],
     [266, '44', False, 144, '48.3', False],
     [358, '27.5', False, 204, '19.6', False]],
    50),
   'invalid overs'),
  ('variant scenario 2',
   ([[297, '37.4', False, 108, '19.5', False], [286, '5.1', False, 167, '33.5', False]], 20),
   '+8.487')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[216, '39.5', False, 213, '32.3', False],
     [201, '4.1', False, 350, '39.0', True],
     [204, '38.4', False, 94, '13', False]],
    50),
   '+0.633'),
  ('variant scenario 1', ([[147, '45.4', False, 293, '33.5', False]], 50), '-5.441'),
  ('variant scenario 2', ([[0, '0', False, 0, '0', False]], 50), 'no overs')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[121, '36.1', True, 248, '42.2', False],
     [92, '15.7', True, 245, '32.2', True],
     [303, '0.4', False, 184, '12.2', False],
     [168, '0.4', False, 331, '5.2', False]],
    50),
   '-2.414'),
  ('regression: rounding stage',
   ([[327, '48.0', False, 210, '13.5', True],
     [230, '38.2', True, 113, '20.2', False],
     [158, '44.4', True, 281, '26.2', False],
     [344, '46.5', False, 138, '13.4', True]],
    20),
   '-0.707'),
  ('variant scenario 1',
   ([[226, '40.5', False, 269, '26.1', True],
     [167, '33.5', False, 92, '37.0', False],
     [205, '24.5', True, 125, '18', True],
     [199, '47.4', False, 240, '12.2', False],
     [217, '8.2', False, 247, '39', False],
     [296, '18', False, 297, '14.2', False]],
    50),
   '+0.328'),
  ('variant scenario 2', ([[0, '0', False, 0, '0', False]], 50), 'no overs')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[168, '4.5', True, 104, '50', False],
     [343, '28.2', False, 323, '38.4', False],
     [90, '38.3', True, 95, '7', True],
     [87, '22', False, 174, '48.3', False],
     [163, '6.1', False, 326, '19.2', False]],
    20),
   '+3.028'),
  ('regression: rounding stage',
   ([[271, '23.3', True, 114, '47.4', False],
     [94, '41.5', True, 238, '3.4', False],
     [315, '34.3', False, 188, '19.2', True],
     [296, '29.4', False, 109, '44.2', True]],
    50),
   '+1.657'),
  ('variant scenario 1',
   ([[114, '36.1', False, 275, '32.0', True],
     [284, '17.4', False, 297, '10.4', True],
     [284, '16.5', False, 223, '30.5', True],
     [305, '45.3', True, 108, '36.1', False],
     [254, '13', True, 317, '37.0', False],
     [89, '15.3', False, 102, '17', True],
     [328, '41', False, 88, '21.2', False]],
    20),
   '+1.838'),
  ('variant scenario 2',
   ([[107, '20.3', False, 313, '10.1', False],
     [299, '42.4', True, 267, '49.1', False],
     [217, '50.4', True, 342, '1.2', True],
     [247, '19.2', False, 278, '49.1', True],
     [296, '28.4', True, 318, '43.3', False],
     [326, '9.0', True, 334, '48.1', False]],
    50),
   '-1.157')]]
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 single match+1.000+1.000Passed
boundary partial over+1.317+1.317Passed
boundary all out uses quota-0.661-0.661Passed
boundary invalid ball digitinvalid oversinvalid oversPassed
control no oversno oversno oversPassed
control negative rate-3.000-3.000Passed
regression: rounding stage+14.869+14.869Passed
regression: rounding stage+2.884+2.885Failed
variant scenario 1invalid oversinvalid oversPassed
variant scenario 2+19.642+19.642Passed

SHA-256 / 08c63794fd2959997a0c2053ff6b0ce819dd501122d0751a916bac964cb0c42a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(matches, quota):
    def balls(text):
        whole, _, part = text.partition('.')
        part = int(part or 0)
        if part > 5:
            return None
        return int(whole) * 6 + part
    rf = bf = ra = ba = 0
    for runs_for, faced, out_for, runs_against, bowled, out_against in matches:
        f = quota * 6 if out_for else balls(faced)
        g = quota * 6 if out_against else balls(bowled)
        if f is None or g is None:
            return 'invalid overs'
        rf += runs_for
        bf += f
        ra += runs_against
        ba += g
    if bf == 0 or ba == 0:
        return 'no overs'
    value = Fraction(rf * 6, bf) - Fraction(ra * 6, ba)
    return '%+.3f' % (math.trunc(value * 1000) / 1000)
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 single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[218, '27.4', True, 90, '20.1', False], [291, '6.3', False, 179, '41.5', False]], 20),
   '+14.869'),
  ('regression: rounding stage', ([[174, '18.3', False, 263, '40.2', False]], 50), '+2.885'),
  ('variant scenario 1',
   ([[252, '41.5', True, 332, '8.6', False],
     [269, '15', False, 97, '2.1', False],
     [178, '38.2', False, 191, '44.2', False]],
    20),
   'invalid overs'),
  ('variant scenario 2', ([[162, '6', False, 336, '45.4', False]], 20), '+19.642')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[152, '43.1', True, 326, '11.5', True],
     [145, '2.2', False, 253, '19', False],
     [325, '47.2', True, 136, '6.5', True]],
    50),
   '+0.070'),
  ('regression: rounding stage', ([[261, '42.5', False, 211, '37.4', False]], 50), '+0.492'),
  ('variant scenario 1',
   ([[82, '11.4', False, 275, '31.4', False],
     [97, '49', False, 113, '3.1', False],
     [266, '44', False, 144, '48.3', False],
     [358, '27.5', False, 204, '19.6', False]],
    50),
   'invalid overs'),
  ('variant scenario 2',
   ([[297, '37.4', False, 108, '19.5', False], [286, '5.1', False, 167, '33.5', False]], 20),
   '+8.487')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[216, '39.5', False, 213, '32.3', False],
     [201, '4.1', False, 350, '39.0', True],
     [204, '38.4', False, 94, '13', False]],
    50),
   '+0.633'),
  ('variant scenario 1', ([[147, '45.4', False, 293, '33.5', False]], 50), '-5.441'),
  ('variant scenario 2', ([[0, '0', False, 0, '0', False]], 50), 'no overs')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[121, '36.1', True, 248, '42.2', False],
     [92, '15.7', True, 245, '32.2', True],
     [303, '0.4', False, 184, '12.2', False],
     [168, '0.4', False, 331, '5.2', False]],
    50),
   '-2.414'),
  ('regression: rounding stage',
   ([[327, '48.0', False, 210, '13.5', True],
     [230, '38.2', True, 113, '20.2', False],
     [158, '44.4', True, 281, '26.2', False],
     [344, '46.5', False, 138, '13.4', True]],
    20),
   '-0.707'),
  ('variant scenario 1',
   ([[226, '40.5', False, 269, '26.1', True],
     [167, '33.5', False, 92, '37.0', False],
     [205, '24.5', True, 125, '18', True],
     [199, '47.4', False, 240, '12.2', False],
     [217, '8.2', False, 247, '39', False],
     [296, '18', False, 297, '14.2', False]],
    50),
   '+0.328'),
  ('variant scenario 2', ([[0, '0', False, 0, '0', False]], 50), 'no overs')],
 [('control single match', ([[300, '50', False, 250, '50', False]], 50), '+1.000'),
  ('boundary partial over', ([[150, '20.3', False, 150, '25', False]], 50), '+1.317'),
  ('boundary all out uses quota', ([[120, '15.2', True, 121, '18.1', False]], 20), '-0.661'),
  ('boundary invalid ball digit', ([[100, '10.6', False, 90, '10', False]], 20), 'invalid overs'),
  ('control no overs', ([[0, '0', False, 0, '0', False]], 20), 'no overs'),
  ('control negative rate', ([[100, '20', False, 160, '20', False]], 20), '-3.000'),
  ('regression: rounding stage',
   ([[168, '4.5', True, 104, '50', False],
     [343, '28.2', False, 323, '38.4', False],
     [90, '38.3', True, 95, '7', True],
     [87, '22', False, 174, '48.3', False],
     [163, '6.1', False, 326, '19.2', False]],
    20),
   '+3.028'),
  ('regression: rounding stage',
   ([[271, '23.3', True, 114, '47.4', False],
     [94, '41.5', True, 238, '3.4', False],
     [315, '34.3', False, 188, '19.2', True],
     [296, '29.4', False, 109, '44.2', True]],
    50),
   '+1.657'),
  ('variant scenario 1',
   ([[114, '36.1', False, 275, '32.0', True],
     [284, '17.4', False, 297, '10.4', True],
     [284, '16.5', False, 223, '30.5', True],
     [305, '45.3', True, 108, '36.1', False],
     [254, '13', True, 317, '37.0', False],
     [89, '15.3', False, 102, '17', True],
     [328, '41', False, 88, '21.2', False]],
    20),
   '+1.838'),
  ('variant scenario 2',
   ([[107, '20.3', False, 313, '10.1', False],
     [299, '42.4', True, 267, '49.1', False],
     [217, '50.4', True, 342, '1.2', True],
     [247, '19.2', False, 278, '49.1', True],
     [296, '28.4', True, 318, '43.3', False],
     [326, '9.0', True, 334, '48.1', False]],
    50),
   '-1.157')]]
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 single match+1.000+1.000Passed
boundary partial over+1.317+1.317Passed
boundary all out uses quota-0.660-0.661Failed
boundary invalid ball digitinvalid oversinvalid oversPassed
control no oversno oversno oversPassed
control negative rate-3.000-3.000Passed
regression: rounding stage+14.868+14.869Failed
regression: rounding stage+2.884+2.885Failed
variant scenario 1invalid oversinvalid oversPassed
variant scenario 2+19.642+19.642Passed

SHA-256 / 670d11a6ae6e76b3b50be56981a317f622eafae76211cc408c696c1df8307f6b

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 10 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any governing body rulebook or operator house rules. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:50:26.516175+00:00.

Case digest / 3b34d9fd9912f4584f330b0fb60c507c05d9ac2d2edb3e63d7799281a0e0414b