FAILURE MAP
← Case archive

FA-81941 / Poker hand evaluation / Open access

Scan stops before the five-high window · case 01

A wheel is reported as no straight although the ace bit is mirrored.

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

ROOT CAUSE

The top-rank loop ends at 6, so the window topped by 5 is never checked.

VERIFIED REPAIR

Scan top ranks 14 down to 5 inclusive.

Unsuccessful approach: Starting at 13 finds the wheel but never checks the broadway window.

Case contract

Input: 5 to 7 distinct cards "Rs". Build a rank bitmask (bit r for rank value r, 2..14; the ace also sets bit 1). Return the top rank of the highest five-card straight contained in the ranks (5 for the wheel), or 0 if none.

Why this case matters

Bitmask evaluators are the standard fast path for seven-card hold'em straights.

1 / The failure

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    m=0
    for c in x:
        m|=1<<(R.index(c[0])+2)
    if m & (1<<14): m|=1<<1
    for top in range(14,5,-1):
        need=0b11111<<(top-4)
        if m & need == need: return top
    return 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('six-high over wheel', ['Ah', '2d', '3c', '4s', '5h', '6d', 'Jc'], 6),
  ('four-straight only', ['9h', 'Td', 'Jc', 'Qs', '2h', '2d', '3c'], 0),
  ('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
  ('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
  ('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
  ('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
  ('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
  ('ace-king-queen-jack only', ['Ah', 'Kd', 'Qc', 'Js', '9h'], 0),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('two pair inside straight', ['8h', '8d', '9c', '9s', 'Th', 'Jd', 'Qc'], 12),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('two pair inside straight', ['8h', '8d', '9c', '9s', 'Th', 'Jd', 'Qc'], 12),
  ('king-high straight', ['9h', 'Td', 'Jc', 'Qs', 'Kh', '3d', '2c'], 13),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0),
  ('no straight low cards', ['2h', '3d', '4c', '8s', '9h', 'Qd', 'Qc'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('six-high over wheel', ['Ah', '2d', '3c', '4s', '5h', '6d', 'Jc'], 6),
  ('four-straight only', ['9h', 'Td', 'Jc', 'Qs', '2h', '2d', '3c'], 0),
  ('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0),
  ('no straight low cards', ['2h', '3d', '4c', '8s', '9h', 'Qd', 'Qc'], 0)]]
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
wheel in seven05Failed
broadway1414Passed
six-high over wheel66Passed
four-straight only00Passed
paired straight99Passed
trips inside straight99Passed
no straight00Passed
wheel without king05Failed

SHA-256 / ff29a957df6ec0f3d2f6b2d5edfcc1a50b7121699383c8d7a4bd2e39d883a187

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    m=0
    for c in x:
        m|=1<<(R.index(c[0])+2)
    if m & (1<<14): m|=1<<1
    for top in range(13,4,-1):
        need=0b11111<<(top-4)
        if m & need == need: return top
    return 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('six-high over wheel', ['Ah', '2d', '3c', '4s', '5h', '6d', 'Jc'], 6),
  ('four-straight only', ['9h', 'Td', 'Jc', 'Qs', '2h', '2d', '3c'], 0),
  ('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
  ('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
  ('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
  ('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
  ('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
  ('ace-king-queen-jack only', ['Ah', 'Kd', 'Qc', 'Js', '9h'], 0),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('two pair inside straight', ['8h', '8d', '9c', '9s', 'Th', 'Jd', 'Qc'], 12),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('two pair inside straight', ['8h', '8d', '9c', '9s', 'Th', 'Jd', 'Qc'], 12),
  ('king-high straight', ['9h', 'Td', 'Jc', 'Qs', 'Kh', '3d', '2c'], 13),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0),
  ('no straight low cards', ['2h', '3d', '4c', '8s', '9h', 'Qd', 'Qc'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('six-high over wheel', ['Ah', '2d', '3c', '4s', '5h', '6d', 'Jc'], 6),
  ('four-straight only', ['9h', 'Td', 'Jc', 'Qs', '2h', '2d', '3c'], 0),
  ('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0),
  ('no straight low cards', ['2h', '3d', '4c', '8s', '9h', 'Qd', 'Qc'], 0)]]
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
wheel in seven55Passed
broadway014Failed
six-high over wheel66Passed
four-straight only00Passed
paired straight99Passed
trips inside straight99Passed
no straight00Passed
wheel without king55Passed

SHA-256 / f3802987bac80d130ada7823f2b2709a51b84f4ed1d18ccc19c296b6b9a6a077

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    m=0
    for c in x:
        m|=1<<(R.index(c[0])+2)
    if m & (1<<14): m|=1<<1
    for top in range(14,4,-1):
        need=0b11111<<(top-4)
        if m & need == need: return top
    return 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('six-high over wheel', ['Ah', '2d', '3c', '4s', '5h', '6d', 'Jc'], 6),
  ('four-straight only', ['9h', 'Td', 'Jc', 'Qs', '2h', '2d', '3c'], 0),
  ('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
  ('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
  ('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
  ('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
  ('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
  ('ace-king-queen-jack only', ['Ah', 'Kd', 'Qc', 'Js', '9h'], 0),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('two pair inside straight', ['8h', '8d', '9c', '9s', 'Th', 'Jd', 'Qc'], 12),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('two pair inside straight', ['8h', '8d', '9c', '9s', 'Th', 'Jd', 'Qc'], 12),
  ('king-high straight', ['9h', 'Td', 'Jc', 'Qs', 'Kh', '3d', '2c'], 13),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0),
  ('no straight low cards', ['2h', '3d', '4c', '8s', '9h', 'Qd', 'Qc'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('broadway', ['Th', 'Jd', 'Qc', 'Ks', 'Ah', '2c', '2d'], 14),
  ('six-high over wheel', ['Ah', '2d', '3c', '4s', '5h', '6d', 'Jc'], 6),
  ('four-straight only', ['9h', 'Td', 'Jc', 'Qs', '2h', '2d', '3c'], 0),
  ('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0),
  ('no straight low cards', ['2h', '3d', '4c', '8s', '9h', 'Qd', 'Qc'], 0)]]
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
wheel in seven55Passed
broadway1414Passed
six-high over wheel66Passed
four-straight only00Passed
paired straight99Passed
trips inside straight99Passed
no straight00Passed
wheel without king55Passed

SHA-256 / c44170d1f1404cfb154b778a2163bdd3dff20eced46b5ed7893e7d06d2dc5369

Verification & scope

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

Case digest / 7392cc42c295ae8de91ac9553017e2c99943d4b6f81412e62eec6b9df664d4b3