On this page there is a Java Applet which demonstrates the problems
and could be used for investigation of the influence of fixed priority
orders and the amendment.
A general piece of advice might be to also apply backtracking, when
implementing Warnsdorff's rule as an algorithm with fixed priority order.
This page focuses on the problems with Warnsdorff's rule that emerge- at least
when it is to be implemented for the computer.
Arnd Roth in his
"The Problem of the Knight" pointed at the inherent ambiguity in the
rule given by Warnsdorff. It often gives a choice between several equally good
moves.
Kapil Hari Paranjape in his entertaining A Knight's Tour on OCaml (when a Python fails to digest it) observed
the importance of in which order possible "next squares" are tested, and the
influence of which square was used for start.
These issues interact. Computers are not built to handle ambiguity,
so the usual way of dealing with that, is to deny it and pretend it doesn't
exist.Why complicate things, why not just give the computer the next value my
fine algorithm delivers ? (Here, of course, I'm only talking for myself).
But Arnd Roth proposed an amendment to Warnsdorff's rule, to resolve
its ambiguity:
If two or more possible "next squares" are equally good, then choose the one
farthest away from the centre of the board. This way, the tour tends to go
close to the edges of the board, thereby reducing the apparent risk that
the board is split into two or more separate uncovered parts.
The speed of the applet however, could be changed whenever you want.
For 15x15 boards or less there is a "step" facility. If this is chosen, the
number of free exits (red figures) and priority order for the possible next squares are
displayed. Click the button "next" to watch next move.
The first time a tour is completed, and the first time it hits a dead end, the applet is paused and the speed set to "slow". Click "cont." and watch the backtracking. Or change the speed - "fast" is fast enough to find all "Warnsdorff tours" on a 8x8 board within some minute.
The applet has two built in examples.
"ex.1" gives a 50x50 board and a priority order that
will cause the tour to split the board into two separate uncovered parts.
"ex.2" gives a 8x8 board and a priority order that will cause
the tour not to be ended until it has hit dead ends 35 times.
Exercise: On a NxN board where N is odd, you must start at a dark square, or
there will not be any complete tour at all. Explain why !
| © 2005 Gunno Törnberg | Visitors:
|