FAILURE MAP
← Case archive

FA-83501 / Card game rule engines / Open access

Matching rank without suit is refused · case 01

A seven cannot be played on a seven of another suit.

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

ROOT CAUSE

Only the suit match is tested.

THE FAILURE

Only the suit match is tested.

Unsuccessful approach: Requiring the identical card only works with duplicate decks.

Case contract

Input [card, top_card, declared_suit_or_None]. Eights are always playable. When the top card is an 8 with a declared suit, only that suit (or an 8) may follow. Otherwise match suit or rank. Return a bool.

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):
    card, top, declared = x
    if card[0] == '8':
        return True
    if top[0] == '8' and declared:
        return card[1] == declared
    return card[1] == top[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['AH', '6H', None], True], [['7H', '8C', 'C'], False], [['8C', '8S', 'S'], True], [['JD', '8S', None], False], [['8S', '8H', 'S'], True], [['TS', '3H', None], False], [['2H', '2C', None], True], [['QS', 'QD', None], True]], [[['8C', 'JD', None], True], [['6H', 'TC', None], False], [['KC', '6H', None], False], [['2D', '3C', None], False], [['8C', '4D', None], True], [['7C', 'QC', None], True], [['JS', 'JH', None], True], [['JS', 'JH', None], True]], [[['JH', '7C', None], False], [['JS', '8C', 'C'], False], [['3C', '8H', None], False], [['6C', '8S', 'C'], True], [['AH', 'TC', None], False], [['KH', '8H', 'H'], True], [['2H', '2C', None], True], [['QS', 'QD', None], True]], [[['TC', '8C', 'D'], False], [['2H', '2C', None], True], [['6S', '4D', None], False], [['2S', '8C', 'S'], True], [['AC', '8D', 'S'], False], [['8C', '8C', 'H'], True], [['2H', '2C', None], True], [['2H', '2C', None], True]], [[['2H', '2C', None], True], [['JD', '8C', 'H'], False], [['8C', 'AC', None], True], [['8H', '8D', 'C'], True], [['8H', 'TC', None], True], [['TC', '9D', None], False], [['3S', '8H', None], False], [['QS', 'QD', None], True]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("playable 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
playable case 0TrueTruePassed
playable case 1FalseFalsePassed
playable case 2TrueTruePassed
playable case 3FalseFalsePassed
playable case 4TrueTruePassed
playable case 5FalseFalsePassed
playable case 6FalseTrueFailed
playable case 7FalseTrueFailed

SHA-256 / 90984f1bd22e2a179cbc71d1f094ad2024a74450a99709646b5a5d3852d6d9e2

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    card, top, declared = x
    if card[0] == '8':
        return True
    if top[0] == '8' and declared:
        return card[1] == declared
    return card == top or card[1] == top[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[['AH', '6H', None], True], [['7H', '8C', 'C'], False], [['8C', '8S', 'S'], True], [['JD', '8S', None], False], [['8S', '8H', 'S'], True], [['TS', '3H', None], False], [['2H', '2C', None], True], [['QS', 'QD', None], True]], [[['8C', 'JD', None], True], [['6H', 'TC', None], False], [['KC', '6H', None], False], [['2D', '3C', None], False], [['8C', '4D', None], True], [['7C', 'QC', None], True], [['JS', 'JH', None], True], [['JS', 'JH', None], True]], [[['JH', '7C', None], False], [['JS', '8C', 'C'], False], [['3C', '8H', None], False], [['6C', '8S', 'C'], True], [['AH', 'TC', None], False], [['KH', '8H', 'H'], True], [['2H', '2C', None], True], [['QS', 'QD', None], True]], [[['TC', '8C', 'D'], False], [['2H', '2C', None], True], [['6S', '4D', None], False], [['2S', '8C', 'S'], True], [['AC', '8D', 'S'], False], [['8C', '8C', 'H'], True], [['2H', '2C', None], True], [['2H', '2C', None], True]], [[['2H', '2C', None], True], [['JD', '8C', 'H'], False], [['8C', 'AC', None], True], [['8H', '8D', 'C'], True], [['8H', 'TC', None], True], [['TC', '9D', None], False], [['3S', '8H', None], False], [['QS', 'QD', None], True]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("playable 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
playable case 0TrueTruePassed
playable case 1FalseFalsePassed
playable case 2TrueTruePassed
playable case 3FalseFalsePassed
playable case 4TrueTruePassed
playable case 5FalseFalsePassed
playable case 6FalseTrueFailed
playable case 7FalseTrueFailed

SHA-256 / df5a74e39878e2dea1ec93954e9cd06089871b0dec786ded7818c92b0cd7d0f4

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

Case digest / 6d10f37a9871d395f1f54c83f257e75b5896f917d99b9d317425352899d60733