knight's tour

a knight visits every square of a chessboard exactly once. click any square to start.

a full tour exists from every square of an 8×8 board. finding one by brute force is a mess, so this uses Warnsdorff's rule: always jump to the square with the fewest onward moves. that greedy guess alone solves 62 of the 64 start squares. the other two (i checked, it's a couple of corners) need a little backtracking, so there's a fallback that undoes a bad jump and tries the next-best square.

the numbers are the visit order. blue = visited, red = where the knight is right now.