FAILURE MAP
← Case archive

FA-82341 / Chess move legality / Open access

Knight on the h-file jumps to the a-file · case 01

A knight on h3 is offered a2 and a4, which wrap around the board edge.

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

ROOT CAUSE

The file-distance guard is one-sided, so a wrap from the h-file to the a-file (file difference -7) is not rejected.

THE FAILURE

The file-distance guard is one-sided, so a wrap from the h-file to the a-file (file difference -7) is not rejected.

Unsuccessful approach: Rejecting file distance 2 as well removes every legitimate two-file knight jump.

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>63: continue
        if 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']),
  ('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'])],
 [('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']),
  ('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']),
  ('top rank knight', {'board': {'c7': 'N'}, 'from': 'c7'}, ['a6', 'a8', 'b5', 'd5', 'e6', 'e8'])],
 [('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']),
  ('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'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('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']),
  ('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']),
  ('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 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['a2', 'a6', 'b3', 'b5', 'f2', 'f4', 'g1', 'g5']['f2', 'f4', 'g1', 'g5']Failed
g-file knight['a5', 'a7', 'e4', 'e6', 'f3', 'f7', 'h3', 'h7']['e4', 'e6', 'f3', 'f7', 'h3', 'h7']Failed
b-file knight['a2', 'a6', 'c2', 'c6', 'd3', 'd5']['a2', 'a6', 'c2', 'c6', 'd3', 'd5']Passed
centre with own and enemy['b3', 'b5', 'c2', 'c6', 'e2', 'f3']['b3', 'b5', 'c2', 'c6', 'e2', 'f3']Passed
black knight own pieces['c6', 'd3', 'f3', 'f7', 'g4', 'g6']['c6', 'd3', 'f3', 'f7', 'g4', 'g6']Passed
h8 corner['a7', 'b8', 'f7', 'g6']['f7', 'g6']Failed
knight to a1 from b3['a1', 'a5', 'c1', 'c5', 'd2', 'd4']['a1', 'a5', 'c1', 'c5', 'd2', 'd4']Passed

SHA-256 / 27a7206c1b22f42a1dc242e3ab470e18b3dbf58b4d18347e201d1530563f6c99

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']),
  ('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'])],
 [('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']),
  ('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']),
  ('top rank knight', {'board': {'c7': 'N'}, 'from': 'c7'}, ['a6', 'a8', 'b5', 'd5', 'e6', 'e8'])],
 [('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']),
  ('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'])],
 [('corner a1', {'board': {'a1': 'N'}, 'from': 'a1'}, ['b3', 'c2']),
  ('h-file knight', {'board': {'h3': 'N'}, 'from': 'h3'}, ['f2', 'f4', 'g1', 'g5']),
  ('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']),
  ('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']),
  ('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 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']['b3', 'c2']Failed
h-file knight['g1', 'g5']['f2', 'f4', 'g1', 'g5']Failed
g-file knight['f3', 'f7', 'h3', 'h7']['e4', 'e6', 'f3', 'f7', 'h3', 'h7']Failed
b-file knight['a2', 'a6', 'c2', 'c6']['a2', 'a6', 'c2', 'c6', 'd3', 'd5']Failed
centre with own and enemy['c2', 'c6', 'e2']['b3', 'b5', 'c2', 'c6', 'e2', 'f3']Failed
black knight own pieces['d3', 'f3', 'f7']['c6', 'd3', 'f3', 'f7', 'g4', 'g6']Failed
h8 corner['g6']['f7', 'g6']Failed
knight to a1 from b3['a1', 'a5', 'c1', 'c5']['a1', 'a5', 'c1', 'c5', 'd2', 'd4']Failed

SHA-256 / a99fabac640fdfefaba2fd134daf905057bbf5a9a27b38685f8e337cb1f22532

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

Case digest / c68dd271c32a30f54a52552dc9a1d539c33031a9a2ae0d7ef9b61f8b77e1d1fa