FAILURE MAP
← Case archive

FA-82721 / Chess move legality / Open access

Rook attacks only its own square · case 01

The black king may walk onto the rook's rank or file.

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

ROOT CAUSE

The line test requires both file and rank to match instead of either.

VERIFIED REPAIR

A rook attacks squares sharing its file or its rank.

Unsuccessful approach: Checking only the file misses rank attacks.

Case contract

Input: {"wk", "wr", "bk"} squares (black to move). Return the sorted squares the black king may move to: on the board, not adjacent to the white king, and not attacked by the rook along a rank or file (the white king blocks the rook; the black king's origin does not). Capturing the rook is legal when the rook is not adjacent to the white king.

Why this case matters

Endgame tablebase generators and mate detectors depend on exact escape squares.

1 / The failure

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

N = 1
observations = []
def solve(x):
    def c(q): return ord(q[0])-97,int(q[1])-1
    wk,wr,bk=c(x['wk']),c(x['wr']),c(x['bk'])
    def rook_hits(t):
        if wr==t: return False
        if wr[0]!=t[0] or wr[1]!=t[1]: return False
        sf=(t[0]>wr[0])-(t[0]<wr[0]); sr=(t[1]>wr[1])-(t[1]<wr[1])
        f,r=wr[0]+sf,wr[1]+sr
        while (f,r)!=t:
            if (f,r)==wk: return False
            f+=sf; r+=sr
        return True
    out=[]
    for df in (-1,0,1):
        for dr in (-1,0,1):
            if not (df or dr): continue
            t=(bk[0]+df,bk[1]+dr)
            if not (0<=t[0]<8 and 0<=t[1]<8): continue
            if max(abs(t[0]-wk[0]),abs(t[1]-wk[1]))<=1: continue
            if rook_hits(t): continue
            out.append(chr(97+t[0])+str(t[1]+1))
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])]]
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 fixtureActualExpectedOutcome
retreat along rook file['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'f4', 'f5', 'f6']Failed
white king shields['c4', 'c5', 'c6', 'd6', 'e5', 'e6']['c4', 'c5', 'c6', 'd6', 'e5', 'e6']Passed
capture undefended rook['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']['d5', 'd6', 'e4', 'f5', 'f6']Failed
capture defended rook['d5', 'd6', 'e6', 'f5', 'f6']['d5', 'd6', 'f5', 'f6']Failed
diagonal rook capture['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']['d5', 'd6', 'e6', 'f4']Failed
rank cut['c7', 'c8', 'd7', 'e7', 'e8']['c7', 'c8', 'd7', 'e7', 'e8']Passed
rook far file['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']Passed
shield on rank['d4', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'e4', 'e6', 'f4', 'f5', 'f6']Passed

SHA-256 / 5ace257b24c39732973ed09dd59555af42737cc46d2667f30535161012fc35e2

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    def c(q): return ord(q[0])-97,int(q[1])-1
    wk,wr,bk=c(x['wk']),c(x['wr']),c(x['bk'])
    def rook_hits(t):
        if wr==t: return False
        if wr[0]!=t[0]: return False
        sf=(t[0]>wr[0])-(t[0]<wr[0]); sr=(t[1]>wr[1])-(t[1]<wr[1])
        f,r=wr[0]+sf,wr[1]+sr
        while (f,r)!=t:
            if (f,r)==wk: return False
            f+=sf; r+=sr
        return True
    out=[]
    for df in (-1,0,1):
        for dr in (-1,0,1):
            if not (df or dr): continue
            t=(bk[0]+df,bk[1]+dr)
            if not (0<=t[0]<8 and 0<=t[1]<8): continue
            if max(abs(t[0]-wk[0]),abs(t[1]-wk[1]))<=1: continue
            if rook_hits(t): continue
            out.append(chr(97+t[0])+str(t[1]+1))
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])]]
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 fixtureActualExpectedOutcome
retreat along rook file['d4', 'd5', 'd6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'f4', 'f5', 'f6']Passed
white king shields['c4', 'c5', 'c6', 'd6', 'e5', 'e6']['c4', 'c5', 'c6', 'd6', 'e5', 'e6']Passed
capture undefended rook['d4', 'd5', 'd6', 'e4', 'f4', 'f5', 'f6']['d5', 'd6', 'e4', 'f5', 'f6']Failed
capture defended rook['d5', 'd6', 'f5', 'f6']['d5', 'd6', 'f5', 'f6']Passed
diagonal rook capture['d4', 'd5', 'd6', 'e4', 'e6', 'f4']['d5', 'd6', 'e6', 'f4']Failed
rank cut['c7', 'c8', 'd7', 'e7', 'e8']['c7', 'c8', 'd7', 'e7', 'e8']Passed
rook far file['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']Passed
shield on rank['d4', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'e4', 'e6', 'f4', 'f5', 'f6']Passed

SHA-256 / c46c46c93c1788aeda09280d674bc580a164d180114d3b43fdfa7ad9146dfc20

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    def c(q): return ord(q[0])-97,int(q[1])-1
    wk,wr,bk=c(x['wk']),c(x['wr']),c(x['bk'])
    def rook_hits(t):
        if wr==t: return False
        if wr[0]!=t[0] and wr[1]!=t[1]: return False
        sf=(t[0]>wr[0])-(t[0]<wr[0]); sr=(t[1]>wr[1])-(t[1]<wr[1])
        f,r=wr[0]+sf,wr[1]+sr
        while (f,r)!=t:
            if (f,r)==wk: return False
            f+=sf; r+=sr
        return True
    out=[]
    for df in (-1,0,1):
        for dr in (-1,0,1):
            if not (df or dr): continue
            t=(bk[0]+df,bk[1]+dr)
            if not (0<=t[0]<8 and 0<=t[1]<8): continue
            if max(abs(t[0]-wk[0]),abs(t[1]-wk[1]))<=1: continue
            if rook_hits(t): continue
            out.append(chr(97+t[0])+str(t[1]+1))
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('white king shields', {'bk': 'd5', 'wk': 'e3', 'wr': 'e1'},
   ['c4', 'c5', 'c6', 'd6', 'e5', 'e6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('rank cut', {'bk': 'd8', 'wk': 'a1', 'wr': 'h6'}, ['c7', 'c8', 'd7', 'e7', 'e8']),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])],
 [('retreat along rook file', {'bk': 'e5', 'wk': 'a1', 'wr': 'e1'},
   ['d4', 'd5', 'd6', 'f4', 'f5', 'f6']),
  ('capture undefended rook', {'bk': 'e5', 'wk': 'a1', 'wr': 'e4'}, ['d5', 'd6', 'e4', 'f5', 'f6']),
  ('capture defended rook', {'bk': 'e5', 'wk': 'e3', 'wr': 'e4'}, ['d5', 'd6', 'f5', 'f6']),
  ('diagonal rook capture', {'bk': 'e5', 'wk': 'a1', 'wr': 'f4'}, ['d5', 'd6', 'e6', 'f4']),
  ('back rank mate', {'bk': 'h8', 'wk': 'g6', 'wr': 'a8'}, []),
  ('corner king', {'bk': 'a8', 'wk': 'c3', 'wr': 'b7'}, ['b7']),
  ('rook far file', {'bk': 'e5', 'wk': 'h1', 'wr': 'c2'},
   ['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']),
  ('shield on rank', {'bk': 'e5', 'wk': 'c6', 'wr': 'a6'}, ['d4', 'e4', 'e6', 'f4', 'f5', 'f6'])]]
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 fixtureActualExpectedOutcome
retreat along rook file['d4', 'd5', 'd6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'f4', 'f5', 'f6']Passed
white king shields['c4', 'c5', 'c6', 'd6', 'e5', 'e6']['c4', 'c5', 'c6', 'd6', 'e5', 'e6']Passed
capture undefended rook['d5', 'd6', 'e4', 'f5', 'f6']['d5', 'd6', 'e4', 'f5', 'f6']Passed
capture defended rook['d5', 'd6', 'f5', 'f6']['d5', 'd6', 'f5', 'f6']Passed
diagonal rook capture['d5', 'd6', 'e6', 'f4']['d5', 'd6', 'e6', 'f4']Passed
rank cut['c7', 'c8', 'd7', 'e7', 'e8']['c7', 'c8', 'd7', 'e7', 'e8']Passed
rook far file['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'e4', 'e6', 'f4', 'f5', 'f6']Passed
shield on rank['d4', 'e4', 'e6', 'f4', 'f5', 'f6']['d4', 'e4', 'e6', 'f4', 'f5', 'f6']Passed

SHA-256 / a4a3cf757281ae556cfd2e70ada3cf43d45207760a866f600a1571b8e3beabda

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:14.708514+00:00.

Case digest / ccedd36c6586e07558503c1f3c3a7b090d7ddcdfccdd88bb927f45927968e079