FAILURE MAP
← Case archive

FA-84191 / Sports scoring and tiebreakers / Open access

Win on the 18th printed as "1&0" · case 01

A match won on the last hole is shown as "A wins 1&0".

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

ROOT CAUSE

There is no special case for closure with zero holes remaining.

VERIFIED REPAIR

Use the "L up" form when the match closes on the 18th.

Unsuccessful approach: Applying the "up" form with one hole remaining turns a 2&1 win into "2 up".

Case contract

Eighteen-hole match play. holes is a string of hole results: A, B or H (halved). The match closes as soon as the lead exceeds the holes remaining: "X wins L&R" (L lead, R remaining), or "X wins L up" if it closes on the 18th. Later characters are ignored. After 18 holes level: "halved". Unfinished: "all square", "X dormie R" when the lead equals the holes remaining, otherwise "X L up".

Why this case matters

Ryder-Cup style boards and match-play brackets display closure notation like 3&2 and dormie.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(holes):
    lead = 0
    played = 0
    for h in holes:
        played += 1
        if h == 'A':
            lead += 1
        elif h == 'B':
            lead -= 1
        remaining = 18 - played
        if abs(lead) > remaining:
            side = 'A' if lead > 0 else 'B'
            if False:
                return '%s wins %d up' % (side, abs(lead))
            return '%s wins %d&%d' % (side, abs(lead), remaining)
    if played == 18:
        return 'halved'
    remaining = 18 - played
    if lead == 0:
        return 'all square'
    side = 'A' if lead > 0 else 'B'
    if abs(lead) == remaining:
        return '%s dormie %d' % (side, remaining)
    return '%s %d up' % (side, abs(lead))
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 early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BBABAHABBABABHHABHHABH',), 'B wins 2&1'),
  ('regression: final hole closure', ('HABBABHAHAABBBBHAHBAAA',), 'B wins 1 up'),
  ('variant scenario 1', ('AAAHAHHBABAHA',), 'A dormie 5'),
  ('variant scenario 2', ('HHBBAAAAABHABAABBB',), 'A wins 4&3')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BABABABHABBBHAAHHAHAA',), 'B wins 0&-1'),
  ('regression: final hole closure', ('AHBHABBAABHBHAABHABAAB',), 'A wins 1 up'),
  ('variant scenario 1', ('BBBBHBBBHBA',), 'B dormie 7'),
  ('variant scenario 2', ('ABHBBHBBAAAAA',), 'A 1 up')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BAAABHAABAHABBBBBAB',), 'B wins 1&-1'),
  ('regression: final hole closure', ('HABHHABBBHABHBAAHBA',), 'B wins 2 up'),
  ('variant scenario 1', ('AHABBABAHBAAABAAAA',), 'A wins 4&2'),
  ('variant scenario 2', ('AABAAHHAAABBBBHABABHBB',), 'A wins 3&2')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BHBBBHAABHBAABAAHABBBA',), 'B wins 1&-1'),
  ('regression: final hole closure', ('ABHHBABABBAHABAHBBB',), 'B wins 2 up'),
  ('variant scenario 1', ('HBHHHHBAA',), 'all square'),
  ('variant scenario 2', ('HAHHABBBAAHAB',), 'A 1 up')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BBBABBAHBBAABAHABBAABA',), 'B wins 3&1'),
  ('regression: final hole closure', ('HHABABAAHBBABBBAABABA',), 'B wins 1 up'),
  ('variant scenario 1', ('ABHAABABABAH',), 'A 2 up'),
  ('variant scenario 2', ('AHBAAABBAAAH',), 'A 4 up')]]
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 early leadA 2 upA 2 upPassed
boundary dormieA dormie 3A dormie 3Passed
boundary closure three and twoB wins 3&2B wins 3&2Passed
boundary one up at eighteenA wins 1&0A wins 1 upFailed
control halved matchhalvedhalvedPassed
control all squareall squareall squarePassed
regression: final hole closureB wins 2&1B wins 2&1Passed
regression: final hole closureB wins 1&0B wins 1 upFailed
variant scenario 1A dormie 5A dormie 5Passed
variant scenario 2A wins 4&3A wins 4&3Passed

SHA-256 / b8865ba7e69248066f08a4f471a893293b0cbdb1d7f0c3f099eeaa947cd3a9de

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(holes):
    lead = 0
    played = 0
    for h in holes:
        played += 1
        if h == 'A':
            lead += 1
        elif h == 'B':
            lead -= 1
        remaining = 18 - played
        if abs(lead) > remaining:
            side = 'A' if lead > 0 else 'B'
            if remaining <= 1:
                return '%s wins %d up' % (side, abs(lead))
            return '%s wins %d&%d' % (side, abs(lead), remaining)
    if played == 18:
        return 'halved'
    remaining = 18 - played
    if lead == 0:
        return 'all square'
    side = 'A' if lead > 0 else 'B'
    if abs(lead) == remaining:
        return '%s dormie %d' % (side, remaining)
    return '%s %d up' % (side, abs(lead))
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 early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BBABAHABBABABHHABHHABH',), 'B wins 2&1'),
  ('regression: final hole closure', ('HABBABHAHAABBBBHAHBAAA',), 'B wins 1 up'),
  ('variant scenario 1', ('AAAHAHHBABAHA',), 'A dormie 5'),
  ('variant scenario 2', ('HHBBAAAAABHABAABBB',), 'A wins 4&3')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BABABABHABBBHAAHHAHAA',), 'B wins 0&-1'),
  ('regression: final hole closure', ('AHBHABBAABHBHAABHABAAB',), 'A wins 1 up'),
  ('variant scenario 1', ('BBBBHBBBHBA',), 'B dormie 7'),
  ('variant scenario 2', ('ABHBBHBBAAAAA',), 'A 1 up')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BAAABHAABAHABBBBBAB',), 'B wins 1&-1'),
  ('regression: final hole closure', ('HABHHABBBHABHBAAHBA',), 'B wins 2 up'),
  ('variant scenario 1', ('AHABBABAHBAAABAAAA',), 'A wins 4&2'),
  ('variant scenario 2', ('AABAAHHAAABBBBHABABHBB',), 'A wins 3&2')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BHBBBHAABHBAABAAHABBBA',), 'B wins 1&-1'),
  ('regression: final hole closure', ('ABHHBABABBAHABAHBBB',), 'B wins 2 up'),
  ('variant scenario 1', ('HBHHHHBAA',), 'all square'),
  ('variant scenario 2', ('HAHHABBBAAHAB',), 'A 1 up')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BBBABBAHBBAABAHABBAABA',), 'B wins 3&1'),
  ('regression: final hole closure', ('HHABABAAHBBABBBAABABA',), 'B wins 1 up'),
  ('variant scenario 1', ('ABHAABABABAH',), 'A 2 up'),
  ('variant scenario 2', ('AHBAAABBAAAH',), 'A 4 up')]]
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 early leadA 2 upA 2 upPassed
boundary dormieA dormie 3A dormie 3Passed
boundary closure three and twoB wins 3&2B wins 3&2Passed
boundary one up at eighteenA wins 1 upA wins 1 upPassed
control halved matchhalvedhalvedPassed
control all squareall squareall squarePassed
regression: final hole closureB wins 2 upB wins 2&1Failed
regression: final hole closureB wins 1 upB wins 1 upPassed
variant scenario 1A dormie 5A dormie 5Passed
variant scenario 2A wins 4&3A wins 4&3Passed

SHA-256 / 94410daee768c847f004d0fc22e989d52b9be8615dd6e31db2e944c48b21b33d

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(holes):
    lead = 0
    played = 0
    for h in holes:
        played += 1
        if h == 'A':
            lead += 1
        elif h == 'B':
            lead -= 1
        remaining = 18 - played
        if abs(lead) > remaining:
            side = 'A' if lead > 0 else 'B'
            if remaining == 0:
                return '%s wins %d up' % (side, abs(lead))
            return '%s wins %d&%d' % (side, abs(lead), remaining)
    if played == 18:
        return 'halved'
    remaining = 18 - played
    if lead == 0:
        return 'all square'
    side = 'A' if lead > 0 else 'B'
    if abs(lead) == remaining:
        return '%s dormie %d' % (side, remaining)
    return '%s %d up' % (side, abs(lead))
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 early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BBABAHABBABABHHABHHABH',), 'B wins 2&1'),
  ('regression: final hole closure', ('HABBABHAHAABBBBHAHBAAA',), 'B wins 1 up'),
  ('variant scenario 1', ('AAAHAHHBABAHA',), 'A dormie 5'),
  ('variant scenario 2', ('HHBBAAAAABHABAABBB',), 'A wins 4&3')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BABABABHABBBHAAHHAHAA',), 'B wins 0&-1'),
  ('regression: final hole closure', ('AHBHABBAABHBHAABHABAAB',), 'A wins 1 up'),
  ('variant scenario 1', ('BBBBHBBBHBA',), 'B dormie 7'),
  ('variant scenario 2', ('ABHBBHBBAAAAA',), 'A 1 up')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BAAABHAABAHABBBBBAB',), 'B wins 1&-1'),
  ('regression: final hole closure', ('HABHHABBBHABHBAAHBA',), 'B wins 2 up'),
  ('variant scenario 1', ('AHABBABAHBAAABAAAA',), 'A wins 4&2'),
  ('variant scenario 2', ('AABAAHHAAABBBBHABABHBB',), 'A wins 3&2')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BHBBBHAABHBAABAAHABBBA',), 'B wins 1&-1'),
  ('regression: final hole closure', ('ABHHBABABBAHABAHBBB',), 'B wins 2 up'),
  ('variant scenario 1', ('HBHHHHBAA',), 'all square'),
  ('variant scenario 2', ('HAHHABBBAAHAB',), 'A 1 up')],
 [('control early lead', ('AAH',), 'A 2 up'),
  ('boundary dormie', ('AAAHHHHHHHHHHHH',), 'A dormie 3'),
  ('boundary closure three and two', ('BBBHHHHHHHHHHHHH',), 'B wins 3&2'),
  ('boundary one up at eighteen', ('AHHHHHHHHHHHHHHHHH',), 'A wins 1 up'),
  ('control halved match', ('ABABABABABABABABAB',), 'halved'),
  ('control all square', ('HAB',), 'all square'),
  ('regression: final hole closure', ('BBBABBAHBBAABAHABBAABA',), 'B wins 3&1'),
  ('regression: final hole closure', ('HHABABAAHBBABBBAABABA',), 'B wins 1 up'),
  ('variant scenario 1', ('ABHAABABABAH',), 'A 2 up'),
  ('variant scenario 2', ('AHBAAABBAAAH',), 'A 4 up')]]
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 early leadA 2 upA 2 upPassed
boundary dormieA dormie 3A dormie 3Passed
boundary closure three and twoB wins 3&2B wins 3&2Passed
boundary one up at eighteenA wins 1 upA wins 1 upPassed
control halved matchhalvedhalvedPassed
control all squareall squareall squarePassed
regression: final hole closureB wins 2&1B wins 2&1Passed
regression: final hole closureB wins 1 upB wins 1 upPassed
variant scenario 1A dormie 5A dormie 5Passed
variant scenario 2A wins 4&3A wins 4&3Passed

SHA-256 / 1d9e61a718e8a4739681f595fb90fe4a26376f3c5d1d64076ce4c80a4f2e99cd

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

Case digest / a8afbc7d761dfb491ec79fb366e0d022cd0658ecbeb50f57daf005cef3d1bdf9