FA-82776 / Chess move legality / Open access
Every position without king moves called checkmate · case 01
A cornered black king that is not in check is declared mated.
ROOT CAUSE
The final classification ignores whether the king is currently attacked.
THE FAILURE
The final classification ignores whether the king is currently attacked.
Unsuccessful approach: Deciding check by queen adjacency calls long-range mates stalemate.
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):
if t==wq: 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'
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'),
('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate')],
[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
('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'),
('edge mate', {'bk': 'e8', 'wk': 'e6', 'wq': 'e7'}, 'checkmate'),
('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')],
[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
('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'),
('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'),
('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate')],
[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, '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'),
('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate')]]
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 |
|---|---|---|---|
| corner stalemate | checkmate | stalemate | Failed |
| queen kiss mate | checkmate | checkmate | Passed |
| back rank long mate | checkmate | checkmate | Passed |
| capture free queen | ongoing | ongoing | Passed |
| queen check escape | ongoing | ongoing | Passed |
| shielded by king | ongoing | ongoing | Passed |
| stalemate h-file | checkmate | stalemate | Failed |
| mate with rank retreat | checkmate | checkmate | Passed |
SHA-256 / 19d2cf27209379b6678ce858a6539b9f9b2ab115db81681a928590c0be51f51f
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: 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 near(bk,wq) 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'),
('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate')],
[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
('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'),
('edge mate', {'bk': 'e8', 'wk': 'e6', 'wq': 'e7'}, 'checkmate'),
('orthogonal free capture', {'bk': 'a8', 'wk': 'h1', 'wq': 'a7'}, 'ongoing')],
[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
('back rank long mate', {'bk': 'h8', 'wk': 'g6', 'wq': 'a8'}, 'checkmate'),
('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
('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'),
('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'),
('stalemate h-file', {'bk': 'h8', 'wk': 'f7', 'wq': 'g6'}, 'stalemate'),
('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate')],
[('corner stalemate', {'bk': 'a8', 'wk': 'c6', 'wq': 'b6'}, 'stalemate'),
('queen kiss mate', {'bk': 'a8', 'wk': 'b6', 'wq': 'b7'}, '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'),
('mate with rank retreat', {'bk': 'b1', 'wk': 'a3', 'wq': 'd1'}, 'checkmate'),
('queen kiss far side', {'bk': 'b8', 'wk': 'a6', 'wq': 'd8'}, 'checkmate')]]
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 |
|---|---|---|---|
| corner stalemate | stalemate | stalemate | Passed |
| queen kiss mate | checkmate | checkmate | Passed |
| back rank long mate | stalemate | checkmate | Failed |
| capture free queen | ongoing | ongoing | Passed |
| queen check escape | ongoing | ongoing | Passed |
| shielded by king | ongoing | ongoing | Passed |
| stalemate h-file | stalemate | stalemate | Passed |
| mate with rank retreat | stalemate | checkmate | Failed |
SHA-256 / 4cfe0a6be0bc50fb7e55246090eb819e5471feab31ab9c6b3783df96109a9fd1
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.292871+00:00.
Case digest / a511ca0572dcb4f34315863b8b8ef97de2c17cc9a2fb46d68fb096ad442844bc