FA-83711 / Card game rule engines / Open access
Split aces may be hit · case 01
A hand from split aces can draw more cards.
ROOT CAUSE
The split-ace restriction is missing.
THE FAILURE
The split-ace restriction is missing.
Unsuccessful approach: Blocking only after a third card still lets the two-card split-ace hand hit.
Case contract
Input [cards, splits_so_far, from_split_aces, double_after_split]. Split-ace hands may only stand. A total >= 21 may only stand. Otherwise hit; double on two cards if no split yet or DAS allowed; split two cards of equal value if fewer than 3 splits so far; surrender on two cards with no split. Return the action list.
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):
cards, splits, from_aces, das = x
def v(c):
return 10 if c[0] in 'TJQK' else 11 if c[0] == 'A' else int(c[0])
acts = ['stand']
total = 0
aces = 0
for c in cards:
total += v(c)
aces += c[0] == 'A'
while total > 21 and aces:
total -= 10
aces -= 1
if total >= 21:
return acts
acts.append('hit')
two = len(cards) == 2
if two and (splits == 0 or das):
acts.append('double')
if two and v(cards[0]) == v(cards[1]) and splits < 3:
acts.append('split')
if two and splits == 0:
acts.append('surrender')
return acts
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['AC', '5H'], 0, True, True], ['stand']], [[['8C', 'TD'], 0, False, True], ['stand', 'hit', 'double', 'surrender']], [[['9S', '3C', 'QC'], 1, False, True], ['stand']], [[['8H', '8C', 'KC'], 1, False, False], ['stand']], [[['5H', '6C'], 2, True, True], ['stand']], [[['9S', 'QD', '2H', '4C'], 1, True, True], ['stand']], [[['6D', '6C', '3C'], 0, False, False], ['stand', 'hit']], [[['4D', 'QS'], 3, True, False], ['stand']]], [[[['2S', '8S'], 1, False, False], ['stand', 'hit']], [[['TD', 'TD', '7D', '6S'], 0, True, True], ['stand']], [[['3S', '3C'], 3, True, True], ['stand']], [[['AC', '6S', 'TC', 'KH'], 1, False, False], ['stand']], [[['QH', 'TS'], 2, False, False], ['stand', 'hit', 'split']], [[['4H', '2D'], 0, False, False], ['stand', 'hit', 'double', 'surrender']], [[['6S', '6H'], 2, True, True], ['stand']], [[['6H', '4H'], 1, True, True], ['stand']]], [[[['KD', '3D'], 3, False, False], ['stand', 'hit']], [[['3H', '7S'], 2, False, True], ['stand', 'hit', 'double']], [[['6S', '6H'], 2, True, True], ['stand']], [[['QD', 'QS', 'TC'], 0, False, True], ['stand']], [[['JC', 'JS'], 1, False, True], ['stand', 'hit', 'double', 'split']], [[['JH', 'JC'], 1, False, False], ['stand', 'hit', 'split']], [[['3C', '3D'], 0, True, True], ['stand']], [[['8D', 'AH'], 2, True, True], ['stand']]], [[[['5D', '5C', '9S', '6C'], 0, False, False], ['stand']], [[['4S', '4D', 'TH'], 2, True, True], ['stand']], [[['5D', '5C', '6C', 'TC'], 2, False, False], ['stand']], [[['4H', '4C'], 0, False, True], ['stand', 'hit', 'double', 'split', 'surrender']], [[['3S', 'JS', 'QC', '2S'], 0, False, True], ['stand']], [[['8H', '6S', '9H', '8C'], 0, True, True], ['stand']], [[['7S', '7D'], 3, True, True], ['stand']], [[['TS', 'KC'], 0, True, True], ['stand']]], [[[['5H', '6C'], 2, True, True], ['stand']], [[['2C', 'QD'], 0, False, True], ['stand', 'hit', 'double', 'surrender']], [[['3H', '8S'], 1, False, True], ['stand', 'hit', 'double']], [[['3C', '3D'], 0, True, True], ['stand']], [[['6S', 'KH'], 0, False, False], ['stand', 'hit', 'double', 'surrender']], [[['5H', '5C', 'JD', '4D'], 1, True, False], ['stand']], [[['2H', 'KD'], 0, False, False], ['stand', 'hit', 'double', 'surrender']], [[['AH', 'KH', '5S'], 1, True, False], ['stand']]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("actions 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 |
|---|---|---|---|
| actions case 0 | ['stand', 'hit', 'double', 'surrender'] | ['stand'] | Failed |
| actions case 1 | ['stand', 'hit', 'double', 'surrender'] | ['stand', 'hit', 'double', 'surrender'] | Passed |
| actions case 2 | ['stand'] | ['stand'] | Passed |
| actions case 3 | ['stand'] | ['stand'] | Passed |
| actions case 4 | ['stand', 'hit', 'double'] | ['stand'] | Failed |
| actions case 5 | ['stand'] | ['stand'] | Passed |
| actions case 6 | ['stand', 'hit'] | ['stand', 'hit'] | Passed |
| actions case 7 | ['stand', 'hit'] | ['stand'] | Failed |
SHA-256 / 55f69cc9bf5268eb7926286c56143eaca81f0e49e03bc44678b2fbc76070df8b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cards, splits, from_aces, das = x
def v(c):
return 10 if c[0] in 'TJQK' else 11 if c[0] == 'A' else int(c[0])
acts = ['stand']
if from_aces and len(cards) > 2:
return acts
total = 0
aces = 0
for c in cards:
total += v(c)
aces += c[0] == 'A'
while total > 21 and aces:
total -= 10
aces -= 1
if total >= 21:
return acts
acts.append('hit')
two = len(cards) == 2
if two and (splits == 0 or das):
acts.append('double')
if two and v(cards[0]) == v(cards[1]) and splits < 3:
acts.append('split')
if two and splits == 0:
acts.append('surrender')
return acts
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['AC', '5H'], 0, True, True], ['stand']], [[['8C', 'TD'], 0, False, True], ['stand', 'hit', 'double', 'surrender']], [[['9S', '3C', 'QC'], 1, False, True], ['stand']], [[['8H', '8C', 'KC'], 1, False, False], ['stand']], [[['5H', '6C'], 2, True, True], ['stand']], [[['9S', 'QD', '2H', '4C'], 1, True, True], ['stand']], [[['6D', '6C', '3C'], 0, False, False], ['stand', 'hit']], [[['4D', 'QS'], 3, True, False], ['stand']]], [[[['2S', '8S'], 1, False, False], ['stand', 'hit']], [[['TD', 'TD', '7D', '6S'], 0, True, True], ['stand']], [[['3S', '3C'], 3, True, True], ['stand']], [[['AC', '6S', 'TC', 'KH'], 1, False, False], ['stand']], [[['QH', 'TS'], 2, False, False], ['stand', 'hit', 'split']], [[['4H', '2D'], 0, False, False], ['stand', 'hit', 'double', 'surrender']], [[['6S', '6H'], 2, True, True], ['stand']], [[['6H', '4H'], 1, True, True], ['stand']]], [[[['KD', '3D'], 3, False, False], ['stand', 'hit']], [[['3H', '7S'], 2, False, True], ['stand', 'hit', 'double']], [[['6S', '6H'], 2, True, True], ['stand']], [[['QD', 'QS', 'TC'], 0, False, True], ['stand']], [[['JC', 'JS'], 1, False, True], ['stand', 'hit', 'double', 'split']], [[['JH', 'JC'], 1, False, False], ['stand', 'hit', 'split']], [[['3C', '3D'], 0, True, True], ['stand']], [[['8D', 'AH'], 2, True, True], ['stand']]], [[[['5D', '5C', '9S', '6C'], 0, False, False], ['stand']], [[['4S', '4D', 'TH'], 2, True, True], ['stand']], [[['5D', '5C', '6C', 'TC'], 2, False, False], ['stand']], [[['4H', '4C'], 0, False, True], ['stand', 'hit', 'double', 'split', 'surrender']], [[['3S', 'JS', 'QC', '2S'], 0, False, True], ['stand']], [[['8H', '6S', '9H', '8C'], 0, True, True], ['stand']], [[['7S', '7D'], 3, True, True], ['stand']], [[['TS', 'KC'], 0, True, True], ['stand']]], [[[['5H', '6C'], 2, True, True], ['stand']], [[['2C', 'QD'], 0, False, True], ['stand', 'hit', 'double', 'surrender']], [[['3H', '8S'], 1, False, True], ['stand', 'hit', 'double']], [[['3C', '3D'], 0, True, True], ['stand']], [[['6S', 'KH'], 0, False, False], ['stand', 'hit', 'double', 'surrender']], [[['5H', '5C', 'JD', '4D'], 1, True, False], ['stand']], [[['2H', 'KD'], 0, False, False], ['stand', 'hit', 'double', 'surrender']], [[['AH', 'KH', '5S'], 1, True, False], ['stand']]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("actions 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 |
|---|---|---|---|
| actions case 0 | ['stand', 'hit', 'double', 'surrender'] | ['stand'] | Failed |
| actions case 1 | ['stand', 'hit', 'double', 'surrender'] | ['stand', 'hit', 'double', 'surrender'] | Passed |
| actions case 2 | ['stand'] | ['stand'] | Passed |
| actions case 3 | ['stand'] | ['stand'] | Passed |
| actions case 4 | ['stand', 'hit', 'double'] | ['stand'] | Failed |
| actions case 5 | ['stand'] | ['stand'] | Passed |
| actions case 6 | ['stand', 'hit'] | ['stand', 'hit'] | Passed |
| actions case 7 | ['stand', 'hit'] | ['stand'] | Failed |
SHA-256 / f250283e6b7ae9de32b53f5ad380f03a2e3750b777ab65a55e56dbc3e6da6858
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.015926+00:00.
Case digest / f77bee3d63d32d0f4c70ea58596e6e056c678e22be69dc796012c195e99469e4