FA-83806 / Card game rule engines / Open access
The game level is not added to the multiplier · case 01
Every game value is one base short.
ROOT CAUSE
Multiplier starts at matadors only.
VERIFIED REPAIR
Multiplier = matadors + 1 before other levels.
Unsuccessful approach: Letting a hand game replace the game level still loses a level.
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 '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
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], [['C', ['CJ', 'SJ', 'DJ', 'AC', 'TC', '9C'], True, False, False], 48]], [[['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'TS', 'KS', 'QS', '9S', '8S'], False, True, False], 132], [['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], [['H', ['AH', 'KH', '8H'], False, True, True], 70], [['S', ['CJ', 'SJ'], True, True, False], 55]], [[['C', ['CJ', 'SJ'], False, False, False], 36], [['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], [['H', [], False, True, False], 130], [['D', ['CJ', 'SJ', 'HJ'], True, False, False], 45]], [[['C', ['CJ', 'SJ', 'HJ'], True, False, False], 60], [['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', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['S', ['SJ', 'HJ', 'DJ', '9S'], True, False, False], 33]], [[['H', ['AH', 'TH', 'KH', 'QH', '9H', '8H', '7H'], False, True, False], 60], [['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], [['D', ['CJ', 'SJ', 'AD', 'TD', 'QD', '8D', '7D'], False, False, False], 27], [['S', ['CJ', 'SJ', 'TS', 'KS', 'QS'], True, True, True], 66]]]
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 | 48 | 60 | Failed |
| game value case 3 | 72 | 96 | Failed |
| game value case 4 | 144 | 156 | Failed |
| game value case 5 | 50 | 60 | Failed |
| game value case 6 | 48 | 72 | Failed |
| game value case 7 | 36 | 48 | Failed |
SHA-256 / ff3744445258e80f3242560d37313d3554a98c2c8691b2451803646a24c6e073
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 '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 not hand else mat
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], [['C', ['CJ', 'SJ', 'DJ', 'AC', 'TC', '9C'], True, False, False], 48]], [[['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'TS', 'KS', 'QS', '9S', '8S'], False, True, False], 132], [['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], [['H', ['AH', 'KH', '8H'], False, True, True], 70], [['S', ['CJ', 'SJ'], True, True, False], 55]], [[['C', ['CJ', 'SJ'], False, False, False], 36], [['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], [['H', [], False, True, False], 130], [['D', ['CJ', 'SJ', 'HJ'], True, False, False], 45]], [[['C', ['CJ', 'SJ', 'HJ'], True, False, False], 60], [['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', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['S', ['SJ', 'HJ', 'DJ', '9S'], True, False, False], 33]], [[['H', ['AH', 'TH', 'KH', 'QH', '9H', '8H', '7H'], False, True, False], 60], [['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], [['D', ['CJ', 'SJ', 'AD', 'TD', 'QD', '8D', '7D'], False, False, False], 27], [['S', ['CJ', 'SJ', 'TS', 'KS', 'QS'], True, True, True], 66]]]
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 | 48 | 60 | Failed |
| game value case 3 | 72 | 96 | Failed |
| game value case 4 | 144 | 156 | Failed |
| game value case 5 | 60 | 60 | Passed |
| game value case 6 | 72 | 72 | Passed |
| game value case 7 | 36 | 48 | Failed |
SHA-256 / 89d6fd4cece11053b2170126fc0aef76e6e260752310327fb577036897b7dc69
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], [['C', ['CJ', 'SJ', 'DJ', 'AC', 'TC', '9C'], True, False, False], 48]], [[['S', ['CJ', 'SJ', 'HJ', 'DJ', 'AS', 'TS', 'KS', 'QS', '9S', '8S'], False, True, False], 132], [['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], [['H', ['AH', 'KH', '8H'], False, True, True], 70], [['S', ['CJ', 'SJ'], True, True, False], 55]], [[['C', ['CJ', 'SJ'], False, False, False], 36], [['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], [['H', [], False, True, False], 130], [['D', ['CJ', 'SJ', 'HJ'], True, False, False], 45]], [[['C', ['CJ', 'SJ', 'HJ'], True, False, False], 60], [['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', ['SJ', 'HJ', 'AD', 'TD', 'KD'], False, False, False], 18], [['S', ['SJ', 'HJ', 'DJ', '9S'], True, False, False], 33]], [[['H', ['AH', 'TH', 'KH', 'QH', '9H', '8H', '7H'], False, True, False], 60], [['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], [['D', ['CJ', 'SJ', 'AD', 'TD', 'QD', '8D', '7D'], False, False, False], 27], [['S', ['CJ', 'SJ', 'TS', 'KS', 'QS'], True, True, True], 66]]]
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 | 48 | 48 | Passed |
SHA-256 / 332c76cf360297358e0c49f27df963e12c24a8addba10e769460882fa03d9d42
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.078946+00:00.
Case digest / c6208a5db30e89cf347773406528fdc7e8ec8d62d916f09289e80aba76e83513