FAILURE MAP
← Case archive

FA-82261 / Poker hand evaluation / Open access

Folded board still acts first · case 01

A player who folded a pair of aces is named first to act.

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

ROOT CAUSE

Players are skipped only if they have no up cards; folded players keep their exposed cards in the record.

VERIFIED REPAIR

Skip every player in the folded list.

Unsuccessful approach: Slicing the folded list skips its first entry.

Case contract

Input: {"seats": [clockwise order from the dealer's left], "hands": {player: {"up": [...], "down": [...]}}, "folded": [...]}. On fourth street and later the live player with the best exposed hand acts first. Exposed hands rank by group shape (quads > trips > two pair > pair > no pair), then by group ranks; only up cards count. Exact ties go to the player earliest in seat order.

Why this case matters

Acting order on later stud streets follows the best board, not position.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import collections
N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    def show(cards):
        vals=sorted((R.index(c[0])+2 for c in cards), reverse=True)
        cnt=collections.Counter(vals)
        order=sorted(cnt, key=lambda v:(cnt[v],v), reverse=True)
        shape=sorted(cnt.values(), reverse=True)
        return (shape, order)
    best=None; who=None
    for p in x['seats']:
        if not x['hands'][p]['up']: continue
        k=show(x['hands'][p]['up'])
        if best is None or k>best: best, who = k, p
    return who
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b')],
 [('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('high cards only',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', '9d', '4c']},
              'b': {'down': ['2d', '4d'], 'up': ['Kc', 'Td', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('high cards only',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', '9d', '4c']},
              'b': {'down': ['2d', '4d'], 'up': ['Kc', 'Td', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   '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
pair beats ace kingbbPassed
hidden pair ignoredaaPassed
hidden trips ignoredbbPassed
tie goes to earlier seataaPassed
tie seat order not namebbPassed
folded best boardabFailed
two pair beats pairbbPassed
higher pair winsbbPassed

SHA-256 / 1102948c43fa8526af2163f9b7cb665e88956aade0583acaa1c53b5306552e44

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import collections
N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    def show(cards):
        vals=sorted((R.index(c[0])+2 for c in cards), reverse=True)
        cnt=collections.Counter(vals)
        order=sorted(cnt, key=lambda v:(cnt[v],v), reverse=True)
        shape=sorted(cnt.values(), reverse=True)
        return (shape, order)
    best=None; who=None
    for p in x['seats']:
        if p in x['folded'][1:]: continue
        k=show(x['hands'][p]['up'])
        if best is None or k>best: best, who = k, p
    return who
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b')],
 [('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('high cards only',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', '9d', '4c']},
              'b': {'down': ['2d', '4d'], 'up': ['Kc', 'Td', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('high cards only',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', '9d', '4c']},
              'b': {'down': ['2d', '4d'], 'up': ['Kc', 'Td', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   '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
pair beats ace kingbbPassed
hidden pair ignoredaaPassed
hidden trips ignoredbbPassed
tie goes to earlier seataaPassed
tie seat order not namebbPassed
folded best boardabFailed
two pair beats pairbbPassed
higher pair winsbbPassed

SHA-256 / d099828b5dab4e6f2b83c1d03d1f792250d4a0206837cb1a7ba258d92f4e0eea

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import collections
N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    def show(cards):
        vals=sorted((R.index(c[0])+2 for c in cards), reverse=True)
        cnt=collections.Counter(vals)
        order=sorted(cnt, key=lambda v:(cnt[v],v), reverse=True)
        shape=sorted(cnt.values(), reverse=True)
        return (shape, order)
    best=None; who=None
    for p in x['seats']:
        if p in x['folded']: continue
        k=show(x['hands'][p]['up'])
        if best is None or k>best: best, who = k, p
    return who
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b')],
 [('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('high cards only',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', '9d', '4c']},
              'b': {'down': ['2d', '4d'], 'up': ['Kc', 'Td', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('high cards only',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', '9d', '4c']},
              'b': {'down': ['2d', '4d'], 'up': ['Kc', 'Td', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('pair beats ace king',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['7h', '7d']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['a', 'b', 'c']},
   'b'),
  ('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('three-way tie later seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Jh', '7d']},
              'b': {'down': ['2d', '4d'], 'up': ['Jc', '7h']},
              'c': {'down': ['2h', '4h'], 'up': ['Js', '7c']}},
    'seats': ['b', 'c', 'a']},
   'b')],
 [('hidden pair ignored',
   {'folded': [],
    'hands': {'a': {'down': ['Ac', 'Kc'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'a'),
  ('hidden trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('tie goes to earlier seat',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Kd']},
              'b': {'down': ['2d', '3d'], 'up': ['As', 'Kc']},
              'c': {'down': ['2h', '3h'], 'up': ['9h', '4d']}},
    'seats': ['c', 'a', 'b']},
   'a'),
  ('tie seat order not name',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Qh', 'Qd']},
              'b': {'down': ['2d', '3d'], 'up': ['Qs', 'Qc']}},
    'seats': ['b', 'a']},
   'b'),
  ('folded best board',
   {'folded': ['a'],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad']},
              'b': {'down': ['2d', '3d'], 'up': ['Qh', 'Jd']}},
    'seats': ['a', 'b']},
   'b'),
  ('two pair beats pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Ah', 'Ad', 'Kc']},
              'b': {'down': ['2d', '3d'], 'up': ['5h', '5d', '4c', '4s']}},
    'seats': ['a', 'b']},
   'b'),
  ('higher pair wins',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['8h', '8d', 'Ac']},
              'b': {'down': ['2d', '3d'], 'up': ['9h', '9d', '2s']}},
    'seats': ['a', 'b']},
   'b'),
  ('trips beat two pair',
   {'folded': [],
    'hands': {'a': {'down': ['2c', '3c'], 'up': ['Kh', 'Kd', 'Qc', 'Qs']},
              'b': {'down': ['2d', '4d'], 'up': ['3h', '3d', '3s', '2s']}},
    'seats': ['a', 'b']},
   '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
pair beats ace kingbbPassed
hidden pair ignoredaaPassed
hidden trips ignoredbbPassed
tie goes to earlier seataaPassed
tie seat order not namebbPassed
folded best boardbbPassed
two pair beats pairbbPassed
higher pair winsbbPassed

SHA-256 / 00c2188504c708a68757b48891ca0078544446e6de8d1261330854a2b50e6089

Verification & scope

A deterministic toy model with an explicitly stated contract; card strings are rank+suit (for example "As", "Td"); 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:10.498590+00:00.

Case digest / a714ce4692ea182b3ad93e00d583f58fd3d36f8188def79885a2bf25d06b016f