FA-82501 / Chess move legality / Open access
Piece shielded by a friend still treated as pinned · case 01
A rook with a pawn between it and the king cannot leave the file.
ROOT CAUSE
An occupied square between the king and the piece stops the scan but does not cancel the pin search.
THE FAILURE
An occupied square between the king and the piece stops the scan but does not cancel the pin search.
Unsuccessful approach: Ignoring a blocker directly beside the king still reports a pin through it.
Case contract
Input: {"board", "from": square of a non-king piece, "to": its pseudo-legal destination}. Return false only when the piece is absolutely pinned (it is the first piece on a line from its own king and the next piece beyond it on that line is an enemy rook/queen on a rank or file, or bishop/queen on a diagonal) and the destination leaves that line; moves along the pin line, including capturing the pinner, return true.
Why this case matters
Move validators gate every move in engines, servers and arbiters; accepting an illegal move or rejecting a legal one corrupts the game record.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
b=x['board']; fr,to=x['from'],x['to']; p=b[fr]; white=p.isupper()
ks=[s for s,v in b.items() if v==('K' if white else 'k')][0]
def c(s): return ord(s[0])-97,int(s[1])-1
kf,kr=c(ks); pf,pr=c(fr); tf,tr=c(to)
df,dr=pf-kf,pr-kr
if not (df==0 or dr==0 or abs(df)==abs(dr)): return True
sf=(df>0)-(df<0); sr=(dr>0)-(dr<0)
cf,cr=kf+sf,kr+sr
while (cf,cr)!=(pf,pr):
if chr(97+cf)+str(cr+1) in b: break
cf+=sf; cr+=sr
cf,cr=pf+sf,pr+sr
while 0<=cf<8 and 0<=cr<8:
v=b.get(chr(97+cf)+str(cr+1))
if v:
kinds=('r','q') if sf==0 or sr==0 else ('b','q')
if v.isupper()!=white and v.lower() in kinds:
tdf,tdr=tf-kf,tr-kr
return tdf*sr==tdr*sf and tdf*sf+tdr*sr>0
return True
cf+=sf; cr+=sr
return True
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('file-pinned rook slides',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e6'}, True),
('file-pinned rook leaves',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'}, False),
('capture the pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e8'}, True),
('diagonal pin knight',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'b'}, 'from': 'd2', 'to': 'f3'}, False),
('diagonal pinned bishop off line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'c3'}, False),
('diagonal pinned bishop on line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'e3'}, True),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True)],
[('diagonal pin knight',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'b'}, 'from': 'd2', 'to': 'f3'}, False),
('diagonal pinned bishop off line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'c3'}, False),
('diagonal pinned bishop on line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'e3'}, True),
('diagonal pinned bishop to e1',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'b'}, 'from': 'd2', 'to': 'e1'}, False),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True),
('bishop on file is not a pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'b'}, 'from': 'e4', 'to': 'c5'}, True),
('rook on diagonal is not a pinner',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'r'}, 'from': 'd2', 'to': 'f3'}, True)],
[('diagonal pinned bishop to e1',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'b'}, 'from': 'd2', 'to': 'e1'}, False),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True),
('bishop on file is not a pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'b'}, 'from': 'e4', 'to': 'c5'}, True),
('rook on diagonal is not a pinner',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'r'}, 'from': 'd2', 'to': 'f3'}, True),
('own queen behind',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'Q'}, 'from': 'e4', 'to': 'c5'}, True),
('black rank pin',
{'board': {'a1': 'K', 'a8': 'R', 'e8': 'n', 'h8': 'k'}, 'from': 'e8', 'to': 'd6'}, False),
('not on a line',
{'board': {'a8': 'k', 'e1': 'K', 'e8': 'r', 'f3': 'N'}, 'from': 'f3', 'to': 'g5'}, True)],
[('file-pinned rook slides',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e6'}, True),
('file-pinned rook leaves',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'}, False),
('capture the pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e8'}, True),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True),
('own queen behind',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'Q'}, 'from': 'e4', 'to': 'c5'}, True),
('black rank pin',
{'board': {'a1': 'K', 'a8': 'R', 'e8': 'n', 'h8': 'k'}, 'from': 'e8', 'to': 'd6'}, False),
('not on a line',
{'board': {'a8': 'k', 'e1': 'K', 'e8': 'r', 'f3': 'N'}, 'from': 'f3', 'to': 'g5'}, True)],
[('file-pinned rook slides',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e6'}, True),
('file-pinned rook leaves',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'}, False),
('capture the pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e8'}, True),
('diagonal pin knight',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'b'}, 'from': 'd2', 'to': 'f3'}, False),
('diagonal pinned bishop off line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'c3'}, False),
('diagonal pinned bishop on line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'e3'}, True),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True)]]
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 |
|---|---|---|---|
| file-pinned rook slides | True | True | Passed |
| file-pinned rook leaves | False | False | Passed |
| capture the pinner | True | True | Passed |
| diagonal pin knight | False | False | Passed |
| diagonal pinned bishop off line | False | False | Passed |
| diagonal pinned bishop on line | True | True | Passed |
| shield between king and piece | False | True | Failed |
| shield next to king diagonal | False | True | Failed |
SHA-256 / 46d57e7ac5d6c1059c9a97f4ffd315020d0e476fd97f5d35d7ff2870a0d3c5e9
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']; fr,to=x['from'],x['to']; p=b[fr]; white=p.isupper()
ks=[s for s,v in b.items() if v==('K' if white else 'k')][0]
def c(s): return ord(s[0])-97,int(s[1])-1
kf,kr=c(ks); pf,pr=c(fr); tf,tr=c(to)
df,dr=pf-kf,pr-kr
if not (df==0 or dr==0 or abs(df)==abs(dr)): return True
sf=(df>0)-(df<0); sr=(dr>0)-(dr<0)
cf,cr=kf+sf,kr+sr
while (cf,cr)!=(pf,pr):
if chr(97+cf)+str(cr+1) in b and (cf,cr)!=(kf+sf,kr+sr): return True
cf+=sf; cr+=sr
cf,cr=pf+sf,pr+sr
while 0<=cf<8 and 0<=cr<8:
v=b.get(chr(97+cf)+str(cr+1))
if v:
kinds=('r','q') if sf==0 or sr==0 else ('b','q')
if v.isupper()!=white and v.lower() in kinds:
tdf,tdr=tf-kf,tr-kr
return tdf*sr==tdr*sf and tdf*sf+tdr*sr>0
return True
cf+=sf; cr+=sr
return True
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('file-pinned rook slides',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e6'}, True),
('file-pinned rook leaves',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'}, False),
('capture the pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e8'}, True),
('diagonal pin knight',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'b'}, 'from': 'd2', 'to': 'f3'}, False),
('diagonal pinned bishop off line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'c3'}, False),
('diagonal pinned bishop on line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'e3'}, True),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True)],
[('diagonal pin knight',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'b'}, 'from': 'd2', 'to': 'f3'}, False),
('diagonal pinned bishop off line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'c3'}, False),
('diagonal pinned bishop on line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'e3'}, True),
('diagonal pinned bishop to e1',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'b'}, 'from': 'd2', 'to': 'e1'}, False),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True),
('bishop on file is not a pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'b'}, 'from': 'e4', 'to': 'c5'}, True),
('rook on diagonal is not a pinner',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'r'}, 'from': 'd2', 'to': 'f3'}, True)],
[('diagonal pinned bishop to e1',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'b'}, 'from': 'd2', 'to': 'e1'}, False),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True),
('bishop on file is not a pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'b'}, 'from': 'e4', 'to': 'c5'}, True),
('rook on diagonal is not a pinner',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'r'}, 'from': 'd2', 'to': 'f3'}, True),
('own queen behind',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'Q'}, 'from': 'e4', 'to': 'c5'}, True),
('black rank pin',
{'board': {'a1': 'K', 'a8': 'R', 'e8': 'n', 'h8': 'k'}, 'from': 'e8', 'to': 'd6'}, False),
('not on a line',
{'board': {'a8': 'k', 'e1': 'K', 'e8': 'r', 'f3': 'N'}, 'from': 'f3', 'to': 'g5'}, True)],
[('file-pinned rook slides',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e6'}, True),
('file-pinned rook leaves',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'}, False),
('capture the pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e8'}, True),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True),
('own queen behind',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'N', 'e8': 'Q'}, 'from': 'e4', 'to': 'c5'}, True),
('black rank pin',
{'board': {'a1': 'K', 'a8': 'R', 'e8': 'n', 'h8': 'k'}, 'from': 'e8', 'to': 'd6'}, False),
('not on a line',
{'board': {'a8': 'k', 'e1': 'K', 'e8': 'r', 'f3': 'N'}, 'from': 'f3', 'to': 'g5'}, True)],
[('file-pinned rook slides',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e6'}, True),
('file-pinned rook leaves',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'}, False),
('capture the pinner',
{'board': {'a8': 'k', 'e1': 'K', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'e8'}, True),
('diagonal pin knight',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'N', 'g5': 'b'}, 'from': 'd2', 'to': 'f3'}, False),
('diagonal pinned bishop off line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'c3'}, False),
('diagonal pinned bishop on line',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'B', 'g5': 'q'}, 'from': 'd2', 'to': 'e3'}, True),
('shield between king and piece',
{'board': {'a8': 'k', 'e1': 'K', 'e2': 'P', 'e4': 'R', 'e8': 'r'}, 'from': 'e4', 'to': 'a4'},
True),
('shield next to king diagonal',
{'board': {'a8': 'k', 'c1': 'K', 'd2': 'P', 'e3': 'N', 'h6': 'b'}, 'from': 'e3', 'to': 'g4'},
True)]]
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 |
|---|---|---|---|
| file-pinned rook slides | True | True | Passed |
| file-pinned rook leaves | False | False | Passed |
| capture the pinner | True | True | Passed |
| diagonal pin knight | False | False | Passed |
| diagonal pinned bishop off line | False | False | Passed |
| diagonal pinned bishop on line | True | True | Passed |
| shield between king and piece | False | True | Failed |
| shield next to king diagonal | False | True | Failed |
SHA-256 / d2528968c44ba8cc85c3a8cb48db64cf1ac8b56f0c8df1bcdf6ef5c7c7efff01
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 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
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:12.752325+00:00.
Case digest / 8413e705025d1769ede3ee9405f2a3ccc77f2294b3ffb42cf49785622281a659