login
Squares visited by either knight when a white knight and a black knight are moving on a diagonally numbered board, always to the lowest available unvisited square; white moves first.
2

%I #10 Apr 16 2021 00:12:20

%S 1,8,9,6,4,2,3,12,13,16,7,24,5,19,10,15,26,34,18,14,11,21,30,43,37,20,

%T 48,25,22,17,31,39,38,29,46,23,58,32,49,42,41,35,52,45,27,53,33,28,40,

%U 54,51,63,60,73,70,84,57,50,67,59,81,47,93,56,106,69,123

%N Squares visited by either knight when a white knight and a black knight are moving on a diagonally numbered board, always to the lowest available unvisited square; white moves first.

%C Board is numbered as follows:

%C 1 2 4 7 11 16 .

%C 3 5 8 12 17 .

%C 6 9 13 18 .

%C 10 14 19 .

%C 15 20 .

%C 21 .

%C .

%C Both knights start on square 1, white moves to the lowest unvisited square (8), black then moves to the lowest unvisited square (9) and so on...

%C This sequence is finite, on the 583rd move or the white knight's 292nd step, square 406 is visited, after which black wins and the game is over.

%o (Python)

%o KM=[(2, 1), (1, 2), (-1, 2), (-2, 1), (-2, -1), (-1, -2), (1, -2), (2, -1)]

%o def idx(loc): i, j = loc; return (i+j-1)*(i+j-2)//2 + j

%o def next_move(loc, visited):

%o i, j = loc; moves = [(i+io, j+jo) for io, jo in KM if i+io>0 and j+jo>0]

%o available = [m for m in moves if m not in visited]

%o return min(available, default=None, key=lambda x: idx(x))

%o def aseq():

%o loc, s, turn, alst = [(1, 1), (1, 1)], {(1, 1)}, 0, [1]

%o m = next_move(loc[turn], s)

%o while m != None:

%o loc[turn], s, turn, alst = m, s|{m}, 1 - turn, alst + [idx(m)]

%o m = next_move(loc[turn], s)

%o return alst

%o A342948_lst = aseq() # _Michael S. Branicky_, Mar 30 2021

%Y Cf. A338288, A338289, A338290, A342946, A342947.

%K nonn,fini

%O 1,2

%A _Andrew Smith_, Mar 30 2021