FA-82356 / Chess move legality / Open access
Mistyped knight offset produces a pawn-like step · case 01
A knight is offered the square two ranks straight below it.
ROOT CAUSE
One of the eight index offsets is -16 instead of -17.
VERIFIED REPAIR
Use the eight offsets +-6, +-10, +-15, +-17.
Unsuccessful approach: Repeating -17 in place of -15 omits a knight jump and duplicates another.
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,-16):
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']),
('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'])],
[('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'])],
[('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']),
('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']),
('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']),
('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 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']),
('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 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 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| corner a1 | ['b3', 'c2'] | ['b3', 'c2'] | Passed |
| h-file knight | ['f2', 'f4', 'g5', 'h1'] | ['f2', 'f4', 'g1', 'g5'] | Failed |
| g-file knight | ['e4', 'e6', 'f7', 'g3', 'h3', 'h7'] | ['e4', 'e6', 'f3', 'f7', 'h3', 'h7'] | Failed |
| b-file knight | ['a6', 'b2', 'c2', 'c6', 'd3', 'd5'] | ['a2', 'a6', 'c2', 'c6', 'd3', 'd5'] | Failed |
| centre with own and enemy | ['b3', 'b5', 'c6', 'd2', 'e2', 'f3'] | ['b3', 'b5', 'c2', 'c6', 'e2', 'f3'] | Failed |
| black knight own pieces | ['c6', 'e3', 'f3', 'f7', 'g4', 'g6'] | ['c6', 'd3', 'f3', 'f7', 'g4', 'g6'] | Failed |
| knight on g2 | ['e3', 'f4', 'h4'] | ['e3', 'f4', 'h4'] | Passed |
| knight c2 reaches a1 area | ['a1', 'a3', 'b4', 'd4', 'e1', 'e3'] | ['a1', 'a3', 'b4', 'd4', 'e1', 'e3'] | Passed |
SHA-256 / 37fdf89f6beb60b676041b7355ebb886ff3a3808aa3fe71225c6fbdc455cf66d
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,-17,-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']),
('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'])],
[('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'])],
[('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']),
('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']),
('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']),
('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 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']),
('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 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 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| corner a1 | ['b3', 'c2'] | ['b3', 'c2'] | Passed |
| h-file knight | ['f2', 'f4', 'g1', 'g1', 'g5'] | ['f2', 'f4', 'g1', 'g5'] | Failed |
| g-file knight | ['e4', 'e6', 'f3', 'f3', 'f7', 'h7'] | ['e4', 'e6', 'f3', 'f7', 'h3', 'h7'] | Failed |
| b-file knight | ['a2', 'a2', 'a6', 'c6', 'd3', 'd5'] | ['a2', 'a6', 'c2', 'c6', 'd3', 'd5'] | Failed |
| centre with own and enemy | ['b3', 'b5', 'c2', 'c2', 'c6', 'f3'] | ['b3', 'b5', 'c2', 'c6', 'e2', 'f3'] | Failed |
| black knight own pieces | ['c6', 'd3', 'd3', 'f7', 'g4', 'g6'] | ['c6', 'd3', 'f3', 'f7', 'g4', 'g6'] | Failed |
| knight on g2 | ['e3', 'f4', 'h4'] | ['e3', 'f4', 'h4'] | Passed |
| knight c2 reaches a1 area | ['a1', 'a3', 'b4', 'd4', 'e1', 'e3'] | ['a1', 'a3', 'b4', 'd4', 'e1', 'e3'] | Passed |
SHA-256 / 6b2df1263f4df3fdeeee3b755c2b2e0683c38ef8887b5426bf8e3c9c4de10403
3 / The verified repair
Exit 0"""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']),
('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'])],
[('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'])],
[('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']),
('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']),
('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']),
('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 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']),
('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 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 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 |
| 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 |
| knight on g2 | ['e3', 'f4', 'h4'] | ['e3', 'f4', 'h4'] | Passed |
| knight c2 reaches a1 area | ['a1', 'a3', 'b4', 'd4', 'e1', 'e3'] | ['a1', 'a3', 'b4', 'd4', 'e1', 'e3'] | Passed |
SHA-256 / 07973a27d1d5a5142ea893c7a139d778817849daad9a21bd90a148a710378e2b
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.416906+00:00.
Case digest / c403e97aeac296c368ed18f26d19f9be1c9f2b29f9a041904bd2b0e64921544f