Application Center - Maplesoft

App Preview:

Knight's Tour

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application

Knight's Tour

Dr. Yury Zavarovsky

All-Russian Distance Institute of Finance & Economics


A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once.


This application presents the implementation of this task in Maple. Required parameters of the procedure (named  KnightTour)  are:

  address  - the address of the initial square,  in the algebraic notation (for example, f3 or g6)

  opt  - an optional parameter that can be one of the following:


1) if  opt is sequence  (by default) then  the procedure returns the sequence of moves of the knight in the usual algebraic notation,


2)  if  opt is diagram   then  the procedure returns the plot of moves of the knight and  sequentially numbers all the visited squares,


3) if  opt is animation  then  the procedure returns an animation of moves of the knight.


In the procedure is used a solution with maximum symmetry by George Jelliss,



KnightTour := proc(address::symbol, opt::symbol := sequence)



f3, g1, h3, g5, e4, d6, e8, g7, h5, f4, e2, c1, a2, c3, b1, a3, c2, a1, b3, d2, c4, a5, b7, d8, e6, d4, b5, c7, a8, b6, c8, a7, c6, b8, a6, b4, d5, e3, d1, b2, a4, c5, d7, f8, h7, f6, g8, h6, f7, h8, g6, e7, f5, h4, g2, e1, d3, e5, g4, f2, h1, g3, f1, h2



KnightTour(f3, diagram)

KnightTour(f3, animation)