FAILURE MAP
← Case archive

FA-82231 / Poker hand evaluation / Open access

Bring-in suit ranking stored strongest first · case 01

With two deuces showing, the deuce of hearts brings in instead of the deuce of clubs.

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

ROOT CAUSE

The suit table is written spades-first, reversing the tiebreak order.

VERIFIED REPAIR

Order suits clubs, diamonds, hearts, spades from lowest to highest.

Unsuccessful approach: Swapping clubs and diamonds still misorders the two lowest suits.

Case contract

Input: {"variant": "stud", "stud8" or "razz", "up": {player: door card}}. In stud and stud8 the lowest door card brings in (ace high); ties are broken by suit with clubs lowest, then diamonds, hearts, spades. In razz the highest door card brings in (ace low), ties going to the highest suit. Return the bring-in player.

Why this case matters

The bring-in decides who is forced to act first on third street.

1 / The failure

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'; S='shdc'
    razz=x['variant']=='razz'
    def rv(c):
        if razz and c[0]=='A': return 1
        return R.index(c[0])+2
    def k(p):
        c=x['up'][p]
        return (rv(c), S.index(c[1]))
    players=sorted(x['up'])
    return max(players, key=k) if razz else min(players, key=k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b')],
 [('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('spade vs heart tie stud', {'up': {'a': '4s', 'b': '4h', 'c': 'Js'}, 'variant': 'stud'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('spade vs heart tie stud', {'up': {'a': '4s', 'b': '4h', 'c': 'Js'}, 'variant': 'stud'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, '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
lowest deucebbPassed
deuce suit tieabFailed
ace is high in studbbPassed
razz ace lowccPassed
razz ace vs deuceccPassed
razz suit tieabFailed
stud8 uses stud rulebbPassed
diamond vs club tie studabFailed

SHA-256 / 69d96733c251342c767be54d964234ff1cfb95f877023407997ddf4f84ab2aa3

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'; S='dchs'
    razz=x['variant']=='razz'
    def rv(c):
        if razz and c[0]=='A': return 1
        return R.index(c[0])+2
    def k(p):
        c=x['up'][p]
        return (rv(c), S.index(c[1]))
    players=sorted(x['up'])
    return max(players, key=k) if razz else min(players, key=k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b')],
 [('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('spade vs heart tie stud', {'up': {'a': '4s', 'b': '4h', 'c': 'Js'}, 'variant': 'stud'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('spade vs heart tie stud', {'up': {'a': '4s', 'b': '4h', 'c': 'Js'}, 'variant': 'stud'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, '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
lowest deucebbPassed
deuce suit tiebbPassed
ace is high in studbbPassed
razz ace lowccPassed
razz ace vs deuceccPassed
razz suit tiebbPassed
stud8 uses stud rulebbPassed
diamond vs club tie studabFailed

SHA-256 / 7ad3698b05135378c22bd39e2c79b964b1e676f528e9e7661320f68dccd493d9

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'; S='cdhs'
    razz=x['variant']=='razz'
    def rv(c):
        if razz and c[0]=='A': return 1
        return R.index(c[0])+2
    def k(p):
        c=x['up'][p]
        return (rv(c), S.index(c[1]))
    players=sorted(x['up'])
    return max(players, key=k) if razz else min(players, key=k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b')],
 [('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('spade vs heart tie stud', {'up': {'a': '4s', 'b': '4h', 'c': 'Js'}, 'variant': 'stud'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz suit tie', {'up': {'a': 'Kc', 'b': 'Ks', 'c': '5s'}, 'variant': 'razz'}, 'b'),
  ('spade vs heart tie stud', {'up': {'a': '4s', 'b': '4h', 'c': 'Js'}, 'variant': 'stud'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('lowest deuce', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, 'b')],
 [('deuce suit tie', {'up': {'a': '2h', 'b': '2c', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('ace is high in stud', {'up': {'a': 'Ah', 'b': '3d', 'c': '9s'}, 'variant': 'stud'}, 'b'),
  ('razz ace low', {'up': {'a': 'Ah', 'b': '3d', 'c': 'Ks'}, 'variant': 'razz'}, 'c'),
  ('razz ace vs deuce', {'up': {'a': 'Ah', 'b': '2d', 'c': '5s'}, 'variant': 'razz'}, 'c'),
  ('stud8 uses stud rule', {'up': {'a': 'Kh', 'b': '2d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('stud8 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, 'b'),
  ('diamond vs club tie stud', {'up': {'a': '5d', 'b': '5c'}, 'variant': 'stud'}, 'b'),
  ('razz heart vs diamond', {'up': {'a': 'Qd', 'b': 'Qh', 'c': '2s'}, 'variant': 'razz'}, '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
lowest deucebbPassed
deuce suit tiebbPassed
ace is high in studbbPassed
razz ace lowccPassed
razz ace vs deuceccPassed
razz suit tiebbPassed
stud8 uses stud rulebbPassed
diamond vs club tie studbbPassed

SHA-256 / 9d149e4b4791114ac7702255ddce42292db09a38962adc42d1817a34f69b2537

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

Case digest / ec822fab16368ae43122e3f4515fb113027ea63ce08201f1fb724eafcc772611