FAILURE MAP
← Case archive

FA-83486 / Card game rule engines / Open access

Aces count eleven deadwood · case 01

Hands holding aces are denied a legal knock.

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

ROOT CAUSE

Ace deadwood is 11.

THE FAILURE

Ace deadwood is 11.

Unsuccessful approach: Valuing faces by rank (J=11, Q=12, K=13) still overcounts court cards.

Case contract

Input [knocker_deadwood_cards, defender_deadwood_after_layoffs, gin, big_gin]. Deadwood: A=1, T/J/Q/K=10, others pip. Knocking above 10 is ["illegal", 0]. Big gin scores 31 + defender deadwood, gin 25 + defender deadwood (gin cannot be undercut). Otherwise if defender deadwood <= knocker deadwood the defender undercuts for 25 + difference; else knocker scores the difference.

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):
    kc, dc, gin, big = x
    def dw(cards):
        t = 0
        for c in cards:
            r = c[0]
            t += 11 if r == 'A' else 10 if r in 'TJQK' else int(r)
        return t
    k = dw(kc)
    d = dw(dc)
    if k > 10:
        return ['illegal', 0]
    if big:
        return ['knocker', 31 + d]
    if gin:
        return ['knocker', 25 + d]
    if d <= k:
        return ['defender', 25 + k - d]
    return ['knocker', d - k]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[], ['5H', 'JH', 'AC', '4H'], True, False], ['knocker', 45]], [[[], ['KS', '5S', '4H'], False, False], ['knocker', 19]], [[['KD', 'JH', '9S'], ['JS', '7D'], False, False], ['illegal', 0]], [[['4S', '4D', 'AS'], ['3D', 'JS', 'KD', '7D'], False, False], ['knocker', 21]], [[['TS', 'JC', '5S'], ['4H', '7C'], False, False], ['illegal', 0]], [[[], ['KS', 'TD', '5D', '7D'], False, False], ['knocker', 32]], [[[], ['7H', '5D'], False, False], ['knocker', 12]], [[['4S'], ['JH', '9H', '8C'], False, False], ['knocker', 23]]], [[[['6S', '8S', '6C'], ['4C', 'KH', '9S'], False, False], ['illegal', 0]], [[[], [], True, False], ['knocker', 25]], [[['6C'], [], False, False], ['defender', 31]], [[[], ['4D', 'JS'], True, False], ['knocker', 39]], [[['4S'], ['JH', '9H', '8C'], False, False], ['knocker', 23]], [[[], ['KH', '3D'], False, False], ['knocker', 13]], [[['2C'], ['2D', 'AH', 'JD', '5S'], False, False], ['knocker', 16]], [[[], ['JS', '8H', '7C'], False, False], ['knocker', 25]]], [[[['KH', '4H', 'JD'], [], False, False], ['illegal', 0]], [[[], ['8S', 'QD'], True, False], ['knocker', 43]], [[['7D', '7S'], ['2S', 'QC'], False, False], ['illegal', 0]], [[['2C'], ['2D', 'AH', 'JD', '5S'], False, False], ['knocker', 16]], [[[], ['3C', '3H', '5S'], True, False], ['knocker', 36]], [[['AC', '9D', 'AD'], ['8S'], False, False], ['illegal', 0]], [[['AD'], ['KC', '9H', '5C', '5D'], False, False], ['knocker', 28]], [[['3H', '3D'], ['9C', 'KS', '7S'], False, False], ['knocker', 20]]], [[[[], ['JS', '8H', '7C'], False, False], ['knocker', 25]], [[[], ['2C'], False, False], ['knocker', 2]], [[[], ['KD'], False, False], ['knocker', 10]], [[[], [], True, False], ['knocker', 25]], [[['TH', '3H', 'KC'], ['TD', 'AS', 'JD', '5H'], False, False], ['illegal', 0]], [[['TH', '8S'], ['QC', '5S', '2S', '6D'], False, False], ['illegal', 0]], [[['2D', 'AD', '4S'], [], False, False], ['defender', 32]], [[['6H'], ['QH', 'TH', 'TC'], False, False], ['knocker', 24]]], [[[[], ['8D', 'KC', '7C', 'AC'], False, False], ['knocker', 26]], [[['TH', '6C'], ['6D', 'QC'], False, False], ['illegal', 0]], [[['9C'], ['8S', 'JD'], False, False], ['knocker', 9]], [[['5H', '6D'], ['QH', '8D', 'KH'], False, False], ['illegal', 0]], [[['QC', 'JD'], ['7C', 'KH', '8C', '5S'], False, False], ['illegal', 0]], [[[], ['4D', '3S'], False, False], ['knocker', 7]], [[[], ['4S', 'AH', '8C', 'JS'], True, True], ['knocker', 54]], [[['7C', 'AS'], ['8S', 'AH', 'QH'], False, False], ['knocker', 11]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("knock score 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
knock score case 0['knocker', 55]['knocker', 45]Failed
knock score case 1['knocker', 19]['knocker', 19]Passed
knock score case 2['illegal', 0]['illegal', 0]Passed
knock score case 3['illegal', 0]['knocker', 21]Failed
knock score case 4['illegal', 0]['illegal', 0]Passed
knock score case 5['knocker', 32]['knocker', 32]Passed
knock score case 6['knocker', 12]['knocker', 12]Passed
knock score case 7['knocker', 23]['knocker', 23]Passed

SHA-256 / 4c1cd323cbe40c66d4e2693cc9f9c6d3483f4b9c8e75392f7c101d1a41ad2693

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    kc, dc, gin, big = x
    def dw(cards):
        t = 0
        for c in cards:
            r = c[0]
            t += 1 if r == 'A' else 10 if r == 'T' else {'J': 11, 'Q': 12, 'K': 13}[r] if r in 'JQK' else int(r)
        return t
    k = dw(kc)
    d = dw(dc)
    if k > 10:
        return ['illegal', 0]
    if big:
        return ['knocker', 31 + d]
    if gin:
        return ['knocker', 25 + d]
    if d <= k:
        return ['defender', 25 + k - d]
    return ['knocker', d - k]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[], ['5H', 'JH', 'AC', '4H'], True, False], ['knocker', 45]], [[[], ['KS', '5S', '4H'], False, False], ['knocker', 19]], [[['KD', 'JH', '9S'], ['JS', '7D'], False, False], ['illegal', 0]], [[['4S', '4D', 'AS'], ['3D', 'JS', 'KD', '7D'], False, False], ['knocker', 21]], [[['TS', 'JC', '5S'], ['4H', '7C'], False, False], ['illegal', 0]], [[[], ['KS', 'TD', '5D', '7D'], False, False], ['knocker', 32]], [[[], ['7H', '5D'], False, False], ['knocker', 12]], [[['4S'], ['JH', '9H', '8C'], False, False], ['knocker', 23]]], [[[['6S', '8S', '6C'], ['4C', 'KH', '9S'], False, False], ['illegal', 0]], [[[], [], True, False], ['knocker', 25]], [[['6C'], [], False, False], ['defender', 31]], [[[], ['4D', 'JS'], True, False], ['knocker', 39]], [[['4S'], ['JH', '9H', '8C'], False, False], ['knocker', 23]], [[[], ['KH', '3D'], False, False], ['knocker', 13]], [[['2C'], ['2D', 'AH', 'JD', '5S'], False, False], ['knocker', 16]], [[[], ['JS', '8H', '7C'], False, False], ['knocker', 25]]], [[[['KH', '4H', 'JD'], [], False, False], ['illegal', 0]], [[[], ['8S', 'QD'], True, False], ['knocker', 43]], [[['7D', '7S'], ['2S', 'QC'], False, False], ['illegal', 0]], [[['2C'], ['2D', 'AH', 'JD', '5S'], False, False], ['knocker', 16]], [[[], ['3C', '3H', '5S'], True, False], ['knocker', 36]], [[['AC', '9D', 'AD'], ['8S'], False, False], ['illegal', 0]], [[['AD'], ['KC', '9H', '5C', '5D'], False, False], ['knocker', 28]], [[['3H', '3D'], ['9C', 'KS', '7S'], False, False], ['knocker', 20]]], [[[[], ['JS', '8H', '7C'], False, False], ['knocker', 25]], [[[], ['2C'], False, False], ['knocker', 2]], [[[], ['KD'], False, False], ['knocker', 10]], [[[], [], True, False], ['knocker', 25]], [[['TH', '3H', 'KC'], ['TD', 'AS', 'JD', '5H'], False, False], ['illegal', 0]], [[['TH', '8S'], ['QC', '5S', '2S', '6D'], False, False], ['illegal', 0]], [[['2D', 'AD', '4S'], [], False, False], ['defender', 32]], [[['6H'], ['QH', 'TH', 'TC'], False, False], ['knocker', 24]]], [[[[], ['8D', 'KC', '7C', 'AC'], False, False], ['knocker', 26]], [[['TH', '6C'], ['6D', 'QC'], False, False], ['illegal', 0]], [[['9C'], ['8S', 'JD'], False, False], ['knocker', 9]], [[['5H', '6D'], ['QH', '8D', 'KH'], False, False], ['illegal', 0]], [[['QC', 'JD'], ['7C', 'KH', '8C', '5S'], False, False], ['illegal', 0]], [[[], ['4D', '3S'], False, False], ['knocker', 7]], [[[], ['4S', 'AH', '8C', 'JS'], True, True], ['knocker', 54]], [[['7C', 'AS'], ['8S', 'AH', 'QH'], False, False], ['knocker', 11]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("knock score 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
knock score case 0['knocker', 46]['knocker', 45]Failed
knock score case 1['knocker', 22]['knocker', 19]Failed
knock score case 2['illegal', 0]['illegal', 0]Passed
knock score case 3['knocker', 25]['knocker', 21]Failed
knock score case 4['illegal', 0]['illegal', 0]Passed
knock score case 5['knocker', 35]['knocker', 32]Failed
knock score case 6['knocker', 12]['knocker', 12]Passed
knock score case 7['knocker', 24]['knocker', 23]Failed

SHA-256 / ae6df58db546cb03f8d5ec262e9a938e7102c52a0aaf49ce94a4c31228dbc3bd

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

Case digest / fccd3343230af13f430d80b29b9555956378fa2938cb780b1c7453b55618491c