OFFSET
1,2
COMMENTS
A (1,2) leaper is a chess knight. (1,1) and (1,3) leapers both never get trapped. This is understandable for the (1,1) leaper but not so much for the (1,3) which does get trapped on the spirally numbered board (see A323469). Once the (1,3) leaper reaches 39 it then performs the same set of 4 moves repeatedly, meaning that it never gets trapped.
PROG
(Python)
n = 2
KM = [(n, 1), (1, n), (-1, n), (-n, 1), (-n, -1), (-1, -n), (1, -n), (n, -1)]
def idx(loc):
i, j = loc
return (i + j - 1) * (i + j - 2) // 2 + j
def next_move(loc, visited):
i, j = loc
moves = [(i + io, j + jo) for io, jo in KM if i + io > 0 and j + jo > 0]
available = [m for m in moves if m not in visited]
return min(available, default=None, key=lambda x: idx(x))
def aseq():
locs = [[], []]
loc, s, turn, alst = [(1, 1), (1, 1)], {(1, 1)}, 0, [1]
m = next_move(loc[turn], s)
while m != None:
loc[turn], s, turn, alst = m, s | {m}, 0, alst + [idx(m)]
locs[turn] += [loc[turn]]
m = next_move(loc[turn], s)
if len(s) % 10000 == 0:
print('{steps} moves in'.format(steps = len(s)))
return alst
print(aseq())
CROSSREFS
KEYWORD
sign
AUTHOR
Andrew Smith, Mar 30 2022
STATUS
approved