FA-83756 / Card game rule engines / Open access
Four of a kind is accepted as a plain combination · case 01
Four same-rank cards are played like a triple.
ROOT CAUSE
The size cap on same-rank plays is missing.
THE FAILURE
The size cap on same-rank plays is missing.
Unsuccessful approach: Capping at four still admits four of a kind.
Case contract
Input [current_combination, play]. Ranks 3 low to 2 high; suits D<C<H<S. A play is 1-3 cards of one rank. On an empty table any valid play is "ok"; otherwise it must have the same size and its highest card must outrank the current highest card (rank, then suit). Empty play is "pass". Return "ok", "invalid" or "pass".
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):
cur, play = x
order = '3456789TJQKA2'
suits = 'DCHS'
def key(c):
return (order.index(c[0]), suits.index(c[1]))
if not play:
return 'pass'
if len(set(c[0] for c in play)) != 1:
return 'invalid'
if not cur:
return 'ok'
if len(play) != len(cur):
return 'invalid'
if max(key(c) for c in play) > max(key(c) for c in cur):
return 'ok'
return 'invalid'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[], ['KD']], 'ok'], [[['KC', 'KD'], ['KH', 'KS']], 'ok'], [[['8S', '8C', '8H'], ['KD', 'KC', 'KS']], 'ok'], [[['6S'], ['6H']], 'invalid'], [[['9C'], ['6S']], 'invalid'], [[[], ['3H', '3S', '3C']], 'ok'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid']], [[[['8D', '8H'], ['8S', '8D', '8H', '8C']], 'invalid'], [[['AS'], ['AH', 'AC', 'AD']], 'invalid'], [[[], ['3C']], 'ok'], [[['QD'], ['QH']], 'ok'], [[['JD', 'JS'], ['TD', 'TS', 'TC', 'TH']], 'invalid'], [[['9S', '9H'], ['8S', '8C']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['4S', '4H', '4D', '4C']], 'invalid']], [[[['9D', '9C'], ['9D', '9C']], 'invalid'], [[['KD'], ['AH']], 'ok'], [[[], ['KS', 'KD']], 'ok'], [[['JC'], ['7C']], 'invalid'], [[['5S'], ['5H']], 'invalid'], [[['2S'], ['5D']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['4S', '4D', '4H', '4C']], 'invalid']], [[[['JH', 'JC'], ['JC', 'JS']], 'ok'], [[['7C'], ['2D']], 'ok'], [[['2H'], ['2H']], 'invalid'], [[['TH', 'TD'], ['8D', '2S']], 'invalid'], [[['5H', '5D'], ['JS', 'JC']], 'ok'], [[[], ['QC', 'QH']], 'ok'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid']], [[[['6C', '6H'], ['AH', '4D']], 'invalid'], [[['3D', '3H', '3C'], ['3S', '3D', '3H', 'AC']], 'invalid'], [[['5S'], ['3S']], 'invalid'], [[['9C'], ['9C']], 'invalid'], [[['7C', '7S', '7D'], ['3D', '3S', '3C']], 'invalid'], [[['3H', '3C'], ['3D', '3C', '3S', '3H']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['4S', '4H', '4D', '4C']], 'invalid']]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("play 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| play case 0 | ok | ok | Passed |
| play case 1 | ok | ok | Passed |
| play case 2 | ok | ok | Passed |
| play case 3 | invalid | invalid | Passed |
| play case 4 | invalid | invalid | Passed |
| play case 5 | ok | ok | Passed |
| play case 6 | ok | invalid | Failed |
| play case 7 | ok | invalid | Failed |
SHA-256 / 9b1482bf23acd1eb06f9df98be4a01b1cedc254d51af0f3ebce14106d2e67cfc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cur, play = x
order = '3456789TJQKA2'
suits = 'DCHS'
def key(c):
return (order.index(c[0]), suits.index(c[1]))
if not play:
return 'pass'
if len(set(c[0] for c in play)) != 1 or len(play) > 4:
return 'invalid'
if not cur:
return 'ok'
if len(play) != len(cur):
return 'invalid'
if max(key(c) for c in play) > max(key(c) for c in cur):
return 'ok'
return 'invalid'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[], ['KD']], 'ok'], [[['KC', 'KD'], ['KH', 'KS']], 'ok'], [[['8S', '8C', '8H'], ['KD', 'KC', 'KS']], 'ok'], [[['6S'], ['6H']], 'invalid'], [[['9C'], ['6S']], 'invalid'], [[[], ['3H', '3S', '3C']], 'ok'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid']], [[[['8D', '8H'], ['8S', '8D', '8H', '8C']], 'invalid'], [[['AS'], ['AH', 'AC', 'AD']], 'invalid'], [[[], ['3C']], 'ok'], [[['QD'], ['QH']], 'ok'], [[['JD', 'JS'], ['TD', 'TS', 'TC', 'TH']], 'invalid'], [[['9S', '9H'], ['8S', '8C']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['4S', '4H', '4D', '4C']], 'invalid']], [[[['9D', '9C'], ['9D', '9C']], 'invalid'], [[['KD'], ['AH']], 'ok'], [[[], ['KS', 'KD']], 'ok'], [[['JC'], ['7C']], 'invalid'], [[['5S'], ['5H']], 'invalid'], [[['2S'], ['5D']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['4S', '4D', '4H', '4C']], 'invalid']], [[[['JH', 'JC'], ['JC', 'JS']], 'ok'], [[['7C'], ['2D']], 'ok'], [[['2H'], ['2H']], 'invalid'], [[['TH', 'TD'], ['8D', '2S']], 'invalid'], [[['5H', '5D'], ['JS', 'JC']], 'ok'], [[[], ['QC', 'QH']], 'ok'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid']], [[[['6C', '6H'], ['AH', '4D']], 'invalid'], [[['3D', '3H', '3C'], ['3S', '3D', '3H', 'AC']], 'invalid'], [[['5S'], ['3S']], 'invalid'], [[['9C'], ['9C']], 'invalid'], [[['7C', '7S', '7D'], ['3D', '3S', '3C']], 'invalid'], [[['3H', '3C'], ['3D', '3C', '3S', '3H']], 'invalid'], [[[], ['KD', 'KS', 'KH', 'KC']], 'invalid'], [[[], ['4S', '4H', '4D', '4C']], 'invalid']]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("play 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| play case 0 | ok | ok | Passed |
| play case 1 | ok | ok | Passed |
| play case 2 | ok | ok | Passed |
| play case 3 | invalid | invalid | Passed |
| play case 4 | invalid | invalid | Passed |
| play case 5 | ok | ok | Passed |
| play case 6 | ok | invalid | Failed |
| play case 7 | ok | invalid | Failed |
SHA-256 / 29992ec5dcadfa582d8450c27505fd79d23af1655bf4a56323e518d48e35616a
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:24.579020+00:00.
Case digest / 31b53b9300da2d7bcb52a9dc9356afedd8967728353c48e7a91ce67d51f5172b