FA-82761 / Chess move legality / Open access
Black X-FEN file letters ignored · case 01
Rights "bh" produce no rook squares.
ROOT CAUSE
Only upper-case file letters are recognized.
VERIFIED REPAIR
Accept file letters in either case, with the case giving the colour.
Unsuccessful approach: Dropping the rook-presence check grants rights to empty files.
Case contract
Input: {"board", "rights"}: rights letters are K/Q (outermost own rook on the back rank on the king's h-side / a-side), file letters A-H or a-h (the own rook on that file), or "-". A right only counts if the king is on its back rank (rank 1 for white, 8 for black) and the rook exists. Return the sorted distinct list of rook squares that carry castling rights.
Why this case matters
Chess960 and X-FEN positions encode castling by rook file; a wrong mapping castles with the wrong rook.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
b=x['board']; out=[]
for ch in x['rights']:
if ch=='-': continue
white=ch.isupper(); rank='1' if white else '8'
R='R' if white else 'r'; K='K' if white else 'k'
kfs=[s[0] for s,v in b.items() if v==K and s[1]==rank]
if not kfs: continue
kf=kfs[0]
rooks=sorted(s[0] for s,v in b.items() if v==R and s[1]==rank)
if ch.upper()=='K':
side=[f for f in rooks if f>kf]
if side: out.append(side[-1]+rank)
elif ch.upper()=='Q':
side=[f for f in rooks if f<kf]
if side: out.append(side[0]+rank)
elif ch in 'ABCDEFGH' and ch.lower() in rooks:
out.append(ch.lower()+rank)
return sorted(set(out))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, [])],
[('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),
('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},
['a8', 'g8']),
('black king on white back rank',
{'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),
('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},
['a8', 'g8']),
('black king on white back rank',
{'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),
('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},
[])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},
[])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, [])]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'error:' + type(exc).__name__
check(label, actual, 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 |
|---|---|---|---|
| standard KQkq | ['a1', 'a8', 'h1', 'h8'] | ['a1', 'a8', 'h1', 'h8'] | Passed |
| two rooks on h-side | ['h1'] | ['h1'] | Passed |
| file letter inner rook | ['e1'] | ['e1'] | Passed |
| black file letters | [] | ['b8', 'h8'] | Failed |
| K right but only a-side rook | [] | [] | Passed |
| king off back rank | [] | [] | Passed |
| duplicate K and H | ['h1'] | ['h1'] | Passed |
| file letter without rook | [] | [] | Passed |
SHA-256 / 3140ba6eca80a7378c5c73be532472fc1a532b66ae6834d6f981032218c0ed48
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
b=x['board']; out=[]
for ch in x['rights']:
if ch=='-': continue
white=ch.isupper(); rank='1' if white else '8'
R='R' if white else 'r'; K='K' if white else 'k'
kfs=[s[0] for s,v in b.items() if v==K and s[1]==rank]
if not kfs: continue
kf=kfs[0]
rooks=sorted(s[0] for s,v in b.items() if v==R and s[1]==rank)
if ch.upper()=='K':
side=[f for f in rooks if f>kf]
if side: out.append(side[-1]+rank)
elif ch.upper()=='Q':
side=[f for f in rooks if f<kf]
if side: out.append(side[0]+rank)
elif ch.lower() in 'abcdefgh':
out.append(ch.lower()+rank)
return sorted(set(out))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, [])],
[('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),
('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},
['a8', 'g8']),
('black king on white back rank',
{'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),
('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},
['a8', 'g8']),
('black king on white back rank',
{'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),
('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},
[])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},
[])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, [])]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'error:' + type(exc).__name__
check(label, actual, 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 |
|---|---|---|---|
| standard KQkq | ['a1', 'a8', 'h1', 'h8'] | ['a1', 'a8', 'h1', 'h8'] | Passed |
| two rooks on h-side | ['h1'] | ['h1'] | Passed |
| file letter inner rook | ['e1'] | ['e1'] | Passed |
| black file letters | ['b8', 'h8'] | ['b8', 'h8'] | Passed |
| K right but only a-side rook | [] | [] | Passed |
| king off back rank | [] | [] | Passed |
| duplicate K and H | ['h1'] | ['h1'] | Passed |
| file letter without rook | ['a1'] | [] | Failed |
SHA-256 / 7d24e55f08e0d9260ab8821bbcb2769ddaf5a98e3565c7bff0e9444c7b26cb95
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
b=x['board']; out=[]
for ch in x['rights']:
if ch=='-': continue
white=ch.isupper(); rank='1' if white else '8'
R='R' if white else 'r'; K='K' if white else 'k'
kfs=[s[0] for s,v in b.items() if v==K and s[1]==rank]
if not kfs: continue
kf=kfs[0]
rooks=sorted(s[0] for s,v in b.items() if v==R and s[1]==rank)
if ch.upper()=='K':
side=[f for f in rooks if f>kf]
if side: out.append(side[-1]+rank)
elif ch.upper()=='Q':
side=[f for f in rooks if f<kf]
if side: out.append(side[0]+rank)
elif ch.lower() in 'abcdefgh' and ch.lower() in rooks:
out.append(ch.lower()+rank)
return sorted(set(out))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, [])],
[('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),
('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},
['a8', 'g8']),
('black king on white back rank',
{'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),
('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},
['a8', 'g8']),
('black king on white back rank',
{'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),
('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},
[])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),
('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},
[])],
[('standard KQkq',
{'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},
['a1', 'a8', 'h1', 'h8']),
('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},
['h1']),
('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},
['e1']),
('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},
['b8', 'h8']),
('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),
('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),
('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),
('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, [])]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'error:' + type(exc).__name__
check(label, actual, 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 |
|---|---|---|---|
| standard KQkq | ['a1', 'a8', 'h1', 'h8'] | ['a1', 'a8', 'h1', 'h8'] | Passed |
| two rooks on h-side | ['h1'] | ['h1'] | Passed |
| file letter inner rook | ['e1'] | ['e1'] | Passed |
| black file letters | ['b8', 'h8'] | ['b8', 'h8'] | Passed |
| K right but only a-side rook | [] | [] | Passed |
| king off back rank | [] | [] | Passed |
| duplicate K and H | ['h1'] | ['h1'] | Passed |
| file letter without rook | [] | [] | Passed |
SHA-256 / f38d8907e8ee6840e9a5d4a98fcad5ab892c5b0a8ebcce2e1ae56c4b57bb7b0e
Verification & scope
A deterministic toy model with an explicitly stated contract; boards are {square: piece} with white upper-case and black lower-case pieces; no claim of full FIDE Laws conformance. 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:15.270534+00:00.
Case digest / fbba8e3903e2ca44c41ff536a22c2df8c72155a1230246ca74a5d3466840531e