FAILURE MAP
← Case archive

FA-82146 / Poker hand evaluation / Open access

High-to-low pair dash range expands to nothing · case 01

"TT-77" counts zero combos.

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

ROOT CAUSE

The endpoints are taken in written order, so a descending range produces an empty loop.

VERIFIED REPAIR

Sort the two endpoints before looping.

Unsuccessful approach: Swapping the endpoints fixes "TT-77" but empties "77-TT".

Case contract

Input: a comma-separated hold'em range string. Tokens: pairs "77", "77+" (up to AA), "TT-77"; non-pairs "AKs"/"AKo"/"AK" (no suffix means both suited and offsuit), "A9s+" (kicker rises to one below the top card), "A9s-A6s" (inclusive). Whitespace around tokens is ignored. Duplicated classes count once. Return total combos: pair 6, suited 4, offsuit 12.

Why this case matters

Range combo counts drive equity, frequency and blocker arithmetic in solvers and trackers.

1 / The failure

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    classes=set()
    def add(h, suf):
        if h[0]==h[1]: classes.add(h)
        elif suf: classes.add(h+suf)
        else:
            classes.add(h+'s'); classes.add(h+'o')
    for tok in x.split(','):
        tok=tok.strip()
        if not tok: continue
        plus=tok.endswith('+')
        t=tok.rstrip('+')
        if '-' in t:
            a,b=t.split('-')
            if a[0]==a[1]:
                lo,hi=R.index(a[0]),R.index(b[0])
                for i in range(lo,hi+1): add(R[i]*2,'')
            else:
                lo,hi=sorted([R.index(a[1]),R.index(b[1])])
                for i in range(lo,hi+1): add(a[0]+R[i],a[2:])
            continue
        if t[0]==t[1]:
            start=R.index(t[0])
            stop=len(R)-1 if plus else start
            for i in range(start,stop+1): add(R[i]*2,'')
        else:
            top=R.index(t[0]); k=R.index(t[1])
            stop=top-1 if plus else k
            for i in range(k,stop+1): add(t[0]+R[i],t[2:])
    total=0
    for c in classes:
        if c[0]==c[1]: total+=6
        elif c.endswith('s'): total+=4
        else: total+=12
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('pairs plus', '77+', 48), ('queens plus', 'QQ+', 18), ('suited ace plus', 'A9s+', 20),
  ('offsuit king plus', 'KTo+', 36), ('unsuffixed class', 'AK', 16),
  ('dash kicker range', 'A9s-A6s', 16), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24)],
 [('offsuit king plus', 'KTo+', 36), ('unsuffixed class', 'AK', 16),
  ('dash kicker range', 'A9s-A6s', 16), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24), ('spaced tokens', 'QQ+, AKs', 22),
  ('overlap dedupe', 'AKs,AK', 16), ('single pair', '22', 6)],
 [('dash pair range', 'TT-77', 24), ('reversed dash pairs', '77-TT', 24),
  ('spaced tokens', 'QQ+, AKs', 22), ('overlap dedupe', 'AKs,AK', 16), ('single pair', '22', 6),
  ('mixed', 'JJ+,AQs+,KQo', 44), ('aces only', 'AA', 6), ('suited connector plus', 'T9s+', 4)],
 [('pairs plus', '77+', 48), ('dash pair range', 'TT-77', 24), ('reversed dash pairs', '77-TT', 24),
  ('mixed', 'JJ+,AQs+,KQo', 44), ('aces only', 'AA', 6), ('suited connector plus', 'T9s+', 4),
  ('trailing comma', 'KK+,', 12), ('reversed kicker dash', 'K6o-K9o', 48)],
 [('pairs plus', '77+', 48), ('queens plus', 'QQ+', 18), ('suited ace plus', 'A9s+', 20),
  ('offsuit king plus', 'KTo+', 36), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24), ('trailing comma', 'KK+,', 12),
  ('reversed kicker dash', 'K6o-K9o', 48)]]
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
pairs plus4848Passed
queens plus1818Passed
suited ace plus2020Passed
offsuit king plus3636Passed
unsuffixed class1616Passed
dash kicker range1616Passed
dash pair range024Failed
reversed dash pairs2424Passed

SHA-256 / 1dfde2c2eef6f5240b9df687b96265b389aee599de04cf8c5a5cd0a8aece6cbe

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    classes=set()
    def add(h, suf):
        if h[0]==h[1]: classes.add(h)
        elif suf: classes.add(h+suf)
        else:
            classes.add(h+'s'); classes.add(h+'o')
    for tok in x.split(','):
        tok=tok.strip()
        if not tok: continue
        plus=tok.endswith('+')
        t=tok.rstrip('+')
        if '-' in t:
            a,b=t.split('-')
            if a[0]==a[1]:
                lo,hi=R.index(b[0]),R.index(a[0])
                for i in range(lo,hi+1): add(R[i]*2,'')
            else:
                lo,hi=sorted([R.index(a[1]),R.index(b[1])])
                for i in range(lo,hi+1): add(a[0]+R[i],a[2:])
            continue
        if t[0]==t[1]:
            start=R.index(t[0])
            stop=len(R)-1 if plus else start
            for i in range(start,stop+1): add(R[i]*2,'')
        else:
            top=R.index(t[0]); k=R.index(t[1])
            stop=top-1 if plus else k
            for i in range(k,stop+1): add(t[0]+R[i],t[2:])
    total=0
    for c in classes:
        if c[0]==c[1]: total+=6
        elif c.endswith('s'): total+=4
        else: total+=12
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('pairs plus', '77+', 48), ('queens plus', 'QQ+', 18), ('suited ace plus', 'A9s+', 20),
  ('offsuit king plus', 'KTo+', 36), ('unsuffixed class', 'AK', 16),
  ('dash kicker range', 'A9s-A6s', 16), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24)],
 [('offsuit king plus', 'KTo+', 36), ('unsuffixed class', 'AK', 16),
  ('dash kicker range', 'A9s-A6s', 16), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24), ('spaced tokens', 'QQ+, AKs', 22),
  ('overlap dedupe', 'AKs,AK', 16), ('single pair', '22', 6)],
 [('dash pair range', 'TT-77', 24), ('reversed dash pairs', '77-TT', 24),
  ('spaced tokens', 'QQ+, AKs', 22), ('overlap dedupe', 'AKs,AK', 16), ('single pair', '22', 6),
  ('mixed', 'JJ+,AQs+,KQo', 44), ('aces only', 'AA', 6), ('suited connector plus', 'T9s+', 4)],
 [('pairs plus', '77+', 48), ('dash pair range', 'TT-77', 24), ('reversed dash pairs', '77-TT', 24),
  ('mixed', 'JJ+,AQs+,KQo', 44), ('aces only', 'AA', 6), ('suited connector plus', 'T9s+', 4),
  ('trailing comma', 'KK+,', 12), ('reversed kicker dash', 'K6o-K9o', 48)],
 [('pairs plus', '77+', 48), ('queens plus', 'QQ+', 18), ('suited ace plus', 'A9s+', 20),
  ('offsuit king plus', 'KTo+', 36), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24), ('trailing comma', 'KK+,', 12),
  ('reversed kicker dash', 'K6o-K9o', 48)]]
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
pairs plus4848Passed
queens plus1818Passed
suited ace plus2020Passed
offsuit king plus3636Passed
unsuffixed class1616Passed
dash kicker range1616Passed
dash pair range2424Passed
reversed dash pairs024Failed

SHA-256 / e1947ab5dcff8fa101bac9459d826af9242920a14b8663bbc205b5f2bc6ba1d6

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    R='23456789TJQKA'
    classes=set()
    def add(h, suf):
        if h[0]==h[1]: classes.add(h)
        elif suf: classes.add(h+suf)
        else:
            classes.add(h+'s'); classes.add(h+'o')
    for tok in x.split(','):
        tok=tok.strip()
        if not tok: continue
        plus=tok.endswith('+')
        t=tok.rstrip('+')
        if '-' in t:
            a,b=t.split('-')
            if a[0]==a[1]:
                lo,hi=sorted([R.index(a[0]),R.index(b[0])])
                for i in range(lo,hi+1): add(R[i]*2,'')
            else:
                lo,hi=sorted([R.index(a[1]),R.index(b[1])])
                for i in range(lo,hi+1): add(a[0]+R[i],a[2:])
            continue
        if t[0]==t[1]:
            start=R.index(t[0])
            stop=len(R)-1 if plus else start
            for i in range(start,stop+1): add(R[i]*2,'')
        else:
            top=R.index(t[0]); k=R.index(t[1])
            stop=top-1 if plus else k
            for i in range(k,stop+1): add(t[0]+R[i],t[2:])
    total=0
    for c in classes:
        if c[0]==c[1]: total+=6
        elif c.endswith('s'): total+=4
        else: total+=12
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('pairs plus', '77+', 48), ('queens plus', 'QQ+', 18), ('suited ace plus', 'A9s+', 20),
  ('offsuit king plus', 'KTo+', 36), ('unsuffixed class', 'AK', 16),
  ('dash kicker range', 'A9s-A6s', 16), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24)],
 [('offsuit king plus', 'KTo+', 36), ('unsuffixed class', 'AK', 16),
  ('dash kicker range', 'A9s-A6s', 16), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24), ('spaced tokens', 'QQ+, AKs', 22),
  ('overlap dedupe', 'AKs,AK', 16), ('single pair', '22', 6)],
 [('dash pair range', 'TT-77', 24), ('reversed dash pairs', '77-TT', 24),
  ('spaced tokens', 'QQ+, AKs', 22), ('overlap dedupe', 'AKs,AK', 16), ('single pair', '22', 6),
  ('mixed', 'JJ+,AQs+,KQo', 44), ('aces only', 'AA', 6), ('suited connector plus', 'T9s+', 4)],
 [('pairs plus', '77+', 48), ('dash pair range', 'TT-77', 24), ('reversed dash pairs', '77-TT', 24),
  ('mixed', 'JJ+,AQs+,KQo', 44), ('aces only', 'AA', 6), ('suited connector plus', 'T9s+', 4),
  ('trailing comma', 'KK+,', 12), ('reversed kicker dash', 'K6o-K9o', 48)],
 [('pairs plus', '77+', 48), ('queens plus', 'QQ+', 18), ('suited ace plus', 'A9s+', 20),
  ('offsuit king plus', 'KTo+', 36), ('dash pair range', 'TT-77', 24),
  ('reversed dash pairs', '77-TT', 24), ('trailing comma', 'KK+,', 12),
  ('reversed kicker dash', 'K6o-K9o', 48)]]
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
pairs plus4848Passed
queens plus1818Passed
suited ace plus2020Passed
offsuit king plus3636Passed
unsuffixed class1616Passed
dash kicker range1616Passed
dash pair range2424Passed
reversed dash pairs2424Passed

SHA-256 / 87e1a3c03243507865d3e073b19b97d181b86007777b1b28f5dda3f510c63be6

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

Case digest / 5a0905d4a848c41a276a805de27c109fa943c4730bdb90d7a8f8ed1f2e4866af