FAILURE MAP
← Case archive

FA-82346 / Chess move legality / Open access

Knight target off the top edge accepted · case 01

A knight on c7 is offered a ninth-rank square named "a9".

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

ROOT CAUSE

The upper bound admits index 64, one past h8.

THE FAILURE

The upper bound admits index 64, one past h8.

Unsuccessful approach: Excluding index 0 makes a1 unreachable.

Case contract

Input: {"board": {square: piece}, "from": square of a knight}. Squares are indexed 0..63 with a1=0, h1=7, a8=56. Return the sorted list of pseudo-legal knight destinations: on the board, not wrapping across the a/h file edge, and not occupied by a piece of the knight's colour.

Why this case matters

Move validators gate every move in engines, servers and arbiters; accepting an illegal move or rejecting a legal one corrupts the game record.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    def idx(s): return (int(s[1])-1)*8 + ord(s[0])-97
    def name(i): return 'abcdefgh'[i%8]+str(i//8+1)
    b=x['board']; f=idx(x['from']); me=b[x['from']]
    out=[]
    for d in (6,10,15,17,-6,-10,-15,-17):
        t=f+d
        if t<0 or t>64: continue
        if abs(t%8-f%8)>2: continue
        occ=b.get(name(t))
        if occ and occ.isupper()==me.isupper(): continue
        out.append(name(t))
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('g-file knight', {'board': {'g5': 'n'}, 'from': 'g5'}, ['e4', 'e6', 'f3', 'f7', 'h3', 'h7']),
  ('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('centre with own and enemy',
   {'board': {'c6': 'p', 'd4': 'N', 'e6': 'P', 'f5': 'B'}, 'from': 'd4'},
   ['b3', 'b5', 'c2', 'c6', 'e2', 'f3']),
  ('black knight own pieces', {'board': {'c4': 'q', 'd7': 'p', 'e5': 'n', 'f3': 'P'}, 'from': 'e5'},
   ['c6', 'd3', 'f3', 'f7', 'g4', 'g6']),
  ('h8 corner', {'board': {'h8': 'n'}, 'from': 'h8'}, ['f7', 'g6']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h8 corner', {'board': {'h8': 'n'}, 'from': 'h8'}, ['f7', 'g6']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('top rank knight', {'board': {'c7': 'N'}, 'from': 'c7'}, ['a6', 'a8', 'b5', 'd5', 'e6', 'e8']),
  ('knight on g2', {'board': {'e1': 'Q', 'g2': 'N'}, 'from': 'g2'}, ['e3', 'f4', 'h4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('g-file knight', {'board': {'g5': 'n'}, 'from': 'g5'}, ['e4', 'e6', 'f3', 'f7', 'h3', 'h7']),
  ('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('g-file knight', {'board': {'g5': 'n'}, 'from': 'g5'}, ['e4', 'e6', 'f3', 'f7', 'h3', 'h7']),
  ('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])]]
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 a1['b3', 'c2']['b3', 'c2']Passed
h-file knight['f2', 'f4', 'g1', 'g5']['f2', 'f4', 'g1', 'g5']Passed
g-file knight['e4', 'e6', 'f3', 'f7', 'h3', 'h7']['e4', 'e6', 'f3', 'f7', 'h3', 'h7']Passed
b-file knight['a2', 'a6', 'c2', 'c6', 'd3', 'd5']['a2', 'a6', 'c2', 'c6', 'd3', 'd5']Passed
knight to a1 from b3['a1', 'a5', 'c1', 'c5', 'd2', 'd4']['a1', 'a5', 'c1', 'c5', 'd2', 'd4']Passed
knight c2 reaches a1 area['a1', 'a3', 'b4', 'd4', 'e1', 'e3']['a1', 'a3', 'b4', 'd4', 'e1', 'e3']Passed
knight on c8['a7', 'a9', 'b6', 'd6', 'e7']['a7', 'b6', 'd6', 'e7']Failed
knight on b7['a5', 'a9', 'c5', 'd6', 'd8']['a5', 'c5', 'd6', 'd8']Failed

SHA-256 / 61ed8d26dfff0ab975af9dd06f7eaaf28b9ff498cda2ca5e66ba774649739574

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    def idx(s): return (int(s[1])-1)*8 + ord(s[0])-97
    def name(i): return 'abcdefgh'[i%8]+str(i//8+1)
    b=x['board']; f=idx(x['from']); me=b[x['from']]
    out=[]
    for d in (6,10,15,17,-6,-10,-15,-17):
        t=f+d
        if t<=0 or t>63: continue
        if abs(t%8-f%8)>2: continue
        occ=b.get(name(t))
        if occ and occ.isupper()==me.isupper(): continue
        out.append(name(t))
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('g-file knight', {'board': {'g5': 'n'}, 'from': 'g5'}, ['e4', 'e6', 'f3', 'f7', 'h3', 'h7']),
  ('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('centre with own and enemy',
   {'board': {'c6': 'p', 'd4': 'N', 'e6': 'P', 'f5': 'B'}, 'from': 'd4'},
   ['b3', 'b5', 'c2', 'c6', 'e2', 'f3']),
  ('black knight own pieces', {'board': {'c4': 'q', 'd7': 'p', 'e5': 'n', 'f3': 'P'}, 'from': 'e5'},
   ['c6', 'd3', 'f3', 'f7', 'g4', 'g6']),
  ('h8 corner', {'board': {'h8': 'n'}, 'from': 'h8'}, ['f7', 'g6']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h8 corner', {'board': {'h8': 'n'}, 'from': 'h8'}, ['f7', 'g6']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('top rank knight', {'board': {'c7': 'N'}, 'from': 'c7'}, ['a6', 'a8', 'b5', 'd5', 'e6', 'e8']),
  ('knight on g2', {'board': {'e1': 'Q', 'g2': 'N'}, 'from': 'g2'}, ['e3', 'f4', 'h4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('g-file knight', {'board': {'g5': 'n'}, 'from': 'g5'}, ['e4', 'e6', 'f3', 'f7', 'h3', 'h7']),
  ('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('g-file knight', {'board': {'g5': 'n'}, 'from': 'g5'}, ['e4', 'e6', 'f3', 'f7', 'h3', 'h7']),
  ('b-file knight', {'board': {'b4': 'N'}, 'from': 'b4'}, ['a2', 'a6', 'c2', 'c6', 'd3', 'd5']),
  ('knight to a1 from b3', {'board': {'a1': 'r', 'b3': 'N'}, 'from': 'b3'},
   ['a1', 'a5', 'c1', 'c5', 'd2', 'd4']),
  ('knight c2 reaches a1 area', {'board': {'c2': 'n'}, 'from': 'c2'},
   ['a1', 'a3', 'b4', 'd4', 'e1', 'e3']),
  ('knight on c8', {'board': {'c8': 'n'}, 'from': 'c8'}, ['a7', 'b6', 'd6', 'e7']),
  ('knight on b7', {'board': {'b7': 'N'}, 'from': 'b7'}, ['a5', 'c5', 'd6', 'd8'])]]
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 a1['b3', 'c2']['b3', 'c2']Passed
h-file knight['f2', 'f4', 'g1', 'g5']['f2', 'f4', 'g1', 'g5']Passed
g-file knight['e4', 'e6', 'f3', 'f7', 'h3', 'h7']['e4', 'e6', 'f3', 'f7', 'h3', 'h7']Passed
b-file knight['a2', 'a6', 'c2', 'c6', 'd3', 'd5']['a2', 'a6', 'c2', 'c6', 'd3', 'd5']Passed
knight to a1 from b3['a5', 'c1', 'c5', 'd2', 'd4']['a1', 'a5', 'c1', 'c5', 'd2', 'd4']Failed
knight c2 reaches a1 area['a3', 'b4', 'd4', 'e1', 'e3']['a1', 'a3', 'b4', 'd4', 'e1', 'e3']Failed
knight on c8['a7', 'b6', 'd6', 'e7']['a7', 'b6', 'd6', 'e7']Passed
knight on b7['a5', 'c5', 'd6', 'd8']['a5', 'c5', 'd6', 'd8']Passed

SHA-256 / 1990c362072c8e80a40bc59f8788b6bfaa7ba6147e323551192f6dd73d1a5d82

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

Case digest / a4152c7a15cb2717dbb65a77e4a57103a05bc90df3760702ccea6ae843e56faa