Search the web for "Knight's Tour" and you'll find dozens of pages.
What could be interesting about a King's Tour ?
In some cases, quite a bit, actually.
Especially when some of the squares are ... 'off limits' !
For more information, scroll to the bottom of this page.
This applet runs in two modes: manual and automatic.
Choose a configuration from the drop down menu of numbers
(all but one have at least one complete tour, and that one
can be solved by removing just one square).
The blue square is the starter, the white square is the goal.
Dark gray is to-be-visited, light gray has been visited,
black is no man's land.
Manual mode: find your own path.
Move the blue square through the maze to reach the goal:
the white square.
Use the four directional arrow keys to move
right, left, up, or down (no diagonal moves).
Blue lines show where you've been.
You must visit every gray square, with the white goal last.
Dark squares are "off limits" and cannot be entered.
(Red and white dots are only there to mark odd/even positions.)
You cannot cross your own path, but you can retrace your steps.
Backspace or ctrl-Z will undo the previous move, or you can
use the appropriate arrow key. Press HOME to start over.
When you enter the white square after visiting all the others,
the blue square disappears and the path turns white.
Need some help ? Press 'S' to solve.
A pathfinder is just a keystroke away.
Press S to start the solver, either from the start or
after any manual moves.
It pauses when it finds a path. At that time,
press C to continue or Q or HOME to quit.
*** NOTE: Also use Q or HOME to reset when the solver finishes.
Watch the status line below for progress reports.
Don't like the configuration ? Change is just a click away !
Click the mouse on a square to change it from open(gray)
to closed(black) or vice versa. Be careful what you choose: you can
make the course possible or impossible by doing so !
Interesting or Trivial ?
First a couple of notes:
- Moves are only orthogonal, not diagonal -
this King is perhaps just a Prince
- Tours are open, they don't return to the start.
By placing the goal next to the start, we could consider
closed tours,
as in puzzle #13, which comes from a large collection
of Path Puzzles at
contestcen.com.
On an open board, wandering square by square can surely
take you to all the squares.
But where can you end up ?
Your freedom in that regard is not complete.
Imagine a checkerboard coloring. With no diagonal moves,
each move takes you from one color to the other. So, if
the number of squares is even, a tour can only end on the
color opposite from which it started. If the total squares
are odd in number, you must end on the same color you started.
The difference between a possible and impossible configuration
can be a single square.
Try changing some of the boards by
clicking with the mouse on various squares.
To reach or not to reach ? That is the question.