Knight's Tour
A chess knight jumps two squares one way and one square to the side. Can it visit every square of the board exactly once? Click a square to start and jump from square to square. The numbers show how many onward moves each square leaves, the clue behind Warnsdorff's rule, and Solve finishes the tour for you. Click a square to place the knight, then click a highlighted square to jump. Visit every square exactly once. The numbers count the onward moves from each square: Warnsdorff's rule takes the smallest. Solve finishes the tour and backs up first if the knight is stuck.
How it works
- Click any square to put the knight there. The squares it can jump to light up.
- Click a highlighted square to jump. A gold number marks Warnsdorff's choice: the square with the fewest onward moves.
- Stuck, or curious? Press Solve and watch the knight finish the tour, then save the numbered path as a PNG.
How a knight moves
A knight moves in an L: two squares in a straight line and then one square to the side, or one and then two. It is the only chess piece that jumps over others. From the middle of the board it has eight moves, from a corner only two.
Warnsdorff's rule
In 1823 H. C. von Warnsdorff suggested a simple rule: always jump to the square from which the knight will have the fewest moves left. Squares near the edge and in the corners are hard to reach, so the knight visits them while it still can. On an ordinary chessboard the rule very often finds a whole tour without any search.
Open and closed tours
An open tour ends anywhere. A closed tour ends a knight's move from where it began, so the knight could jump straight back and go round again. Closed tours exist on every even board from 6×6 up, but never on an odd one: the knight changes color with every jump, and an odd board has one more square of one color than of the other.
Frequently asked questions
Does every board have a knight's tour?
Every square board from 5×5 up has an open tour. On 5×5, 7×7, and 9×9 the tour must start on a square the color of the corners. A closed tour needs an even board of at least 6×6.
How many knight's tours are there on a chessboard?
There are 26,534,728,821,064 closed tours on the 8×8 board if a tour and the same tour run backward count separately. Open tours are far more numerous: about 19.6 quadrillion.
What does Solve do when the knight is stuck?
It backs up a few moves at a time until it finds a position from which the tour can be finished, then jumps to the end. Undo takes every step back again.
Can I make a closed tour?
Yes. Tick Closed tour before you press Solve. On an odd board a closed tour is impossible, and the app says so.
How do you solve the knight's tour by hand?
Use Warnsdorff's rule: always jump to the square from which the knight will have the fewest moves left, so the corners and edges get visited while they can still be reached. With Hints on, every square the knight can reach shows that number, and the gold one is Warnsdorff's choice.
騎士巡遊: how do I record a video?
Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device.Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner.The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF.For the sound, choose the app's own sounds or one of three music tracks: calm, bright or beat.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
前往編輯器