So, I'm looking at a problem that involves finding the minimum number of jumps that a knight would have to make to move from one square to another on the board.
Simplifying the problem to just cases where the knight starts at the origin, I've noticed that for cases of nJumps >= 5, there is a pattern that arises with octagonal shells.
This pattern is even more clear when I just look at specific shells. For instance, below are the squares that can be reached in a minimum of 5 jumps.
I'm trying to figure out an equation that can be used to convert from the square coordinates to the number of jumps, but I can't seem to figure out a good equation for the shells.
I tried to use bounding boxes, but that didn't seem to work for the diagonal parts of the shells (I know it's probably possible but I just couldn't figure it out).
Then I noticed that I could use diagonals (x - y) but sometimes the number of squares associated with a color is 3 and sometimes its 4 (sometimes it's also 2 but I could figure those out).
What is the best way to describe these shells so as to be able to translate coordinates to their appropriate shell?


