FA-81951 / Poker hand evaluation / Open access
Paired ranks carry into the next bit · case 01
A pair inside a straight corrupts the mask and hides or invents straights.
ROOT CAUSE
The rank bits are added instead of OR-ed, so two cards of one rank carry into the next rank bit.
THE FAILURE
The rank bits are added instead of OR-ed, so two cards of one rank carry into the next rank bit.
Unsuccessful approach: XOR toggles the bit off for a pair, so a paired straight rank disappears.
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,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),
('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7)],
[('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),
('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
('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)],
[('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
('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),
('king-high straight', ['9h', 'Td', 'Jc', 'Qs', 'Kh', '3d', '2c'], 13),
('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
[('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),
('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),
('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),
('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
('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)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| wheel in seven | 0 | 5 | Failed |
| broadway | 14 | 14 | Passed |
| six-high over wheel | 6 | 6 | Passed |
| four-straight only | 0 | 0 | Passed |
| paired straight | 0 | 9 | Failed |
| no straight | 0 | 0 | Passed |
| seven-card long straight | 10 | 10 | Passed |
| pair of fours with straight | 0 | 7 | Failed |
SHA-256 / 93d101265f05c4962b9d0a164f5c626b24cd79b693a2d9b537a1f0532dba036b
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(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),
('no straight', ['2h', '5d', '7c', '9s', 'Jh', 'Kd', 'Ac'], 0),
('seven-card long straight', ['4h', '5d', '6c', '7s', '8h', '9d', 'Tc'], 10),
('pair of fours with straight', ['3h', '4d', '4c', '5s', '6h', '7d', 'Ac'], 7)],
[('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),
('five cards straight', ['6h', '7d', '8c', '9s', 'Th'], 10),
('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)],
[('paired straight', ['5h', '5d', '6c', '7s', '8h', '9d', 'Kc'], 9),
('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
('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),
('king-high straight', ['9h', 'Td', 'Jc', 'Qs', 'Kh', '3d', '2c'], 13),
('wheel without king', ['Ah', '2d', '3c', '4s', '5h', '9d', 'Jc'], 5)],
[('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),
('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),
('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),
('trips inside straight', ['5h', '5d', '5c', '6s', '7h', '8d', '9c'], 9),
('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)]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| wheel in seven | 5 | 5 | Passed |
| broadway | 14 | 14 | Passed |
| six-high over wheel | 6 | 6 | Passed |
| four-straight only | 0 | 0 | Passed |
| paired straight | 0 | 9 | Failed |
| no straight | 0 | 0 | Passed |
| seven-card long straight | 10 | 10 | Passed |
| pair of fours with straight | 0 | 7 | Failed |
SHA-256 / 5137d381558c5d05172354dc0540c04e886e16dd059ce33482c29157f723fa57
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.634245+00:00.
Case digest / d64d2c064cbc41b4c9feb105b4e29d03a2de088799e5ccda85e231c855a768dd