Skip to content

Finds knight's tours on square boards of arbitrary size that follow Warnsdorff's rule

Notifications You must be signed in to change notification settings

douglassquirrel/warnsdorff

Repository files navigation

Warnsdorff's Rule is a heuristic for finding knight's tours on chessboards. A conjecture by the original contributor of this code and Paul Cull is that Warnsdorff's rule, with suitable modifications, can give a knight's tour on any square board. You can use this program to generate tours according to this method on a square board of any size:

  1. Download this project.
  2. Follow the instructions in the INSTALL file (installing Python and required libraries).
  3. Type python tour.py 100 to produce instructions for a tour on a board of size 100.
  4. Type python tour.py 100 | python tour_to_tk.py to see the tour drawn for you in a TkInter window.
  5. Type python tour.py 100 | python tour_to_swf.py to get an swf (Flash) movie of the tour being drawn.

When the tour is "drawn" you see a square coloured blue or red when the knight reaches that square - blue indicates that no tiebreak was necessary, red that a tiebreak was needed (see the research paper cited above for more details).

I hope that users of this code are inspired to learn more about Warnsdorff's Rule, and perhaps to prove that the modified rule will actually produce tours on all square boards - this is known for boards whose size is equivalent to 7 mod 8, thanks to Sam Ganzfried's REU paper on the subject.

About

Finds knight's tours on square boards of arbitrary size that follow Warnsdorff's rule

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published