FA-83801 / Card game rule engines / Open access
The ten is ranked below the king in the matador sequence · case 01
Runs through A-10-K are broken at the wrong card.
ROOT CAUSE
The suit part of the sequence uses natural order A K Q T.
VERIFIED REPAIR
Skat trump order after the jacks is A T K Q 9 8 7.
Unsuccessful approach: Putting the ten above the ace breaks runs at the ace.
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 'AKQT987']
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 = [[[['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'TS', 'KS'], False, False, False], 88], [['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], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'KD', '9D', '8D'], False, False, False], 54]], [[['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], [['C', ['KC', 'QC', '9C', '8C', '7C'], False, False, False], 84], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'TC', 'KC', '9C', '7C'], True, True, False], 84]], [[['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], [['S', ['QS', '9S', '8S', '7S'], False, True, False], 99], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH'], False, False, False], 60]], [[['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', ['QD', '9D', '8D', '7D'], True, False, False], 81], [['S', ['CJ', 'SJ', 'HJ', 'DJ', 'TS'], False, False, False], 55]], [[['D', ['SJ', 'HJ', 'AD', 'QD', '7D'], 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], [['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'KS', 'QS', '7S'], False, True, True], 88], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC'], False, False, False], 96]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| game value case 0 | 77 | 88 | Failed |
| game value case 1 | 96 | 108 | Failed |
| game value case 2 | 60 | 60 | Passed |
| game value case 3 | 96 | 96 | Passed |
| game value case 4 | 156 | 156 | Passed |
| game value case 5 | 60 | 60 | Passed |
| game value case 6 | 72 | 72 | Passed |
| game value case 7 | 63 | 54 | Failed |
SHA-256 / aa9d468ffa17ce0d3165b9c2c2a62a074eeb776b200042fef32e3d8b3bb7d4dd
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 'TAKQ987']
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 = [[[['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'TS', 'KS'], False, False, False], 88], [['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], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'KD', '9D', '8D'], False, False, False], 54]], [[['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], [['C', ['KC', 'QC', '9C', '8C', '7C'], False, False, False], 84], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'TC', 'KC', '9C', '7C'], True, True, False], 84]], [[['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], [['S', ['QS', '9S', '8S', '7S'], False, True, False], 99], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH'], False, False, False], 60]], [[['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', ['QD', '9D', '8D', '7D'], True, False, False], 81], [['S', ['CJ', 'SJ', 'HJ', 'DJ', 'TS'], False, False, False], 55]], [[['D', ['SJ', 'HJ', 'AD', 'QD', '7D'], 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], [['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'KS', 'QS', '7S'], False, True, True], 88], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC'], False, False, False], 96]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| game value case 0 | 88 | 88 | Passed |
| game value case 1 | 108 | 108 | Passed |
| game value case 2 | 60 | 60 | Passed |
| game value case 3 | 96 | 96 | Passed |
| game value case 4 | 156 | 156 | Passed |
| game value case 5 | 60 | 60 | Passed |
| game value case 6 | 72 | 72 | Passed |
| game value case 7 | 45 | 54 | Failed |
SHA-256 / 340344dc48408483544b163a7b5dd2eeed0c1693f63fa06bae5dc3f6a3b17e28
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 = [[[['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'TS', 'KS'], False, False, False], 88], [['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], [['D', ['CJ', 'SJ', 'HJ', 'DJ', 'AD', 'KD', '9D', '8D'], False, False, False], 54]], [[['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], [['C', ['KC', 'QC', '9C', '8C', '7C'], False, False, False], 84], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'TC', 'KC', '9C', '7C'], True, True, False], 84]], [[['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], [['S', ['QS', '9S', '8S', '7S'], False, True, False], 99], [['H', ['CJ', 'SJ', 'HJ', 'DJ', 'AH'], False, False, False], 60]], [[['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', ['QD', '9D', '8D', '7D'], True, False, False], 81], [['S', ['CJ', 'SJ', 'HJ', 'DJ', 'TS'], False, False, False], 55]], [[['D', ['SJ', 'HJ', 'AD', 'QD', '7D'], 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], [['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'KS', 'QS', '7S'], False, True, True], 88], [['C', ['CJ', 'SJ', 'HJ', 'DJ', 'AC', 'TC', 'KC'], False, False, False], 96]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| game value case 0 | 88 | 88 | Passed |
| game value case 1 | 108 | 108 | Passed |
| game value case 2 | 60 | 60 | Passed |
| game value case 3 | 96 | 96 | Passed |
| game value case 4 | 156 | 156 | Passed |
| game value case 5 | 60 | 60 | Passed |
| game value case 6 | 72 | 72 | Passed |
| game value case 7 | 54 | 54 | Passed |
SHA-256 / 3e2fdb58a8ceedf6d4287aed21eaf046813ce07d78b11175881d50f232806f64
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:25.049463+00:00.
Case digest / 1823160f7bbc166ec396a21fe3d31d73ca76f444ee7bd2da7637fa70fea79d2a