FAILURE MAP
← Case archive

FA-82031 / Poker hand evaluation / Open access

Folded overbet stranded in an unwinnable pot · case 01

A pot with no eligible players appears when a folder committed more than any live player.

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

ROOT CAUSE

Chips above the top live level are placed in a new pot instead of the last contestable pot.

VERIFIED REPAIR

Add folded chips above the top live level to the last pot.

Unsuccessful approach: Adding them to the main pot hands them to players who may not be eligible for the top layer.

Case contract

Input: {"bets": {player: total chips committed this hand}, "folded": [players]}. Build pots by layering at each distinct live (non-folded) commitment level, main pot first. Each layer takes from every player (folded ones included) the part of their commitment between the previous and current level; eligible players are the live players committed at least to the level, sorted. Folded chips above the top live level go to the last pot. Return [{"amount", "eligible"}].

Why this case matters

Side-pot construction decides which all-in players can win which chips.

1 / The failure

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

N = 1
observations = []
def solve(x):
    bets=x['bets']; folded=set(x['folded'])
    levels=sorted({v for p,v in bets.items() if p not in folded and v>0})
    pots=[]; prev=0
    for lv in levels:
        amt=sum(min(v,lv)-min(v,prev) for v in bets.values())
        elig=sorted(p for p,v in bets.items() if p not in folded and v>=lv)
        pots.append({'amount':amt,'eligible':elig})
        prev=lv
    extra=sum(max(0,v-prev) for v in bets.values())
    if extra and pots: pots.append({'amount':extra,'eligible':[]})
    return pots
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])],
 [('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('blind folded small', {'bets': {'a': 200, 'b': 200, 'c': 5}, 'folded': ['c']},
   [{'amount': 405, 'eligible': ['a', 'b']}]),
  ('short stack all-in with folders',
   {'bets': {'a': 30, 'b': 90, 'c': 90, 'd': 45}, 'folded': ['d']},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}, {'amount': 135, 'eligible': ['b', 'c']}]),
  ('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, []),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('blind folded small', {'bets': {'a': 200, 'b': 200, 'c': 5}, 'folded': ['c']},
   [{'amount': 405, 'eligible': ['a', 'b']}]),
  ('short stack all-in with folders',
   {'bets': {'a': 30, 'b': 90, 'c': 90, 'd': 45}, 'folded': ['d']},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}, {'amount': 135, 'eligible': ['b', 'c']}]),
  ('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, []),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]),
  ('three layers', {'bets': {'a': 10, 'b': 25, 'c': 50, 'd': 50}, 'folded': []},
   [{'amount': 40, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 45, 'eligible': ['b', 'c', 'd']},
    {'amount': 50, 'eligible': ['c', 'd']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]),
  ('three layers', {'bets': {'a': 10, 'b': 25, 'c': 50, 'd': 50}, 'folded': []},
   [{'amount': 40, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 45, 'eligible': ['b', 'c', 'd']},
    {'amount': 50, 'eligible': ['c', 'd']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'error:' + type(exc).__name__
    check(label, actual, 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
single all-in[{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}][{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]Passed
folded partial caller[{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}][{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]Passed
folded between levels[{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}][{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]Passed
two all-ins[{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}][{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}]Passed
everyone equal[{'amount': 120, 'eligible': ['a', 'b', 'c']}][{'amount': 120, 'eligible': ['a', 'b', 'c']}]Passed
folded above top[{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 30, 'eligible': []}][{'amount': 180, 'eligible': ['a', 'b']}]Failed
checked live player[{'amount': 40, 'eligible': ['b']}][{'amount': 40, 'eligible': ['b']}]Passed
folded overbet over two pots[{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 80, 'eligible': ['b']}, {'amount': 30, 'eligible': []}][{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]Failed

SHA-256 / bf0d3240f026073e45da8e165bcc8aececc33b74940635bd661542bf25c5d685

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    bets=x['bets']; folded=set(x['folded'])
    levels=sorted({v for p,v in bets.items() if p not in folded and v>0})
    pots=[]; prev=0
    for lv in levels:
        amt=sum(min(v,lv)-min(v,prev) for v in bets.values())
        elig=sorted(p for p,v in bets.items() if p not in folded and v>=lv)
        pots.append({'amount':amt,'eligible':elig})
        prev=lv
    extra=sum(max(0,v-prev) for v in bets.values())
    if extra and pots: pots[0]['amount']+=extra
    return pots
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])],
 [('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('blind folded small', {'bets': {'a': 200, 'b': 200, 'c': 5}, 'folded': ['c']},
   [{'amount': 405, 'eligible': ['a', 'b']}]),
  ('short stack all-in with folders',
   {'bets': {'a': 30, 'b': 90, 'c': 90, 'd': 45}, 'folded': ['d']},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}, {'amount': 135, 'eligible': ['b', 'c']}]),
  ('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, []),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('blind folded small', {'bets': {'a': 200, 'b': 200, 'c': 5}, 'folded': ['c']},
   [{'amount': 405, 'eligible': ['a', 'b']}]),
  ('short stack all-in with folders',
   {'bets': {'a': 30, 'b': 90, 'c': 90, 'd': 45}, 'folded': ['d']},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}, {'amount': 135, 'eligible': ['b', 'c']}]),
  ('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, []),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]),
  ('three layers', {'bets': {'a': 10, 'b': 25, 'c': 50, 'd': 50}, 'folded': []},
   [{'amount': 40, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 45, 'eligible': ['b', 'c', 'd']},
    {'amount': 50, 'eligible': ['c', 'd']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]),
  ('three layers', {'bets': {'a': 10, 'b': 25, 'c': 50, 'd': 50}, 'folded': []},
   [{'amount': 40, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 45, 'eligible': ['b', 'c', 'd']},
    {'amount': 50, 'eligible': ['c', 'd']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'error:' + type(exc).__name__
    check(label, actual, 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
single all-in[{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}][{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]Passed
folded partial caller[{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}][{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]Passed
folded between levels[{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}][{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]Passed
two all-ins[{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}][{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}]Passed
everyone equal[{'amount': 120, 'eligible': ['a', 'b', 'c']}][{'amount': 120, 'eligible': ['a', 'b', 'c']}]Passed
folded above top[{'amount': 180, 'eligible': ['a', 'b']}][{'amount': 180, 'eligible': ['a', 'b']}]Passed
checked live player[{'amount': 40, 'eligible': ['b']}][{'amount': 40, 'eligible': ['b']}]Passed
folded overbet over two pots[{'amount': 90, 'eligible': ['a', 'b']}, {'amount': 80, 'eligible': ['b']}][{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]Failed

SHA-256 / d03bc68fbb527fcac09f0a68b82207fd391f9b6d636cab845b0cebc8457bb490

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    bets=x['bets']; folded=set(x['folded'])
    levels=sorted({v for p,v in bets.items() if p not in folded and v>0})
    pots=[]; prev=0
    for lv in levels:
        amt=sum(min(v,lv)-min(v,prev) for v in bets.values())
        elig=sorted(p for p,v in bets.items() if p not in folded and v>=lv)
        pots.append({'amount':amt,'eligible':elig})
        prev=lv
    extra=sum(max(0,v-prev) for v in bets.values())
    if extra and pots: pots[-1]['amount']+=extra
    return pots
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])],
 [('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('blind folded small', {'bets': {'a': 200, 'b': 200, 'c': 5}, 'folded': ['c']},
   [{'amount': 405, 'eligible': ['a', 'b']}]),
  ('short stack all-in with folders',
   {'bets': {'a': 30, 'b': 90, 'c': 90, 'd': 45}, 'folded': ['d']},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}, {'amount': 135, 'eligible': ['b', 'c']}]),
  ('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, []),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('blind folded small', {'bets': {'a': 200, 'b': 200, 'c': 5}, 'folded': ['c']},
   [{'amount': 405, 'eligible': ['a', 'b']}]),
  ('short stack all-in with folders',
   {'bets': {'a': 30, 'b': 90, 'c': 90, 'd': 45}, 'folded': ['d']},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}, {'amount': 135, 'eligible': ['b', 'c']}]),
  ('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, []),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]),
  ('three layers', {'bets': {'a': 10, 'b': 25, 'c': 50, 'd': 50}, 'folded': []},
   [{'amount': 40, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 45, 'eligible': ['b', 'c', 'd']},
    {'amount': 50, 'eligible': ['c', 'd']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]),
  ('three layers', {'bets': {'a': 10, 'b': 25, 'c': 50, 'd': 50}, 'folded': []},
   [{'amount': 40, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 45, 'eligible': ['b', 'c', 'd']},
    {'amount': 50, 'eligible': ['c', 'd']}])],
 [('single all-in', {'bets': {'a': 100, 'b': 50, 'c': 100}, 'folded': []},
   [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]),
  ('folded partial caller', {'bets': {'a': 100, 'b': 50, 'c': 30}, 'folded': ['c']},
   [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]),
  ('folded between levels', {'bets': {'a': 100, 'b': 50, 'c': 75}, 'folded': ['c']},
   [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]),
  ('two all-ins', {'bets': {'a': 20, 'b': 60, 'c': 100, 'd': 100}, 'folded': []},
   [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']},
    {'amount': 80, 'eligible': ['c', 'd']}]),
  ('everyone equal', {'bets': {'a': 40, 'b': 40, 'c': 40}, 'folded': []},
   [{'amount': 120, 'eligible': ['a', 'b', 'c']}]),
  ('folded above top', {'bets': {'a': 50, 'b': 50, 'c': 80}, 'folded': ['c']},
   [{'amount': 180, 'eligible': ['a', 'b']}]),
  ('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
   [{'amount': 40, 'eligible': ['b']}]),
  ('folded overbet over two pots', {'bets': {'a': 20, 'b': 60, 'c': 90}, 'folded': ['c']},
   [{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}])]]
for label, args, expected in fixtures[N-1]:
    try:
        actual = solve(args)
    except Exception as exc:
        actual = 'error:' + type(exc).__name__
    check(label, actual, 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
single all-in[{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}][{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}]Passed
folded partial caller[{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}][{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}]Passed
folded between levels[{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}][{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}]Passed
two all-ins[{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}][{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}]Passed
everyone equal[{'amount': 120, 'eligible': ['a', 'b', 'c']}][{'amount': 120, 'eligible': ['a', 'b', 'c']}]Passed
folded above top[{'amount': 180, 'eligible': ['a', 'b']}][{'amount': 180, 'eligible': ['a', 'b']}]Passed
checked live player[{'amount': 40, 'eligible': ['b']}][{'amount': 40, 'eligible': ['b']}]Passed
folded overbet over two pots[{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}][{'amount': 60, 'eligible': ['a', 'b']}, {'amount': 110, 'eligible': ['b']}]Passed

SHA-256 / f9b4c75d8557009084245933e9bb91f434065ef03048d24b51ccedb277d5cdc0

Verification & scope

A deterministic toy model with an explicitly stated contract; no claim of conformance to any casino or tournament rulebook. 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:08.283518+00:00.

Case digest / 39e61df22e4f1e3fbbb7fcb517230765f2d29a8a1c293c0879c358fdd3f6e5f9