FA-82021 / Poker hand evaluation / Open access
All-in player excluded from the pot they capped · case 01
The player whose all-in defines a level is not eligible for that level's pot.
ROOT CAUSE
Eligibility uses a strict comparison with the level, so the exact all-in amount does not qualify.
VERIFIED REPAIR
A live player is eligible when their commitment is at least the level.
Unsuccessful approach: Comparing to the previous level makes the capped player eligible for the next side pot as well.
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[-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']}]),
('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, [])],
[('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']}]),
('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']}])],
[('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']}]),
('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']}]),
('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']}]),
('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']}]),
('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
[{'amount': 40, 'eligible': ['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']}]),
('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']}]),
('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': []}, [])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| single all-in | [{'amount': 150, 'eligible': ['a', 'c']}, {'amount': 100, 'eligible': []}] | [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}] | Failed |
| folded partial caller | [{'amount': 130, 'eligible': ['a']}, {'amount': 50, 'eligible': []}] | [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}] | Failed |
| folded between levels | [{'amount': 150, 'eligible': ['a']}, {'amount': 75, 'eligible': []}] | [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}] | Failed |
| two all-ins | [{'amount': 80, 'eligible': ['b', 'c', 'd']}, {'amount': 120, 'eligible': ['c', 'd']}, {'amount': 80, 'eligible': []}] | [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}] | Failed |
| everyone equal | [{'amount': 120, 'eligible': []}] | [{'amount': 120, 'eligible': ['a', 'b', 'c']}] | Failed |
| folded above top | [{'amount': 180, 'eligible': []}] | [{'amount': 180, 'eligible': ['a', 'b']}] | Failed |
| checked live player | [{'amount': 40, 'eligible': []}] | [{'amount': 40, 'eligible': ['b']}] | Failed |
| no chips committed | [] | [] | Passed |
SHA-256 / 35197bb38754fd5ebc9a0d4e5f422d109261336441b882bff1c0f6b706c211d5
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>=prev)
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']}]),
('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, [])],
[('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']}]),
('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']}])],
[('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']}]),
('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']}]),
('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']}]),
('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']}]),
('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
[{'amount': 40, 'eligible': ['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']}]),
('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']}]),
('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': []}, [])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| single all-in | [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'b', 'c']}] | [{'amount': 150, 'eligible': ['a', 'b', 'c']}, {'amount': 100, 'eligible': ['a', 'c']}] | Failed |
| folded partial caller | [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a', 'b']}] | [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}] | Failed |
| folded between levels | [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a', 'b']}] | [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}] | Failed |
| two all-ins | [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 80, 'eligible': ['b', 'c', 'd']}] | [{'amount': 80, 'eligible': ['a', 'b', 'c', 'd']}, {'amount': 120, 'eligible': ['b', 'c', 'd']}, {'amount': 80, 'eligible': ['c', 'd']}] | Failed |
| 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': ['a', 'b']}] | [{'amount': 40, 'eligible': ['b']}] | Failed |
| no chips committed | [] | [] | Passed |
SHA-256 / 5ba393b0ae98e6ca8caeedf87de5cabbcbef3973dbc43124d824b77333cfcbe6
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']}]),
('no chips committed', {'bets': {'a': 0, 'b': 0}, 'folded': []}, [])],
[('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']}]),
('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']}])],
[('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']}]),
('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']}]),
('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']}]),
('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']}]),
('checked live player', {'bets': {'a': 0, 'b': 30, 'c': 10}, 'folded': ['c']},
[{'amount': 40, 'eligible': ['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']}]),
('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']}]),
('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': []}, [])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 |
| no chips committed | [] | [] | Passed |
SHA-256 / 0dcabfa3cb9cf1bf678122f5c1aa970a320d5d2b7a1c9683d07e0d14ac6d900a
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.249034+00:00.
Case digest / c336cae5df8665fee06d9cb1c15f3cfe9612dff857da186bf766b1c18c1f015b