FAILURE MAP
← Case archive

FA-82711 / Chess move legality / Open access

Black king hides behind its own origin square · case 01

A black king on e5 attacked along the e-file may step back to e6.

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

ROOT CAUSE

The rook ray treats the black king's current square as a blocker, although the king is the piece that moves.

VERIFIED REPAIR

Only the white king can block the rook ray; the moving king's origin is vacated.

Unsuccessful approach: Ignoring all blockers makes the white king transparent to the rook.

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] 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:
            pass
            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']),
  ('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']),
  ('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']),
  ('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']),
  ('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']),
  ('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'])],
 [('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']),
  ('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'])]]
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']['c4', 'c5', 'c6', 'd6', 'e5', 'e6']Failed
diagonal rook capture['d5', 'd6', 'e6', 'f4']['d5', 'd6', 'e6', 'f4']Passed
back rank mate[][]Passed
rank cut['c7', 'c8', 'd7', 'e7', 'e8']['c7', 'c8', 'd7', 'e7', 'e8']Passed
corner king['b7']['b7']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', 'f4', 'f5']['d4', 'e4', 'e6', 'f4', 'f5', 'f6']Failed

SHA-256 / 856c4a47f95e1cf2b236030202d1bff9315d37c0ceb67746c01c3b796d4e09ed

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] 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)==bk: 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']),
  ('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']),
  ('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']),
  ('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']),
  ('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']),
  ('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'])],
 [('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']),
  ('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'])]]
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', 'e6', 'f4', 'f5', 'f6']['d4', 'd5', 'd6', 'f4', 'f5', 'f6']Failed
white king shields['c4', 'c5', 'c6', 'd6']['c4', 'c5', 'c6', 'd6', 'e5', 'e6']Failed
diagonal rook capture['d5', 'd6', 'e6', 'f4']['d5', 'd6', 'e6', 'f4']Passed
back rank mate[][]Passed
rank cut['c7', 'c8', 'd7', 'e7', 'e8']['c7', 'c8', 'd7', 'e7', 'e8']Passed
corner king['b7']['b7']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', 'f4', 'f5']['d4', 'e4', 'e6', 'f4', 'f5', 'f6']Failed

SHA-256 / 834b35a4057a9d1330add7ce2f6b0b22933be08b9eb1a277f806257f970a0a5b

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']),
  ('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']),
  ('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']),
  ('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']),
  ('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']),
  ('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'])],
 [('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']),
  ('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'])]]
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
diagonal rook capture['d5', 'd6', 'e6', 'f4']['d5', 'd6', 'e6', 'f4']Passed
back rank mate[][]Passed
rank cut['c7', 'c8', 'd7', 'e7', 'e8']['c7', 'c8', 'd7', 'e7', 'e8']Passed
corner king['b7']['b7']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 / e2b00938c0a781610927f3524fbf48579a7a28c59bb5da11264b8482cbee305f

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

Case digest / c9c227136b7a986a9316c3408f7a3aff29f088049d7d80d6323cf74eae822fd6