A knight in chess jumps two squares in one direction and one more at right angles — a small L written in movement. Now the demand: starting somewhere on the board, land on every single square exactly once. No repeats, no misses, and the tour may end anywhere. One piece, one move, one deceptively simple goal. This is the knight's tour, and it has been traveling between poem, academy and machine for more than a thousand years.

The tour as a poem

The earliest known reference to the problem is not a math textbook. It is a ninth-century Sanskrit work on poetics, the Kavyalankara of the Kashmiri poet Rudrata, which presents the pattern of a knight's tour over half a chessboard as an elaborate poetic figure — a citra-alaṅkāra, ornament of imagery — called turagapadabandha, "arrangement in the steps of a horse". Because Sanskrit syllabaries write a syllable like a tile, the verse's syllables can stand in for squares: the same four lines read left to right or as a knight's route. The encyclopedia entry behind this paragraph quotes one of Rudrata's examples. Poetry that doubles as a graph problem, twelve centuries early.

A second, parallel tradition — and the cautious word is doing honest work here — places an early tour diagram in the ninth-century Arabic chess prose Rūḍat al-ʿāqil. By tradition, then; I could not trace that claim to a source good enough to link, so it sits apart from the Sanskrit layer, and the two are not the same story welded into one "origin".

The tour as mathematics

After the poets came the mathematicians. One of the first to investigate the tour as mathematics rather than as verse or parlor puzzle was Leonhard Euler, whose work on it dates to 1759. The tour also kept a literary afterlife: in the twentieth century the Oulipo group of experimental writers used it, most famously to set the chapter order of Georges Perec's novel Life: A User's Manual, following a tour of a 10×10 board.

And the combinatorics turned out to be enormous. On the standard 8×8 board there are exactly 26,534,728,821,064 directed closed tours — routes that end a knight's jump from where they began, counted apart when reversed, rotated or reflected. Twenty-six trillion ways to do the thing you were just asked to do on a 6×6 grid.

The rule of 1823

The first procedure — not a construction trick but a rule you can follow square by square — appeared in 1823, attributed to Warnsdorff, and it is gloriously simple: at every step, jump to the square that has the fewest onward moves of its own. The fewest exits first. A greedy heuristic that walks into cramped corners while the open center waits, and thereby keeps the board's pockets reachable until the end. It is far from a proof — a tour built this way can still dead-end, and then you backtrack — but the arithmetic it asks of you is tiny: at each step, just count the exits of each landing square.

The rule runs our camera, not our game

Here is where the thousand years land in our workshop — with a distinction the workshop insists on. Our Knight's Tour does not solve anything: the game asks you for the tour. The 1823 rule runs in the tool that photographs the game for this blog. To take screenshots honestly, the capture rig plays real boards like a player does — every jump entered through the very squares a finger taps, all the way to a genuine "You win!" — and to photograph a tour it first has to find one. That finder is Warnsdorff's rule turned into a procedure: try the landing with the fewest onward exits, follow a route as deep as it goes, and step back only when it walls off — under a safety cap of two million moves explored, kept purely as insurance "in case we photograph another size someday," as a note beside it admits. The same note adds that, on the 6×6 Medium board, the tour usually closes without a single step back.

Mid-game 6×6 Knight's Tour: squares 1 to 18 numbered by visiting order, the knight on 18 and rings on free destinations.

Which means the two pictures in this section — eighteen numbered squares mid-route, and the thirty-sixth behind a shower of confetti — were taken of a tour computed by a heuristic that predates the photograph, the electric bulb and the computer. The knight you see was even drawn in-house: our board's horse is a pair of SVG figures, one per color, made for this game alone. A poem in Sanskrit, a rule from 1823, a camera script inside the game's own engine, taking its pictures.

Completed 6×6 Knight's Tour: all 36 squares numbered along the route, the knight on the last one, behind the "You win!" panel with confetti.

Your turn, on foot

The tour has been a verse figure, a mathematician's problem, a novelist's table of contents and now, occasionally, our photographer. It has never stopped being playable. Knight's Tour is in the catalog, free in the browser — go visit all thirty-six squares yourself, two in one direction and one at right angles, and if you find yourself eyeing the corner with only two exits left, you are thinking the way the rule of 1823 does.