FAILURE MAP
← Case archive

FA-82376 / Chess move legality / Open access

Queen moves only like a rook · case 01

A queen is never offered diagonal moves.

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

ROOT CAUSE

The queen's direction list is aliased to the rook directions.

VERIFIED REPAIR

The queen combines rook and bishop directions.

Unsuccessful approach: Aliasing to the bishop directions drops the orthogonal moves instead.

Case contract

Input: {"board", "from": square of a rook, bishop or queen}. Return the sorted pseudo-legal destinations: walk each ray until the edge; an empty square is added, an enemy piece is added and ends the ray, a friendly piece ends the ray without being added.

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']; sq=x['from']; p=b[sq]
    f,r=ord(sq[0])-97,int(sq[1])-1
    dirs={'r':[(1,0),(-1,0),(0,1),(0,-1)],'b':[(1,1),(1,-1),(-1,1),(-1,-1)]}
    dirs['q']=dirs['r']
    out=[]
    for df,dr in dirs[p.lower()]:
        cf,cr=f+df,r+dr
        while 0<=cf<8 and 0<=cr<8:
            t=chr(97+cf)+str(cr+1)
            occ=b.get(t)
            if occ is None:
                out.append(t)
            else:
                if occ.isupper()!=p.isupper(): out.append(t)
                break
            cf+=df; cr+=dr
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])]]
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
rook blocked by enemy['a2', 'a3', 'b1']['a2', 'a3', 'b1']Passed
rook behind enemy['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']Passed
bishop corner['e4', 'f3', 'g2']['e4', 'f3', 'g2']Passed
bishop centre['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']Passed
queen boxed[][]Passed
queen open['a5', 'b5', 'c5', 'd1', 'd2', 'd3', 'd4', 'd6', 'e5', 'f5', 'g5', 'h5']['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5', 'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']Failed
black rook top edge['f8', 'g8', 'h5', 'h6', 'h7']['f8', 'g8', 'h5', 'h6', 'h7']Passed
queen along diagonal capture['a1', 'b1', 'c2', 'd1', 'e1', 'f1', 'g1', 'h1']['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']Failed

SHA-256 / 16b1bc7be0eaf8bb7dc61b4a681db2a474393bd1b30c3b06083eb3cd3d11288b

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']; sq=x['from']; p=b[sq]
    f,r=ord(sq[0])-97,int(sq[1])-1
    dirs={'r':[(1,0),(-1,0),(0,1),(0,-1)],'b':[(1,1),(1,-1),(-1,1),(-1,-1)]}
    dirs['q']=dirs['b']
    out=[]
    for df,dr in dirs[p.lower()]:
        cf,cr=f+df,r+dr
        while 0<=cf<8 and 0<=cr<8:
            t=chr(97+cf)+str(cr+1)
            occ=b.get(t)
            if occ is None:
                out.append(t)
            else:
                if occ.isupper()!=p.isupper(): out.append(t)
                break
            cf+=df; cr+=dr
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])]]
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
rook blocked by enemy['a2', 'a3', 'b1']['a2', 'a3', 'b1']Passed
rook behind enemy['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']Passed
bishop corner['e4', 'f3', 'g2']['e4', 'f3', 'g2']Passed
bishop centre['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']Passed
queen boxed[][]Passed
queen open['a2', 'a8', 'b3', 'b7', 'c4', 'c6', 'e4', 'e6', 'f3', 'f7', 'g2', 'g8', 'h1']['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5', 'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']Failed
black rook top edge['f8', 'g8', 'h5', 'h6', 'h7']['f8', 'g8', 'h5', 'h6', 'h7']Passed
queen along diagonal capture['a3', 'b2', 'd2', 'e3', 'f4', 'g5', 'h6']['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']Failed

SHA-256 / b9f2f925c4a9a4a2f0634ba6e3fdcf45e70231c83b770c4a99ab376cc47ea623

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']; sq=x['from']; p=b[sq]
    f,r=ord(sq[0])-97,int(sq[1])-1
    dirs={'r':[(1,0),(-1,0),(0,1),(0,-1)],'b':[(1,1),(1,-1),(-1,1),(-1,-1)]}
    dirs['q']=dirs['r']+dirs['b']
    out=[]
    for df,dr in dirs[p.lower()]:
        cf,cr=f+df,r+dr
        while 0<=cf<8 and 0<=cr<8:
            t=chr(97+cf)+str(cr+1)
            occ=b.get(t)
            if occ is None:
                out.append(t)
            else:
                if occ.isupper()!=p.isupper(): out.append(t)
                break
            cf+=df; cr+=dr
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop corner', {'board': {'e4': 'P', 'h1': 'b'}, 'from': 'h1'}, ['e4', 'f3', 'g2']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6'])],
 [('rook blocked by enemy', {'board': {'a1': 'R', 'a3': 'p', 'c1': 'N'}, 'from': 'a1'},
   ['a2', 'a3', 'b1']),
  ('rook behind enemy',
   {'board': {'b4': 'b', 'd4': 'R', 'd6': 'p', 'd8': 'k', 'f4': 'P'}, 'from': 'd4'},
   ['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']),
  ('bishop centre',
   {'board': {'b2': 'P', 'b6': 'P', 'd4': 'B', 'f6': 'n', 'g1': 'q'}, 'from': 'd4'},
   ['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']),
  ('queen boxed',
   {'board': {'d1': 'K', 'd2': 'P', 'e1': 'Q', 'e2': 'P', 'f1': 'B', 'f2': 'P'}, 'from': 'e1'},
   []),
  ('queen open', {'board': {'a5': 'R', 'd5': 'q', 'd7': 'p', 'g8': 'P'}, 'from': 'd5'},
   ['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5',
    'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']),
  ('black rook top edge', {'board': {'e8': 'k', 'h5': 'P', 'h8': 'r'}, 'from': 'h8'},
   ['f8', 'g8', 'h5', 'h6', 'h7']),
  ('queen along diagonal capture',
   {'board': {'a3': 'n', 'c1': 'Q', 'c3': 'P', 'h6': 'r'}, 'from': 'c1'},
   ['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']),
  ('bishop sw ray', {'board': {'c2': 'r', 'f5': 'B', 'h7': 'p'}, 'from': 'f5'},
   ['c2', 'c8', 'd3', 'd7', 'e4', 'e6', 'g4', 'g6', 'h3', 'h7'])]]
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
rook blocked by enemy['a2', 'a3', 'b1']['a2', 'a3', 'b1']Passed
rook behind enemy['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']['b4', 'c4', 'd1', 'd2', 'd3', 'd5', 'd6', 'e4']Passed
bishop corner['e4', 'f3', 'g2']['e4', 'f3', 'g2']Passed
bishop centre['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']['c3', 'c5', 'e3', 'e5', 'f2', 'f6', 'g1']Passed
queen boxed[][]Passed
queen open['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5', 'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']['a2', 'a5', 'a8', 'b3', 'b5', 'b7', 'c4', 'c5', 'c6', 'd1', 'd2', 'd3', 'd4', 'd6', 'e4', 'e5', 'e6', 'f3', 'f5', 'f7', 'g2', 'g5', 'g8', 'h1', 'h5']Passed
black rook top edge['f8', 'g8', 'h5', 'h6', 'h7']['f8', 'g8', 'h5', 'h6', 'h7']Passed
queen along diagonal capture['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']['a1', 'a3', 'b1', 'b2', 'c2', 'd1', 'd2', 'e1', 'e3', 'f1', 'f4', 'g1', 'g5', 'h1', 'h6']Passed

SHA-256 / 82e4d25bd239f1a58e40d8328c0c7e37ed23837295cb1d40eae4eb8bf5221f50

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

Case digest / c341b860b14c42ee484f8cdd3081835be34e60ef6b5813810f3eb2acd9b8ea8f