FA-82616 / Chess move legality / Open access
Rook reaching the eighth rank asked for a promotion · case 01
"a1a8" for a rook returns "promotion required".
ROOT CAUSE
Arrival on rank 1 or 8 triggers the promotion rule for any piece.
VERIFIED REPAIR
Only a white pawn arriving on rank 8 or a black pawn on rank 1 promotes.
Unsuccessful approach: Handling only white pawns never requires promotion for black pawns.
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'
if fr==to: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=to[1] in '18'
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 needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, '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'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('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'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece'),
('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'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')]]
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 needs promotion | promotion required | promotion required | Passed |
| black promotes knight | ok | ok | Passed |
| rook reaches last rank | promotion required | ok | Failed |
| castling encoding | promotion required | ok | Failed |
SHA-256 / 69f5cdde82af18d654016e584ea86ca2614afb47a28feb569efbbc90807ddb62
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==to: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=p=='P' and to[1]=='8'
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 needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, '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'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('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'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece'),
('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'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')]]
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 needs promotion | ok | promotion required | Failed |
| black promotes knight | unexpected promotion | ok | Failed |
| rook reaches last rank | ok | ok | Passed |
| castling encoding | ok | ok | Passed |
SHA-256 / 1f8b9cef68e019f1f884d8386e16460407927d6a250b46fad113072c65bf7655
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 needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, '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'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('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'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece'),
('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'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')]]
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 needs promotion | promotion required | promotion required | Passed |
| black promotes knight | ok | ok | Passed |
| rook reaches last rank | ok | ok | Passed |
| castling encoding | ok | ok | Passed |
SHA-256 / 930704deb8550975320f9bc6cdd2a0154cfa0cf3b1707245e8d4ad1933837d24
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.850379+00:00.
Case digest / b346b17ac58d65572dacf50973802c9c79416a7e658d29872d1018900ec777bb