The Knight's Tour
is a mathematical problem involving a knight
on a chessboard
. The knight is placed on the empty board and, moving according to the rules of chess
, must visit each square once.
There are several billion solutions to the problem, of which about 122,000,000 have the knight finishing on the same square on which it begins.
Many variations on this topic have been studied during the centuries:
- differently sized boards
- two-player games based on this idea
- problems using slight variations on the way the knight moves.
The knight's tour problem is an instance of the more general hamiltonian path problem
in graph theory
, which is NP-complete
. The problem of getting a closed knight's tour is similarly an instance of the hamiltonian cycle problem
. See How to solve the knight's tour
for instructions on solving the knight's tour problem. Note however that, unlike the general hamiltonian path problem
, the knight's tour problem can be solved in linear time (Conrad et al 1994).
The pattern made by a Knight's Tour has often been used as a literary constraint. The earliest instance of this is found in Rudrata's Kavyalankara written during the 9th century.
In the 20th century the Oulipo group of writers used it among many others. The most notable example is the 10x10 Knight Tour which sets the order of the chapters in Georges Perec's novel La Vie mode d'emploi.