FAILURE MAP
← Case archive

FA-81936 / Poker hand evaluation / Open access

Ace mirrored into the wrong low bit · case 01

A-2-3-4-5 in a seven-card hand is not found as a straight.

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

ROOT CAUSE

The ace is copied into bit 0, but the deuce sits at bit 2 so the wheel needs bit 1.

VERIFIED REPAIR

Mirror the ace (bit 14) into bit 1 before scanning.

Unsuccessful approach: Testing bit 13 mirrors the king instead of the ace.

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<<0
    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),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('ace-king-queen-jack only', ['Ah', 'Kd', 'Qc', 'Js', '9h'], 0),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('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),
  ('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)]]
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
wheel without king05Failed
king with low run00Passed

SHA-256 / 2bb97d857612248c43340bb4bab3b220253f9fbc4e19d5fe91b7b5be8de6fe43

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<<13): 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),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('ace-king-queen-jack only', ['Ah', 'Kd', 'Qc', 'Js', '9h'], 0),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('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),
  ('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)]]
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
wheel without king05Failed
king with low run50Failed

SHA-256 / 7894178614bad316274b38ad7cd548cb8ec83c7b704ec4a07ab0364a3fce1470

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),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
  ('gap straight', ['2h', '3d', '4c', '6s', '7h', '8d', '9c'], 0),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('ace-king-queen-jack only', ['Ah', 'Kd', 'Qc', 'Js', '9h'], 0),
  ('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7),
  ('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5),
  ('king with low run', ['Kh', '2d', '3c', '4s', '5h', '9d'], 0)],
 [('wheel in seven', ['Ah', '2d', '3c', '4s', '5h', 'Kd', 'Kc'], 5),
  ('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),
  ('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),
  ('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)]]
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
wheel without king55Passed
king with low run00Passed

SHA-256 / 60f4cd535b1936dc4a4bc622a21d25645ef3604efbc645ec1d16a1cf315fa8ab

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

Case digest / 758b1538e9f67ec8210ca16f796b2e2bc83c0f3e25a7962d6722a2a74e79f627