FAILURE MAP
← Case archive

FA-83796 / Card game rule engines / Open access

Games without the club jack count zero matadors · case 01

Declarers missing the top trumps score only the game level.

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

ROOT CAUSE

Matadors only count held cards.

VERIFIED REPAIR

Count the unbroken run of held or of missing cards, matching the club jack.

Unsuccessful approach: Capping the "without" run at the four jacks undercounts suit games missing more trumps.

Case contract

Input [game(D/H/S/C/G), trumps_held, hand, schneider, schwarz]. Base D9 H10 S11 C12 G24. Matadors count the unbroken run from CJ down the trump sequence (CJ SJ HJ DJ then A T K Q 9 8 7 of the suit; grand only jacks), either held ("with") or missing ("without"). Multiplier = matadors + 1 (game) + hand + schneider (implied by schwarz) + schwarz. Return base * multiplier.

Why this case matters

Card-game engines, scoring apps and online tables apply this rule automatically on every hand.

1 / The failure

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

N = 1
observations = []
def solve(x):
    game, held, hand, schneider, schwarz = x
    base = {'D': 9, 'H': 10, 'S': 11, 'C': 12, 'G': 24}[game]
    seq = ['CJ', 'SJ', 'HJ', 'DJ']
    if game != 'G':
        seq += [r + game for r in 'ATKQ987']
    has = set(held)
    first = seq[0] in has
    mat = 0
    for card in seq:
        if card in has:
            mat += 1
        else:
            break
    mult = mat + 1
    if hand:
        mult += 1
    if schneider or schwarz:
        mult += 1
    if schwarz:
        mult += 1
    return base * mult
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['D', ['DJ', 'TD', 'KD', 'QD', '9D', '8D'], False, True, True], 54], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC'], False, True, False], 108], [['C', ['CJ', 'SJ', 'HJ'], True, False, False], 60], [['G', ['CJ', 'SJ', 'DJ'], True, False, False], 96], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC', 'QC', '9C', '8C'], True, True, False], 156], [['H', ['AH', 'TH', 'KH', 'QH', '9H', '8H', '7H'], False, True, False], 60], [['G', ['CJ', 'SJ'], False, False, False], 72], [['C', ['9C', '8C', '7C'], False, False, False], 108]], [[['S', ['CJ', 'DJ', 'AS', '9S', '8S', '7S'], False, False, False], 22], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH', 'TH', 'KH'], False, False, False], 80], [['D', ['7D'], False, False, False], 99], [['D', ['CJ', 'AD', 'TD', 'QD'], False, False, False], 18], [['G', ['CJ', 'HJ'], False, True, False], 72], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'TD', 'KD', 'QD'], False, False, False], 81], [['H', ['AH', 'KH', '8H'], False, True, True], 70], [['S', ['KS', 'QS', '9S', '8S', '7S'], True, False, False], 88]], [[['D', ['CJ', 'HJ', 'KD', '9D', '8D'], False, True, False], 27], [['H', ['CJ'], False, False, False], 20], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH', 'TH', 'KH', 'QH'], True, True, False], 110], [['H', ['SJ', 'TH', 'KH', '9H', '7H'], False, True, False], 30], [['C', ['SJ', 'DJ', 'KC', 'QC', '8C', '7C'], False, False, False], 24], [['C', ['HJ', 'DJ'], False, False, False], 36], [['H', [], False, True, False], 130], [['H', ['7H'], False, False, False], 110]], [[['H', ['DJ', 'TH', 'KH', 'QH', '7H'], False, False, False], 40], [['C', ['KC', 'QC', '9C', '8C', '7C'], False, False, False], 84], [['C', ['9C', '8C', '7C'], False, False, True], 132], [['C', ['CJ', 'SJ', 'HJ', 'DJ'], False, False, False], 60], [['S', ['CJ', 'SJ', 'AS', 'TS', '7S'], False, True, True], 55], [['D', ['7D'], False, True, False], 108], [['D', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['H', ['8H', '7H'], False, True, True], 120]], [[['D', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['H', ['KH', 'QH', '9H', '8H', '7H'], False, False, False], 70], [['H', ['HJ', 'DJ', 'KH', '9H', '8H'], False, True, False], 40], [['C', ['CJ', 'DJ', 'AC', 'TC', '9C'], False, True, True], 48], [['H', ['SJ', 'AH', 'KH', '8H', '7H'], False, False, False], 20], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'TD', 'KD', 'QD', '9D'], False, True, True], 108], [['D', ['CJ', 'SJ', 'AD', 'TD', 'QD', '8D', '7D'], False, False, False], 27], [['C', ['QC', '9C', '8C', '7C'], False, True, False], 108]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("game value case %d" % i, solve(args), 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
game value case 02754Failed
game value case 1108108Passed
game value case 26060Passed
game value case 39696Passed
game value case 4156156Passed
game value case 52060Failed
game value case 67272Passed
game value case 712108Failed

SHA-256 / f2d43fa4993b4a5907ecd0761cb41e08607e68e0b63a26a6efbef3f1211119c4

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    game, held, hand, schneider, schwarz = x
    base = {'D': 9, 'H': 10, 'S': 11, 'C': 12, 'G': 24}[game]
    seq = ['CJ', 'SJ', 'HJ', 'DJ']
    if game != 'G':
        seq += [r + game for r in 'ATKQ987']
    has = set(held)
    first = seq[0] in has
    mat = 0
    for card in (seq if first else seq[:4]):
        if (card in has) == first:
            mat += 1
        else:
            break
    mult = mat + 1
    if hand:
        mult += 1
    if schneider or schwarz:
        mult += 1
    if schwarz:
        mult += 1
    return base * mult
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['D', ['DJ', 'TD', 'KD', 'QD', '9D', '8D'], False, True, True], 54], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC'], False, True, False], 108], [['C', ['CJ', 'SJ', 'HJ'], True, False, False], 60], [['G', ['CJ', 'SJ', 'DJ'], True, False, False], 96], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC', 'QC', '9C', '8C'], True, True, False], 156], [['H', ['AH', 'TH', 'KH', 'QH', '9H', '8H', '7H'], False, True, False], 60], [['G', ['CJ', 'SJ'], False, False, False], 72], [['C', ['9C', '8C', '7C'], False, False, False], 108]], [[['S', ['CJ', 'DJ', 'AS', '9S', '8S', '7S'], False, False, False], 22], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH', 'TH', 'KH'], False, False, False], 80], [['D', ['7D'], False, False, False], 99], [['D', ['CJ', 'AD', 'TD', 'QD'], False, False, False], 18], [['G', ['CJ', 'HJ'], False, True, False], 72], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'TD', 'KD', 'QD'], False, False, False], 81], [['H', ['AH', 'KH', '8H'], False, True, True], 70], [['S', ['KS', 'QS', '9S', '8S', '7S'], True, False, False], 88]], [[['D', ['CJ', 'HJ', 'KD', '9D', '8D'], False, True, False], 27], [['H', ['CJ'], False, False, False], 20], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH', 'TH', 'KH', 'QH'], True, True, False], 110], [['H', ['SJ', 'TH', 'KH', '9H', '7H'], False, True, False], 30], [['C', ['SJ', 'DJ', 'KC', 'QC', '8C', '7C'], False, False, False], 24], [['C', ['HJ', 'DJ'], False, False, False], 36], [['H', [], False, True, False], 130], [['H', ['7H'], False, False, False], 110]], [[['H', ['DJ', 'TH', 'KH', 'QH', '7H'], False, False, False], 40], [['C', ['KC', 'QC', '9C', '8C', '7C'], False, False, False], 84], [['C', ['9C', '8C', '7C'], False, False, True], 132], [['C', ['CJ', 'SJ', 'HJ', 'DJ'], False, False, False], 60], [['S', ['CJ', 'SJ', 'AS', 'TS', '7S'], False, True, True], 55], [['D', ['7D'], False, True, False], 108], [['D', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['H', ['8H', '7H'], False, True, True], 120]], [[['D', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['H', ['KH', 'QH', '9H', '8H', '7H'], False, False, False], 70], [['H', ['HJ', 'DJ', 'KH', '9H', '8H'], False, True, False], 40], [['C', ['CJ', 'DJ', 'AC', 'TC', '9C'], False, True, True], 48], [['H', ['SJ', 'AH', 'KH', '8H', '7H'], False, False, False], 20], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'TD', 'KD', 'QD', '9D'], False, True, True], 108], [['D', ['CJ', 'SJ', 'AD', 'TD', 'QD', '8D', '7D'], False, False, False], 27], [['C', ['QC', '9C', '8C', '7C'], False, True, False], 108]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("game value case %d" % i, solve(args), 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
game value case 05454Passed
game value case 1108108Passed
game value case 26060Passed
game value case 39696Passed
game value case 4156156Passed
game value case 56060Passed
game value case 67272Passed
game value case 760108Failed

SHA-256 / 69ffc5e67a63117a88684353f78ac0a2b7a07124f634d66a69311b36377ca7aa

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    game, held, hand, schneider, schwarz = x
    base = {'D': 9, 'H': 10, 'S': 11, 'C': 12, 'G': 24}[game]
    seq = ['CJ', 'SJ', 'HJ', 'DJ']
    if game != 'G':
        seq += [r + game for r in 'ATKQ987']
    has = set(held)
    first = seq[0] in has
    mat = 0
    for card in seq:
        if (card in has) == first:
            mat += 1
        else:
            break
    mult = mat + 1
    if hand:
        mult += 1
    if schneider or schwarz:
        mult += 1
    if schwarz:
        mult += 1
    return base * mult
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['D', ['DJ', 'TD', 'KD', 'QD', '9D', '8D'], False, True, True], 54], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC'], False, True, False], 108], [['C', ['CJ', 'SJ', 'HJ'], True, False, False], 60], [['G', ['CJ', 'SJ', 'DJ'], True, False, False], 96], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC', 'QC', '9C', '8C'], True, True, False], 156], [['H', ['AH', 'TH', 'KH', 'QH', '9H', '8H', '7H'], False, True, False], 60], [['G', ['CJ', 'SJ'], False, False, False], 72], [['C', ['9C', '8C', '7C'], False, False, False], 108]], [[['S', ['CJ', 'DJ', 'AS', '9S', '8S', '7S'], False, False, False], 22], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH', 'TH', 'KH'], False, False, False], 80], [['D', ['7D'], False, False, False], 99], [['D', ['CJ', 'AD', 'TD', 'QD'], False, False, False], 18], [['G', ['CJ', 'HJ'], False, True, False], 72], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'TD', 'KD', 'QD'], False, False, False], 81], [['H', ['AH', 'KH', '8H'], False, True, True], 70], [['S', ['KS', 'QS', '9S', '8S', '7S'], True, False, False], 88]], [[['D', ['CJ', 'HJ', 'KD', '9D', '8D'], False, True, False], 27], [['H', ['CJ'], False, False, False], 20], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH', 'TH', 'KH', 'QH'], True, True, False], 110], [['H', ['SJ', 'TH', 'KH', '9H', '7H'], False, True, False], 30], [['C', ['SJ', 'DJ', 'KC', 'QC', '8C', '7C'], False, False, False], 24], [['C', ['HJ', 'DJ'], False, False, False], 36], [['H', [], False, True, False], 130], [['H', ['7H'], False, False, False], 110]], [[['H', ['DJ', 'TH', 'KH', 'QH', '7H'], False, False, False], 40], [['C', ['KC', 'QC', '9C', '8C', '7C'], False, False, False], 84], [['C', ['9C', '8C', '7C'], False, False, True], 132], [['C', ['CJ', 'SJ', 'HJ', 'DJ'], False, False, False], 60], [['S', ['CJ', 'SJ', 'AS', 'TS', '7S'], False, True, True], 55], [['D', ['7D'], False, True, False], 108], [['D', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['H', ['8H', '7H'], False, True, True], 120]], [[['D', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['H', ['KH', 'QH', '9H', '8H', '7H'], False, False, False], 70], [['H', ['HJ', 'DJ', 'KH', '9H', '8H'], False, True, False], 40], [['C', ['CJ', 'DJ', 'AC', 'TC', '9C'], False, True, True], 48], [['H', ['SJ', 'AH', 'KH', '8H', '7H'], False, False, False], 20], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'TD', 'KD', 'QD', '9D'], False, True, True], 108], [['D', ['CJ', 'SJ', 'AD', 'TD', 'QD', '8D', '7D'], False, False, False], 27], [['C', ['QC', '9C', '8C', '7C'], False, True, False], 108]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("game value case %d" % i, solve(args), 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
game value case 05454Passed
game value case 1108108Passed
game value case 26060Passed
game value case 39696Passed
game value case 4156156Passed
game value case 56060Passed
game value case 67272Passed
game value case 7108108Passed

SHA-256 / bd8a22b1ffc09f1f2ab196d48a77c485b84666152de5724bad469a3be6842d01

Verification & scope

A bounded toy rule contract stated explicitly in the contract field; cards are two-character codes (rank, suit). Not a complete implementation of any published rulebook or casino table rules. 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:24.909030+00:00.

Case digest / 9e50ff14f9b149ade01495f30b23c7d062c13703e51629e53e37beffb6da76eb