FAILURE MAP
← Case archive

FA-82236 / Poker hand evaluation / Open access

Ace plays low in stud and high in razz · case 01

An ace door card brings in in seven-card stud, and a king does not bring in against an ace in razz.

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

ROOT CAUSE

The ace-low condition is attached to the wrong variant.

VERIFIED REPAIR

Only razz values the ace as 1 for bring-in purposes.

Unsuccessful approach: Making the ace low everywhere fixes razz but breaks stud and stud8.

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='cdhs'
    razz=x['variant']=='razz'
    def rv(c):
        if c[0]=='A' and not razz: 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 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')],
 [('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'),
  ('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 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 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, '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 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')],
 [('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'),
  ('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')]]
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 studabFailed
razz ace lowacFailed
razz suit tiebbPassed
stud8 uses stud rulebbPassed
stud8 ace highabFailed
spade vs heart tie studbbPassed

SHA-256 / 3ff66ead4d0a7f91fa3facbb6d6b473fbb6203ae472f4515384fb70d70153e81

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='cdhs'
    razz=x['variant']=='razz'
    def rv(c):
        if 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 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')],
 [('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'),
  ('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 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 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, '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 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')],
 [('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'),
  ('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')]]
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 studabFailed
razz ace lowccPassed
razz suit tiebbPassed
stud8 uses stud rulebbPassed
stud8 ace highabFailed
spade vs heart tie studbbPassed

SHA-256 / 6e57f10475abb022cdb7c6285f2e9b0c5cac5a27968b12212149ffac3b406002

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 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')],
 [('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'),
  ('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 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 ace high', {'up': {'a': 'Ad', 'b': '4d', 'c': '9s'}, 'variant': 'stud8'}, '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 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')],
 [('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'),
  ('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')]]
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 suit tiebbPassed
stud8 uses stud rulebbPassed
stud8 ace highbbPassed
spade vs heart tie studbbPassed

SHA-256 / 684c031e9ba4d7920b65a1f2fb4cb809a3d859b70fbd16f4d438a22d1c9fe3ae

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

Case digest / 203074b8852bdfaabd2f557e2158ea6d9e95083edd67a08b184652d0e5fb1516