FAILURE MAP
← Case archive

FA-11651 / Game simulation rules / Open access

Returning a rook restores a forfeited castling right · case 01

Returning a rook restores a forfeited castling right.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Eligibility is inferred from current rook occupancy.

THE FAILURE

Eligibility is inferred from current rook occupancy.

Unsuccessful approach: Tracking rook movement alone ignores the king’s irreversible loss of both rights.

Case contract

Given initial right and event strings rook_move, rook_return, rook_capture, king_move, king_return, other, return whether this side retains castling rights; no board attack/path checks are modeled.

Why this case matters

A deterministic game-rule model isolates this rule interaction for regression testing.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events):
    right=initial
    for e in events:
     if e in ('rook_move','rook_capture','king_move'): right=False
     if e in ('rook_return','king_return'): right=True
    return right
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rook returns',solve(True,['rook_move']+['other']*N+['rook_return']),False)
check('king moved',solve(True,['king_move']),False)
check('king returns',solve(True,['king_move','king_return']),False)
check('captured original rook',solve(True,['rook_capture','rook_return']),False)
check('unrelated moves',solve(True,['other']*N),True)
check('absent initial right',solve(False,[]),False)
check('cannot acquire rights',solve(False,['rook_return']),False)
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 fixtureActualExpectedOutcome
rook returnsTrueFalseFailed
king movedFalseFalsePassed
king returnsTrueFalseFailed
captured original rookTrueFalseFailed
unrelated movesTrueTruePassed
absent initial rightFalseFalsePassed
cannot acquire rightsTrueFalseFailed

SHA-256 / 1112778462e38046ea86ce65fa5847782ff0999379d5da27eeeba1208e0e717d

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events):
    return initial and not any(e in ('rook_move','rook_capture') for e in events)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rook returns',solve(True,['rook_move']+['other']*N+['rook_return']),False)
check('king moved',solve(True,['king_move']),False)
check('king returns',solve(True,['king_move','king_return']),False)
check('captured original rook',solve(True,['rook_capture','rook_return']),False)
check('unrelated moves',solve(True,['other']*N),True)
check('absent initial right',solve(False,[]),False)
check('cannot acquire rights',solve(False,['rook_return']),False)
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 fixtureActualExpectedOutcome
rook returnsFalseFalsePassed
king movedTrueFalseFailed
king returnsTrueFalseFailed
captured original rookFalseFalsePassed
unrelated movesTrueTruePassed
absent initial rightFalseFalsePassed
cannot acquire rightsFalseFalsePassed

SHA-256 / 2cb9acf55eed1593094eca21af47c6bee06871921fed1fd90e191f6dbeccb1de

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 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

Controlled rules-only simulation; not a complete game engine. 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:38:49.825362+00:00.

Case digest / 198755a5df512952f4e76f7b1036161848cfccb67ebecdbeeedc62f390462a82