Knight's tour (chess puzzle and Hamiltonian path)
A sequence of knight moves that visits every square of a chessboard exactly once. Studied as a puzzle, a graph-theory problem, and an algorithmic exercise with open and closed variants.
Overview
A knight's tour is a sequence of legal moves by a chess knight that visits every square of a board exactly once. If the final square is a single knight's move away from the starting square so that the tour could continue in a closed loop, the tour is called closed or re-entrant; otherwise it is called open. The classical instance is the 8×8 chessboard, but the concept applies to boards of other sizes and to irregular or wrapped (cylindrical or toroidal) boards.
Image gallery
3 ImagesDefinitions and properties
Viewed abstractly, the knight's tour is a Hamiltonian path problem in the "knight's graph," whose vertices are squares and whose edges connect pairs of squares a knight can reach in one move. A closed tour corresponds to a Hamiltonian cycle. Consequences of this viewpoint include that standard tools from graph theory—connectivity, parity arguments, and constructive decompositions—can be used to analyze whether tours exist on a given board.
History and development
The knight's tour has been a subject of recreation and study for centuries. Mathematicians and puzzle authors explored constructions, counts of distinct tours, and criteria for existence on rectangular boards. Heuristics and simple rules of thumb were proposed in the 19th century to guide manual construction of tours, and interest has continued into modern times because the problem combines combinatorics, geometry and elegant visual solutions.
Algorithms and examples
Constructing a tour can be done by hand using heuristics or by computation. A well-known practical heuristic is Warnsdorff's rule, which chooses each next move to minimize the number of onward moves from the destination square. More robust algorithms use backtracking or depth-first search with pruning; these are typical exercises in programming and algorithm design for students of computer science. For many board sizes the search space is large, so hybrid approaches combine heuristics with systematic search to find tours efficiently.
Variations, board sizes and applications
Variations include tours on nonstandard boards, boards with forbidden squares, multiple knights visiting every square, and tours that optimize additional criteria. Some variations treat the board as wrapped (edges joined) to change adjacency, or consider rectangular boards with different dimensions. Beyond recreational puzzles, studying knight's tours helps illustrate principles of Hamiltonian paths, backtracking, heuristics, and computational enumeration in discrete mathematics.
Notable facts and distinctions
- Open versus closed: closed (reentrant) tours form a cycle, open tours do not.
- Graph-theoretic framing: the problem is equivalent to finding Hamiltonian paths or cycles in the knight's graph for the chosen board.
- Existence depends on board shape and size; very small boards or certain narrow dimensions do not admit full tours.
- Constructive rules like Warnsdorff's are effective but not guaranteed; exhaustive search can verify existence and enumerate solutions.
The knight's tour remains a popular and visually appealing topic, often used to introduce ideas in combinatorics and algorithmics while providing striking patterns and puzzles that are accessible to enthusiasts and researchers alike.
Related articles
Author
AlegsaOnline.com Knight's tour (chess puzzle and Hamiltonian path) Leandro Alegsa
URL: https://en.alegsaonline.com/art/53988