FA-83791 / Card game rule engines / Open access
The dealer is forbidden the current total · case 01
The wrong bid is removed from the dealer choices.
ROOT CAUSE
The forbidden bid is the running sum rather than the complement.
VERIFIED REPAIR
Forbid hand_size - sum(bids).
Unsuccessful approach: Subtracting one more forbids a harmless bid.
Case contract
Input [bids_so_far, players, hand_size]. Bids range 0..hand_size. The last bidder (dealer) may not bid the amount that makes the total of bids equal hand_size. Return the allowed bids ascending.
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):
bids, players, size = x
allowed = list(range(size + 1))
if len(bids) == players - 1:
forbidden = sum(bids)
allowed = [b for b in allowed if b != forbidden]
return allowed
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[2, 2], 3, 2], [0, 1, 2]], [[[1, 1], 5, 1], [0, 1]], [[[2], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[3], 4, 5], [0, 1, 2, 3, 4, 5]], [[[0, 3], 3, 6], [0, 1, 2, 4, 5, 6]], [[[8, 6], 4, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[0, 0, 4], 4, 4], [1, 2, 3, 4]], [[[0, 0], 3, 1], [0]]], [[[[1, 1], 5, 1], [0, 1]], [[[1], 3, 2], [0, 1, 2]], [[[0], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[], 4, 1], [0, 1]], [[[0], 4, 4], [0, 1, 2, 3, 4]], [[[0, 3], 3, 7], [0, 1, 2, 3, 5, 6, 7]], [[[0, 1], 3, 1], [1]]], [[[[0, 0, 4], 4, 4], [1, 2, 3, 4]], [[[0, 0], 3, 4], [0, 1, 2, 3]], [[[], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[0], 3, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[8, 2], 3, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8]], [[[3, 5, 0], 5, 5], [0, 1, 2, 3, 4, 5]], [[[2, 0], 3, 2], [1, 2]], [[[0, 1], 3, 1], [1]]], [[[[], 5, 5], [0, 1, 2, 3, 4, 5]], [[[2, 0], 3, 3], [0, 2, 3]], [[[2], 4, 2], [0, 1, 2]], [[[4, 2, 0], 5, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[0], 3, 4], [0, 1, 2, 3, 4]], [[[7], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[3, 6], 3, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[1, 2, 2], 4, 6], [0, 2, 3, 4, 5, 6]]], [[[[0, 0], 3, 4], [0, 1, 2, 3]], [[[0], 4, 2], [0, 1, 2]], [[[0, 3], 3, 7], [0, 1, 2, 3, 5, 6, 7]], [[[6, 0], 3, 8], [0, 1, 3, 4, 5, 6, 7, 8]], [[[4, 3, 3], 5, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[], 3, 5], [0, 1, 2, 3, 4, 5]], [[[2], 5, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[2, 4], 3, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("allowed bids 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 |
|---|---|---|---|
| allowed bids case 0 | [0, 1, 2] | [0, 1, 2] | Passed |
| allowed bids case 1 | [0, 1] | [0, 1] | Passed |
| allowed bids case 2 | [0, 1, 2, 3, 4, 5, 6, 7] | [0, 1, 2, 3, 4, 5, 6, 7] | Passed |
| allowed bids case 3 | [0, 1, 2, 3, 4, 5] | [0, 1, 2, 3, 4, 5] | Passed |
| allowed bids case 4 | [0, 1, 2, 4, 5, 6] | [0, 1, 2, 4, 5, 6] | Passed |
| allowed bids case 5 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | Passed |
| allowed bids case 6 | [0, 1, 2, 3] | [1, 2, 3, 4] | Failed |
| allowed bids case 7 | [1] | [0] | Failed |
SHA-256 / d619c3e9d002aee52f577473bf51e606a0317a5fd5cae89fb904e373e4c300a4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
bids, players, size = x
allowed = list(range(size + 1))
if len(bids) == players - 1:
forbidden = size - sum(bids) - 1
allowed = [b for b in allowed if b != forbidden]
return allowed
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[2, 2], 3, 2], [0, 1, 2]], [[[1, 1], 5, 1], [0, 1]], [[[2], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[3], 4, 5], [0, 1, 2, 3, 4, 5]], [[[0, 3], 3, 6], [0, 1, 2, 4, 5, 6]], [[[8, 6], 4, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[0, 0, 4], 4, 4], [1, 2, 3, 4]], [[[0, 0], 3, 1], [0]]], [[[[1, 1], 5, 1], [0, 1]], [[[1], 3, 2], [0, 1, 2]], [[[0], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[], 4, 1], [0, 1]], [[[0], 4, 4], [0, 1, 2, 3, 4]], [[[0, 3], 3, 7], [0, 1, 2, 3, 5, 6, 7]], [[[0, 1], 3, 1], [1]]], [[[[0, 0, 4], 4, 4], [1, 2, 3, 4]], [[[0, 0], 3, 4], [0, 1, 2, 3]], [[[], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[0], 3, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[8, 2], 3, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8]], [[[3, 5, 0], 5, 5], [0, 1, 2, 3, 4, 5]], [[[2, 0], 3, 2], [1, 2]], [[[0, 1], 3, 1], [1]]], [[[[], 5, 5], [0, 1, 2, 3, 4, 5]], [[[2, 0], 3, 3], [0, 2, 3]], [[[2], 4, 2], [0, 1, 2]], [[[4, 2, 0], 5, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[0], 3, 4], [0, 1, 2, 3, 4]], [[[7], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[3, 6], 3, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[1, 2, 2], 4, 6], [0, 2, 3, 4, 5, 6]]], [[[[0, 0], 3, 4], [0, 1, 2, 3]], [[[0], 4, 2], [0, 1, 2]], [[[0, 3], 3, 7], [0, 1, 2, 3, 5, 6, 7]], [[[6, 0], 3, 8], [0, 1, 3, 4, 5, 6, 7, 8]], [[[4, 3, 3], 5, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[], 3, 5], [0, 1, 2, 3, 4, 5]], [[[2], 5, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[2, 4], 3, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("allowed bids 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 |
|---|---|---|---|
| allowed bids case 0 | [0, 1, 2] | [0, 1, 2] | Passed |
| allowed bids case 1 | [0, 1] | [0, 1] | Passed |
| allowed bids case 2 | [0, 1, 2, 3, 4, 5, 6, 7] | [0, 1, 2, 3, 4, 5, 6, 7] | Passed |
| allowed bids case 3 | [0, 1, 2, 3, 4, 5] | [0, 1, 2, 3, 4, 5] | Passed |
| allowed bids case 4 | [0, 1, 3, 4, 5, 6] | [0, 1, 2, 4, 5, 6] | Failed |
| allowed bids case 5 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | Passed |
| allowed bids case 6 | [0, 1, 2, 3, 4] | [1, 2, 3, 4] | Failed |
| allowed bids case 7 | [1] | [0] | Failed |
SHA-256 / 212f8718d0b8da6086100984942247a75eded81b3b001300a54abc7ba0e22126
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
bids, players, size = x
allowed = list(range(size + 1))
if len(bids) == players - 1:
forbidden = size - sum(bids)
allowed = [b for b in allowed if b != forbidden]
return allowed
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[2, 2], 3, 2], [0, 1, 2]], [[[1, 1], 5, 1], [0, 1]], [[[2], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[3], 4, 5], [0, 1, 2, 3, 4, 5]], [[[0, 3], 3, 6], [0, 1, 2, 4, 5, 6]], [[[8, 6], 4, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[0, 0, 4], 4, 4], [1, 2, 3, 4]], [[[0, 0], 3, 1], [0]]], [[[[1, 1], 5, 1], [0, 1]], [[[1], 3, 2], [0, 1, 2]], [[[0], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[], 4, 1], [0, 1]], [[[0], 4, 4], [0, 1, 2, 3, 4]], [[[0, 3], 3, 7], [0, 1, 2, 3, 5, 6, 7]], [[[0, 1], 3, 1], [1]]], [[[[0, 0, 4], 4, 4], [1, 2, 3, 4]], [[[0, 0], 3, 4], [0, 1, 2, 3]], [[[], 3, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[0], 3, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[8, 2], 3, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8]], [[[3, 5, 0], 5, 5], [0, 1, 2, 3, 4, 5]], [[[2, 0], 3, 2], [1, 2]], [[[0, 1], 3, 1], [1]]], [[[[], 5, 5], [0, 1, 2, 3, 4, 5]], [[[2, 0], 3, 3], [0, 2, 3]], [[[2], 4, 2], [0, 1, 2]], [[[4, 2, 0], 5, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[0], 3, 4], [0, 1, 2, 3, 4]], [[[7], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[3, 6], 3, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9]], [[[1, 2, 2], 4, 6], [0, 2, 3, 4, 5, 6]]], [[[[0, 0], 3, 4], [0, 1, 2, 3]], [[[0], 4, 2], [0, 1, 2]], [[[0, 3], 3, 7], [0, 1, 2, 3, 5, 6, 7]], [[[6, 0], 3, 8], [0, 1, 3, 4, 5, 6, 7, 8]], [[[4, 3, 3], 5, 7], [0, 1, 2, 3, 4, 5, 6, 7]], [[[], 3, 5], [0, 1, 2, 3, 4, 5]], [[[2], 5, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[[2, 4], 3, 10], [0, 1, 2, 3, 5, 6, 7, 8, 9, 10]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("allowed bids 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 |
|---|---|---|---|
| allowed bids case 0 | [0, 1, 2] | [0, 1, 2] | Passed |
| allowed bids case 1 | [0, 1] | [0, 1] | Passed |
| allowed bids case 2 | [0, 1, 2, 3, 4, 5, 6, 7] | [0, 1, 2, 3, 4, 5, 6, 7] | Passed |
| allowed bids case 3 | [0, 1, 2, 3, 4, 5] | [0, 1, 2, 3, 4, 5] | Passed |
| allowed bids case 4 | [0, 1, 2, 4, 5, 6] | [0, 1, 2, 4, 5, 6] | Passed |
| allowed bids case 5 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | Passed |
| allowed bids case 6 | [1, 2, 3, 4] | [1, 2, 3, 4] | Passed |
| allowed bids case 7 | [0] | [0] | Passed |
SHA-256 / 338f530b1c38d750180d59b71a874e95fe3decd8567b087ff963e5dd2cf768fb
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.824322+00:00.
Case digest / d90dd2f3b0acc34f07b0298c8d2450b33c700505dfee48d21b3f3e82bd8aa3e0