Game rules

Tower of Hanoi Rules

The Tower of Hanoi is a one-player puzzle: a tower of disks has to move to another peg, one disk at a time, without ever putting a bigger disk on a smaller one. It was invented in 1883 and is still used to teach planning and breaking a big problem into smaller ones. Below are the complete rules, exactly as they work on Selminha.com.

The goal

Move the whole tower from the first peg to the last, in the same order it started: the biggest disk at the bottom and the smallest on top. The level only ends when the tower is complete on the last peg; building it on the middle peg doesn't count.

The pieces

A base with three pegs and disks of different sizes. At the start, every disk is stacked on the first peg, from the biggest at the bottom to the smallest on top. The other two pegs start empty.

How to play

  • Each move takes one disk from one peg to another.
  • Only the top disk on a peg can move.
  • A disk can go onto an empty peg or onto a bigger disk. Never onto a smaller one.
  • Picking up a disk and putting it back on the same peg doesn't count as a move.
  • An illegal move simply doesn't happen: the game tells you why, and the disk stays in your hand so you can pick another peg.

Green rings at the base of the pegs show where the disk in your hand can go.

The 6 levels

Each level has one more disk than the one before:

Level 1: 3 disks
7 moves minimum
Level 2: 4 disks
15 moves minimum
Level 3: 5 disks
31 moves minimum
Level 4: 6 disks
63 moves minimum
Level 5: 7 disks
127 moves minimum
Level 6: 8 disks
255 moves minimum

The 8-disk tower is the one from the original 1883 toy.

The minimum number of moves

The minimum number of moves is 2 to the power of the number of disks, minus 1. Here's why: for the biggest disk to reach the last peg, all the others have to be stacked on the middle peg; once it has moved, they have to travel from the middle peg onto it. So every extra disk doubles the path and adds one more move.

Stars and points

3 stars
Tower finished in the minimum number of moves.
2 stars
Tower finished within one and a half times the minimum, rounded up: 11 moves for the 3-disk tower, for example. This is also the most you can get on a level where you used a HINT.
1 star
Tower finished in more moves than that.
Star points
Each star is worth 100 points on the 3-disk tower, 200 on the 4-disk tower, and so on up to 600 on the 8-disk tower.
Speed
Up to 100 points per level. The bonus starts full and drains over time, hitting zero at 2.5 seconds per move of the minimum: on the 3-disk tower, it runs out at 17.5 seconds. Time spent paused doesn't count.

Moves you undo come off the count. A whole game is worth at most 6,900 points.

Undo and hint

UNDO
Takes back your last move, and the move count goes back with it. You can undo all the way to the start of the level. If you're holding a disk, it goes back to the peg it came from.
HINT
Lights up the right disk and the peg it should go to: the next move on the shortest path from wherever the tower is now, even after some wrong turns.
The cost of a hint
Ask for a hint on a level and that level is worth 2 stars at most.

Saved game, leaderboard and controls

Saved game
The game saves your current level and score on your device. When you come back, from level 2 on, you can choose RESUME or START OVER.
Restart level
From the pause screen, RESTART LEVEL stacks the tower back on the first peg, with the score you had before the level.
No lives
There are no lives: you can't lose a tower.
Leaderboard
After the sixth tower, the score for the whole game goes to the site's TOP 5.
On a computer
The ← → keys or A and D pick a peg, Enter or Space picks up and drops the disk, Z undoes and H shows a hint.

Tips for beginners

  • With an odd number of disks, the smallest one goes straight to the last peg on the first move; with an even number, to the middle peg.
  • After that, the smallest disk always travels in the same direction, every other move.
  • On the moves where the smallest disk stays put, there is only one legal move with the other disks: make it.
  • Think in pieces: to move a 4-disk tower, first move the 3-disk tower sitting on top of it.
  • Took a wrong turn? UNDO takes the move off the count, so 3 stars are still within reach.

The legend and variations

The puzzle came with a legend: in a faraway temple, monks are moving a tower of 64 golden disks from one peg to another, and the world will end when they finish. With 64 disks, that would take more than 18 quintillion moves: at one per second, about 585 billion years.

Some versions use four or more pegs, and some let the tower finish on any peg other than the one it started on. On Selminha.com there are always three pegs, and the tower has to finish on the last one.