FAILURE MAP
← Case archive

FA-82786 / Chess move legality / Open access

Unprotected queen cannot be captured · case 01

A queen next to the black king with the white king far away is scored as mate.

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

ROOT CAUSE

The queen's own square is treated as attacked by the queen.

THE FAILURE

The queen's own square is treated as attacked by the queen.

Unsuccessful approach: Allowing only diagonal captures still forbids taking an orthogonally adjacent queen.

Case contract

Input: {"wk", "wq", "bk"} squares, black to move. Return "checkmate" if black has no legal king move and is attacked by the queen, "stalemate" if it has none and is not attacked, else "ongoing". The queen attacks along ranks, files and diagonals and is blocked only by the white king; the black king may capture the queen when it is not adjacent to the white king.

Why this case matters

Game-end detection must distinguish mate from stalemate exactly.

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,wq,bk=c(x['wk']),c(x['wq']),c(x['bk'])
    def queen_hits(t, occupied):
        pass
        df,dr=t[0]-wq[0],t[1]-wq[1]
        if not (df==0 or dr==0 or abs(df)==abs(dr)): return False
        sf=(df>0)-(df<0); sr=(dr>0)-(dr<0)
        f,r=wq[0]+sf,wq[1]+sr
        while (f,r)!=t:
            if (f,r) in occupied: return False
            f+=sf; r+=sr
        return True
    def near(a,b2): return max(abs(a[0]-b2[0]),abs(a[1]-b2[1]))<=1
    in_check=queen_hits(bk,{wk})
    moves=0
    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 near(t,wk): continue
            if queen_hits(t,{wk}): continue
            moves+=1
    if moves: return 'ongoing'
    return 'checkmate' if in_check else 'stalemate'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
  ('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, 'checkmate'),
  ('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
  ('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen check escape', {'bk': 'e5', 'wk': 'a1', 'wq': 'e1'}, 'ongoing'),
  ('shielded by king', {'bk': 'e5', 'wk': 'e3', 'wq': 'e1'}, 'ongoing'),
  ('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')],
 [('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen check escape', {'bk': 'e5', 'wk': 'a1', 'wq': 'e1'}, 'ongoing'),
  ('shielded by king', {'bk': 'e5', 'wk': 'e3', 'wq': 'e1'}, 'ongoing'),
  ('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
  ('queen behind white king', {'bk': 'a1', 'wk': 'b3', 'wq': 'b5'}, 'ongoing'),
  ('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
  ('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')],
 [('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen behind white king', {'bk': 'a1', 'wk': 'b3', 'wq': 'b5'}, 'ongoing'),
  ('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
  ('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate'),
  ('edge mate', {'bk': 'e8', 'wk': 'e6', 'wq': 'e7'}, 'checkmate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing'),
  ('far queen ongoing', {'bk': 'd5', 'wk': 'a1', 'wq': 'h2'}, 'ongoing'),
  ('king retreat along queen file', {'bk': 'd7', 'wk': 'a1', 'wq': 'd1'}, 'ongoing')],
 [('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
  ('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, 'checkmate'),
  ('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
  ('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('edge mate', {'bk': 'e8', 'wk': 'e6', 'wq': 'e7'}, 'checkmate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing'),
  ('far queen ongoing', {'bk': 'd5', 'wk': 'a1', 'wq': 'h2'}, 'ongoing'),
  ('king retreat along queen file', {'bk': 'd7', 'wk': 'a1', 'wq': 'd1'}, 'ongoing')],
 [('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
  ('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, 'checkmate'),
  ('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
  ('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen check escape', {'bk': 'e5', 'wk': 'a1', 'wq': 'e1'}, 'ongoing'),
  ('shielded by king', {'bk': 'e5', 'wk': 'e3', 'wq': 'e1'}, 'ongoing'),
  ('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')]]
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
corner stalematestalematestalematePassed
queen kiss matecheckmatecheckmatePassed
back rank long matecheckmatecheckmatePassed
capture free queencheckmateongoingFailed
queen check escapeongoingongoingPassed
shielded by kingongoingongoingPassed
stalemate h-filestalematestalematePassed
orthogonal free capturecheckmateongoingFailed

SHA-256 / 697df7f360a32b2c7a8d7d8765a061fede7710e0e9cf2c49b916477218849376

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,wq,bk=c(x['wk']),c(x['wq']),c(x['bk'])
    def queen_hits(t, occupied):
        if t==wq and t[0]!=bk[0] and t[1]!=bk[1]: return False
        df,dr=t[0]-wq[0],t[1]-wq[1]
        if not (df==0 or dr==0 or abs(df)==abs(dr)): return False
        sf=(df>0)-(df<0); sr=(dr>0)-(dr<0)
        f,r=wq[0]+sf,wq[1]+sr
        while (f,r)!=t:
            if (f,r) in occupied: return False
            f+=sf; r+=sr
        return True
    def near(a,b2): return max(abs(a[0]-b2[0]),abs(a[1]-b2[1]))<=1
    in_check=queen_hits(bk,{wk})
    moves=0
    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 near(t,wk): continue
            if queen_hits(t,{wk}): continue
            moves+=1
    if moves: return 'ongoing'
    return 'checkmate' if in_check else 'stalemate'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
  ('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, 'checkmate'),
  ('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
  ('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen check escape', {'bk': 'e5', 'wk': 'a1', 'wq': 'e1'}, 'ongoing'),
  ('shielded by king', {'bk': 'e5', 'wk': 'e3', 'wq': 'e1'}, 'ongoing'),
  ('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')],
 [('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen check escape', {'bk': 'e5', 'wk': 'a1', 'wq': 'e1'}, 'ongoing'),
  ('shielded by king', {'bk': 'e5', 'wk': 'e3', 'wq': 'e1'}, 'ongoing'),
  ('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
  ('queen behind white king', {'bk': 'a1', 'wk': 'b3', 'wq': 'b5'}, 'ongoing'),
  ('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
  ('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')],
 [('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen behind white king', {'bk': 'a1', 'wk': 'b3', 'wq': 'b5'}, 'ongoing'),
  ('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
  ('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate'),
  ('edge mate', {'bk': 'e8', 'wk': 'e6', 'wq': 'e7'}, 'checkmate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing'),
  ('far queen ongoing', {'bk': 'd5', 'wk': 'a1', 'wq': 'h2'}, 'ongoing'),
  ('king retreat along queen file', {'bk': 'd7', 'wk': 'a1', 'wq': 'd1'}, 'ongoing')],
 [('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
  ('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, 'checkmate'),
  ('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
  ('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('edge mate', {'bk': 'e8', 'wk': 'e6', 'wq': 'e7'}, 'checkmate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing'),
  ('far queen ongoing', {'bk': 'd5', 'wk': 'a1', 'wq': 'h2'}, 'ongoing'),
  ('king retreat along queen file', {'bk': 'd7', 'wk': 'a1', 'wq': 'd1'}, 'ongoing')],
 [('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
  ('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, 'checkmate'),
  ('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
  ('capture free queen', {'bk': 'a8', 'wk': 'h1', 'wq': 'b7'}, 'ongoing'),
  ('queen check escape', {'bk': 'e5', 'wk': 'a1', 'wq': 'e1'}, 'ongoing'),
  ('shielded by king', {'bk': 'e5', 'wk': 'e3', 'wq': 'e1'}, 'ongoing'),
  ('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
  ('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')]]
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
corner stalematestalematestalematePassed
queen kiss matecheckmatecheckmatePassed
back rank long matecheckmatecheckmatePassed
capture free queenongoingongoingPassed
queen check escapeongoingongoingPassed
shielded by kingongoingongoingPassed
stalemate h-filestalematestalematePassed
orthogonal free capturecheckmateongoingFailed

SHA-256 / 4ccd2021955ae28177ba5b7e7a9b264fd14da0b0bb369bceb629c11bef609b12

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

Case digest / eec6ad1b8b8de3c5dd0dddb09bf93a2a8336597048ec93a780574287eaacc0f7