FA-82016 / Poker hand evaluation / Open access
Partial contributions below a level are dropped · case 01
Chips from a folded short contributor vanish and the pots sum to less than the total bet.
ROOT CAUSE
Each layer is sized as layer height times the number of players who reached the level, ignoring players who only partly filled it.
VERIFIED REPAIR
Take from every player the slice of their commitment that lies between the previous and current levels.
Unsuccessful approach: Subtracting the previous level without clamping produces negative slices for players below it.
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=(lv-prev)*sum(1 for v in bets.values() if v>=lv)
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']}]),
('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']}])],
[('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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': []}, []),
('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']}])]]
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': 100, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}] | [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}] | Failed |
| folded between levels | [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}] | [{'amount': 150, 'eligible': ['a', 'b']}, {'amount': 75, 'eligible': ['a']}] | Failed |
| 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 |
| no chips committed | [] | [] | 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 / fc42baaefc3d21413697adbdc586b7148978baa24fab21de5f653fb068fc9b15
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)-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']}]),
('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']}])],
[('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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': []}, []),
('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']}])]]
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': 30, 'eligible': ['a']}] | [{'amount': 130, 'eligible': ['a', 'b']}, {'amount': 50, 'eligible': ['a']}] | Failed |
| 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': 40, 'eligible': ['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 |
| no chips committed | [] | [] | 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 / 7b068ac9a345993ff40d73b2277b8499101c3055fda1236a5bce72626af14cf8
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']}]),
('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']}])],
[('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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']}]),
('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': []}, []),
('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']}])]]
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 |
| no chips committed | [] | [] | 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 / 19e530705238ce5c66d30796ac0c267367acdfeecedcc5483d628e51ead1f4c7
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.237780+00:00.
Case digest / 11ad600d72dd3768832c7d8cdbdf42d97fcd10347c20d5f143bc784a695ed142