FA-83781 / Card game rule engines / Open access
The hook is applied after the dealer has bid · case 01
The dealer is unrestricted.
ROOT CAUSE
The dealer test compares with the number of players.
VERIFIED REPAIR
The dealer bids when players-1 bids are already made.
Unsuccessful approach: Applying the hook to the last two bidders restricts the player before the dealer.
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:
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]], [[[2, 3], 4, 3], [0, 1, 2, 3]], [[[7], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], [[[[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]], [[[2, 0], 3, 3], [0, 2, 3]], [[[4], 3, 4], [0, 1, 2, 3, 4]]], [[[[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]], [[[0, 0], 3, 1], [0]], [[[8], 3, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]], [[[[], 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]], [[[1, 0], 3, 1], [1]], [[[4, 0, 0], 5, 6], [0, 1, 2, 3, 4, 5, 6]]], [[[[2, 0, 1], 4, 2], [0, 1, 2]], [[[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]], [[[0, 6], 3, 6], [1, 2, 3, 4, 5, 6]], [[[2, 2], 4, 4], [0, 1, 2, 3, 4]]]]
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, 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] | [0, 1, 2, 3] | Passed |
| allowed bids case 7 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | Passed |
SHA-256 / 9e876366ea8492a0f494022f41ceeb56709a66a300eb877f0afcd29ba54d94b6
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 - 2:
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]], [[[2, 3], 4, 3], [0, 1, 2, 3]], [[[7], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], [[[[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]], [[[2, 0], 3, 3], [0, 2, 3]], [[[4], 3, 4], [0, 1, 2, 3, 4]]], [[[[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]], [[[0, 0], 3, 1], [0]], [[[8], 3, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]], [[[[], 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]], [[[1, 0], 3, 1], [1]], [[[4, 0, 0], 5, 6], [0, 1, 2, 3, 4, 5, 6]]], [[[[2, 0, 1], 4, 2], [0, 1, 2]], [[[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]], [[[0, 6], 3, 6], [1, 2, 3, 4, 5, 6]], [[[2, 2], 4, 4], [0, 1, 2, 3, 4]]]]
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, 6, 7] | [0, 1, 2, 3, 4, 5, 6, 7] | Failed |
| 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] | [0, 1, 2, 3] | Passed |
| allowed bids case 7 | [0, 1, 3, 4, 5, 6, 7, 8, 9] | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | Failed |
SHA-256 / bdf002557419f4c4ff7d3a4c6dfa28dc3751cef427c308e74d6636f18a9070e6
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]], [[[2, 3], 4, 3], [0, 1, 2, 3]], [[[7], 3, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], [[[[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]], [[[2, 0], 3, 3], [0, 2, 3]], [[[4], 3, 4], [0, 1, 2, 3, 4]]], [[[[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]], [[[0, 0], 3, 1], [0]], [[[8], 3, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]], [[[[], 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]], [[[1, 0], 3, 1], [1]], [[[4, 0, 0], 5, 6], [0, 1, 2, 3, 4, 5, 6]]], [[[[2, 0, 1], 4, 2], [0, 1, 2]], [[[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]], [[[0, 6], 3, 6], [1, 2, 3, 4, 5, 6]], [[[2, 2], 4, 4], [0, 1, 2, 3, 4]]]]
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] | [0, 1, 2, 3] | Passed |
| allowed bids case 7 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | Passed |
SHA-256 / be8379d19bc6785f33296ec739fd6efc9bc7e1bcfb17ec62241090d5990122fa
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.667839+00:00.
Case digest / acc92afc5a58ce5d69b0e9b968d957279507552fe32aebe0e82033efb5e53793