FAILURE MAP
← Case archive

FA-82251 / Poker hand evaluation / Open access

Hole cards influence the stud acting order · case 01

A player with a hidden pair is made to act first over a better board.

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

ROOT CAUSE

The exposed-hand ranking includes the face-down cards.

VERIFIED REPAIR

Rank only the face-up cards when deciding who acts first.

Unsuccessful approach: Ranking the down cards alone ignores the board entirely.

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 p in x['folded']: continue
        k=show(x['hands'][p]['up']+x['hands'][p]['down'])
        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 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'),
  ('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 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'),
  ('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'),
  ('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')],
 [('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 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')],
 [('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 trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('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'),
  ('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')]]
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 ignoredabFailed
tie seat order not namebbPassed
folded best boardbbPassed
trips beat two pairbbPassed
high cards onlybbPassed
three-way tie later seatbbPassed

SHA-256 / ee1c1d36fca94c845d9373598b247a55d15756459da76a27e68a40b3e2992a41

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']: continue
        k=show(x['hands'][p]['down'])
        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 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'),
  ('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 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'),
  ('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'),
  ('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')],
 [('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 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')],
 [('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 trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('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'),
  ('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')]]
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 kingabFailed
hidden pair ignoredaaPassed
hidden trips ignoredabFailed
tie seat order not namebbPassed
folded best boardbbPassed
trips beat two pairbbPassed
high cards onlybbPassed
three-way tie later seatbbPassed

SHA-256 / 01c914f5c72cd97fbcd262acd05280246d1cd935e9cbdb54f70db1b2a6edc932

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 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'),
  ('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 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'),
  ('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'),
  ('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')],
 [('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 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')],
 [('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 trips ignored',
   {'folded': [],
    'hands': {'a': {'down': ['9c', '9s'], 'up': ['9h', '4d']},
              'b': {'down': ['5d', '3d'], 'up': ['Th', '2d']}},
    'seats': ['a', 'b']},
   'b'),
  ('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'),
  ('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')]]
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 seat order not namebbPassed
folded best boardbbPassed
trips beat two pairbbPassed
high cards onlybbPassed
three-way tie later seatbbPassed

SHA-256 / 835bf9b9192f593393919e7427ca3f9bf5badb1a83591a834971f786e6f6200c

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

Case digest / 684fa1d3bcfa86252fc66c7d905e270eace29aea5983bc3dd08faa09328dfe24