knight tour Algorithm

If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed; otherwise, it is open. A knight's tour is a sequence of movements of a knight on a chessboard A tour reported in the fifth book of Bhagavantabaskaraby by Bhat Nilakantha, a cyclopedic work in Sanskrit on ritual, law and politics, write either about 1600 or about 1700 describes three knight's tours. 

The Sri Vaishnava poet and philosopher Vedanta Desika during 14th century in his 1,008-verse magnum opus praising lord Ranganatha's divine sandals of Srirangam, i.e. Paduka Sahasram (in chapter 30: Chitra Paddhati) has composed two consecutive Sanskrit verses containing 32 letters each (in Anushtubh meter) where the second verse can be derived from the first verse by performing Knight's tour on a 4 × 8 board, beginning from the top-leave corner. It is believed that Desika composed all 1008 verses (including the special Chaturanga Turanga Padabandham noted above) in a individual night as a challenge.

knight tour source code, pseudocode and analysis