The trapped knight is a deterministic walk through lattice points
using a chess knight's moves without revisiting a lattice
point. The allowed displacements are
and
, with all four sign choices
allowed in each pair.
Number the lattice points starting with 1 at the origin and continuing outward in a spiral. One convention uses the directions right, up, left, and down repeatedly, with successive run lengths 1, 1, 2, 2, 3, 3, .... Starting on 1, a greedy algorithm always chooses the unvisited lattice point with the smallest label among the legal moves. The labels visited begin 1, 10, 3, 6, 9, 4, 7, 2, 5, 8, ... (OEIS A316667).
The walk visits 2016 distinct lattice points, including the initial one. After 2015 moves it reaches label 2084, where all eight possible destinations have already been visited, so the walk ends.