FAILURE MAP
← Case archive

FA-82611 / Chess move legality / Open access

Promotion to king accepted · case 01

"e7e8k" is reported ok.

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

ROOT CAUSE

The promotion letter set includes the king.

THE FAILURE

The promotion letter set includes the king.

Unsuccessful approach: Replacing the king with the pawn letter still admits an impossible promotion.

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=(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 'qrbnk': 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'),
  ('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
  ('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
  ('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
  ('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion')],
 [('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'),
  ('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion')],
 [('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'),
  ('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'),
  ('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
 [('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'),
  ('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'),
  ('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
  ('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
  ('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')]]
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
simple moveokokPassed
rank ninesyntaxsyntaxPassed
rank zerosyntaxsyntaxPassed
white promotionokokPassed
white needs promotionpromotion requiredpromotion requiredPassed
black needs promotionpromotion requiredpromotion requiredPassed
king promotionokbad promotionFailed
pawn promotion letterbad promotionbad promotionPassed

SHA-256 / f8c394f56eefbaacf9a29d6e7fb7f604bd37d55e5c0b0278d1fc19ba208c701c

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') 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 'qrbnp': 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'),
  ('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
  ('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
  ('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
  ('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion')],
 [('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'),
  ('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion')],
 [('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'),
  ('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'),
  ('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
 [('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'),
  ('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'),
  ('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
  ('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
  ('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')]]
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
simple moveokokPassed
rank ninesyntaxsyntaxPassed
rank zerosyntaxsyntaxPassed
white promotionokokPassed
white needs promotionpromotion requiredpromotion requiredPassed
black needs promotionpromotion requiredpromotion requiredPassed
king promotionbad promotionbad promotionPassed
pawn promotion letterokbad promotionFailed

SHA-256 / 1084c5a908109a058fdd8421a5cad9fffe48804b99ca0ed75660b5717acd4925

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

Case digest / 3011e8509449b6efc5835883207d4805e79fd00aff4ab0b564807aadbbe628a6