FA-82621 / Chess move legality / Open access
Null move string accepted · case 01
"e2e2" is reported ok.
ROOT CAUSE
The origin and destination are never compared.
VERIFIED REPAIR
Reject strings whose origin equals the destination.
Unsuccessful approach: Comparing only files rejects every vertical move.
Case contract
Input: {"board", "uci": move string}. Return "ok" or a reason: "syntax" (length not 4-5, squares outside a1-h8, or from equals to), "no piece" (origin empty), "promotion required" (a white pawn reaching rank 8 or black pawn reaching rank 1 without a suffix), "unexpected promotion" (suffix on any other move), "bad promotion" (suffix not one of q, r, b, n).
Why this case matters
Engines and servers exchange moves in this long algebraic format.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
u=x['uci']; b=x['board']
if len(u) not in (4,5): return 'syntax'
fr,to,promo=u[:2],u[2:4],u[4:]
for s in (fr,to):
if s[0] not in 'abcdefgh' or s[1] not in '12345678': return 'syntax'
pass
p=b.get(fr)
if p is None: return 'no piece'
last=(p=='P' and to[1]=='8') or (p=='p' and to[1]=='1')
if last and not promo: return 'promotion required'
if promo and not last: return 'unexpected promotion'
if promo and promo not in 'qrbn': return 'bad promotion'
return 'ok'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')]]
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 |
|---|---|---|---|
| simple move | ok | ok | Passed |
| rank nine | syntax | syntax | Passed |
| rank zero | syntax | syntax | Passed |
| white promotion | ok | ok | Passed |
| black promotes knight | ok | ok | Passed |
| suffix on quiet move | unexpected promotion | unexpected promotion | Passed |
| null move | ok | syntax | Failed |
| too long | syntax | syntax | Passed |
SHA-256 / b7a0fe94c0a79df1197abbe52edf60dc394d4c94928413ece5be8ad7df0563ee
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
u=x['uci']; b=x['board']
if len(u) not in (4,5): return 'syntax'
fr,to,promo=u[:2],u[2:4],u[4:]
for s in (fr,to):
if s[0] not in 'abcdefgh' or s[1] not in '12345678': return 'syntax'
if fr[0]==to[0]: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=(p=='P' and to[1]=='8') or (p=='p' and to[1]=='1')
if last and not promo: return 'promotion required'
if promo and not last: return 'unexpected promotion'
if promo and promo not in 'qrbn': return 'bad promotion'
return 'ok'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')]]
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 |
|---|---|---|---|
| simple move | syntax | ok | Failed |
| rank nine | syntax | syntax | Passed |
| rank zero | syntax | syntax | Passed |
| white promotion | syntax | ok | Failed |
| black promotes knight | ok | ok | Passed |
| suffix on quiet move | unexpected promotion | unexpected promotion | Passed |
| null move | syntax | syntax | Passed |
| too long | syntax | syntax | Passed |
SHA-256 / 3f434e7920e1103a4beeff1ac7599a62c444b1473c5c09c1634da0b790ae6027
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
u=x['uci']; b=x['board']
if len(u) not in (4,5): return 'syntax'
fr,to,promo=u[:2],u[2:4],u[4:]
for s in (fr,to):
if s[0] not in 'abcdefgh' or s[1] not in '12345678': return 'syntax'
if fr==to: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=(p=='P' and to[1]=='8') or (p=='p' and to[1]=='1')
if last and not promo: return 'promotion required'
if promo and not last: return 'unexpected promotion'
if promo and promo not in 'qrbn': return 'bad promotion'
return 'ok'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')]]
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 |
|---|---|---|---|
| simple move | ok | ok | Passed |
| rank nine | syntax | syntax | Passed |
| rank zero | syntax | syntax | Passed |
| white promotion | ok | ok | Passed |
| black promotes knight | ok | ok | Passed |
| suffix on quiet move | unexpected promotion | unexpected promotion | Passed |
| null move | syntax | syntax | Passed |
| too long | syntax | syntax | Passed |
SHA-256 / 696f4d13a85e89b4ee9832c993fc7f72c16d34a39f9c9b358cb2b47ebdcd4a63
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:13.981741+00:00.
Case digest / 471a4d02631fcb9f1f50389d381e6d214e95a56ca76eb464b07cb0d91ece5f15