Sunday, January 29, 2017

build your own knight's tour

A couple of posts back I mentioned some knight and king's tour puzzles that I had put together (knights here, kings here). I've added another page based on the same underlying framework where you can build your own knight's tour.

You start off with something like this:


Green squares indicate a legal move, and the numbers on each square tell you how many open moves are available from that square.

Visited squares are marked with a check, and a map of your path is traced on the image below the board.



The "Warnsdorff" heuristic for finding a tour is to always move to a square with the lowest number of available moves. This heuristic works well - it often leads you to a successfully completed tours. You can try this approach, or experiment with others. In the example above, following this method presents you with two choices initially (moving to one of the two squares with 2 open neighbours), but at the third move leaves you with only one option.

Whatever approach you take, if you feel you've made a wrong move, or find that you are completely blocked, hit the "backtrack" button to move back one step.

Some older posts on knight tours:
Knight Moves
Closing Time
Punctured Tours