Skip to content
Puzzles

Tower of Hanoi

Move the tower disk by disk, never placing a disk on a smaller one.

The legendary puzzle, from 3 to 10 lacquered wooden disks, on 3 or 4 rods. The minimum number of moves is displayed and the AI can solve the tower before your eyes.

Players
1 player
Length
1 to 30 min
  • Solo
Play Tower of Hanoi

15 days of full access, no account · No download

Tower of Hanoi preview

How to play

Goal of the game

Carry the whole tower of disks over to the goal rod (on the right), following two rules.

Rules

  • Only one disk may be moved at a time: the one on top of a rod.
  • A disk can never rest on a smaller disk.

Controls

  • Tap a rod to lift its top disk, then tap the destination rod.
  • You can also drag a disk from one rod to another.
  • With the keyboard: keys 1 to 4 (source then destination), or the left and right arrows then Space.

Minimum moves

With 3 rods, you need at least 2n − 1 moves for n disks (7 for 3 disks, 1,023 for 10). With 4 rods, the Frame-Stewart algorithm cuts this number dramatically: 49 moves are enough for 10 disks.

The “Scattered disks” option starts from a random position where the disks are spread across the rods: the minimum specific to that position is computed and displayed.

Tip (3 rods): the smallest disk moves every other move, always in the same direction of rotation; in between, there is only one other legal move.

About the AI

The AI explores every possible position with a breadth-first search (up to 410, which is over a million for 10 disks and 4 rods): from any position, it therefore knows the exact number of moves left and the best move. From the classic tower, it applies the recursive Frame-Stewart algorithm, whose optimality it checks with that same search.

Records are only registered in a classic game, with no hints and no help from the AI.

Difficulty levels

  1. Easy3 disks: 7 moves with 3 rods.
  2. Medium5 disks: 31 moves with 3 rods.
  3. Hard7 disks: 127 moves with 3 rods.
  4. Expert8 disks: 255 moves with 3 rods.
  5. Diabolical10 disks: 1,023 moves with 3 rods, for the most patient.

More puzzles games

Lire cette page en français