I've already written about a trapped knight in a post from May 23rd 2020 titled Knight Tours in which the Knight gets trapped on an infinite chess board if it follows these rules:
Suppose we devise a Knight Tour such that the Knight starts on square 0 and then moves always to the unvisited square closest to the origin. "Closest to the origin" is meant in the sense of Euclidean distance, and in case of a tie, the square coming earliest on the spiral is chosen.
On the first move, the Knight could move to squares 9, 11, 13, 15, 17, 19, 21 or 23. All these squares are the same distance from the 0 square but 9 is chosen because it comes first in the spiral. From 9, subsequent squares are 2, 5, 8, 3, 6, 1, 4, 7, 10, 13 and so on.
Figure 1 depicts the situation:
Figure 1 |
The initial terms are of the sequence are:
0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 76, 47, 50, 27, 12, 33, 16, 39, 20, 45, 24, 51, 48, 77, 114, 73, 70, 105, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 124, 81, ...
What's really interesting about this tour is that the knight gets trapped at the 22325th move, where it can't reach any unvisited square. The square on which the Knight is stuck is 25983.
Of course, if the numbering began from one instead of zero, then the square on which the knight becomes stuck would be 25984.
Figure 2: screenshot from Numberphile video |
As can be seen, the numbering starts from one, not zero. The rule for the knight's movements is that it must move to the lowest available square and not the square that is closest to the origin. The numbers of the squares that the knight moves to are listed in OEIS A316667:
A316667 | Squares visited by a knight moving on a spirally numbered board always to the lowest available unvisited square. |
The initial terms are:
1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36
As the OEIS comments state:
This sequence is finite: At step 2016, square 2084 is visited, after which there are no unvisited squares within one knight move.
The number of steps required to become trapped, 2016, is far less than the number required in the PART 1 example where 22325 steps were required. Figure 3 shows the path of the knight as it starts at 1 and ends up at 2084. The path was generated by Python code that I found on this site. I pasted the code into SageMathCell and it worked just fine. Here is the permalink. This graphic always appears in the Numberphile video.
Figure 3 |
If 2084 is the end of the knight's tour and 26943 is never visited, then how can this number be involved? The answer is that we can continue the tour if we repeatedly block the squares where the knight would not have any available moves. Thus when we get to 2467, the square before 2084, we block the latter and move instead to the next lowest number and the tour continues. See Figure 4:
Figure 4: screenshot from Numberphile video |
Eventually the knight gets trapped again once it moves to square 2720. Again we block that square and allow the knight to move to the next lowest square. These blocked squares constitute OEIS A323714:
A323714 | Squares where knight moving to a lowest unvisited square on a spirally numbered board will have no available moves. |
No comments:
Post a Comment