Animated walkthrough
Learn to play Tower of Hanoi in 8 steps
An animated scene for each rule. It's the same walkthrough that opens from the “?” button in the game.
Where the rules come from
The puzzle appeared in France in 1883, sold in a box that claimed it came from the Far East. The original tower had 8 wooden disks. The rules from that box are still the rules today, and the puzzle is also known as the Tower of Brahma.
The pieces
A base with three pegs and several disks of different sizes, each with a hole in the middle. At the start, all the disks are stacked on one peg, from the largest at the bottom to the smallest at the top. The other two pegs start empty.
The goal
Move the whole tower to another peg, in the same order: largest at the bottom, smallest on top. In the most common version, the tower starts on the first peg and has to end up on the third.
The three rules
- Each move takes just one disk from one peg to another.
- You can only take the top disk of a stack.
- You can never put a disk on top of a smaller one. An empty peg takes any disk.
The minimum number of moves
With n disks, the minimum number of moves is 2 to the power of n, minus 1 (2^n - 1). Here's why: for the largest disk to reach the final peg, all the others have to be stacked on the middle peg. Once it's there, the others have to move on top of it. Each extra disk doubles the path and adds one move.
- 3 disks
- 7 moves
- 4 disks
- 15 moves
- 5 disks
- 31 moves
- 6 disks
- 63 moves
- 7 disks
- 127 moves
- 8 disks
- 255 moves
How to solve it
- Think in parts: to move a 4-disk tower, first move the 3-disk tower off the top, move the largest disk, then put the 3-disk tower back on top of it.
- With an odd number of disks, the smallest disk's first move is straight to the final peg; with an even number, it goes to the middle peg.
- After that, the smallest disk always moves in the same direction, every other move.
- On the moves when the smallest disk doesn't move, there's only one legal move for the other disks: make that one.
The legend
The toy came with a legend: in a temple, priests would move a tower of 64 golden disks, and the world would end when they finished. With 64 disks, the minimum is more than 18 quintillion moves. At one move per second, that would take about 585 billion years.
Variations
Some versions have four or more pegs, which can be solved in fewer moves; for those, there's no simple formula for the minimum. There are also versions with two-colored disks, where the size rule changes, and versions where disks can only move around in a circle, from one peg to the next.
On Selminha.com
The rules in Tower of Hanoi on Selminha.com
Tower of Hanoi on Selminha.com follows the three rules of the original puzzle, with three pegs. Here's how the game is set up and what it adds.
- Six levels
- A 3-disk tower on the first level and one more disk each level, up to 8 disks, the size of the original toy.
- Where it goes
- The tower always starts on the first peg and only counts as finished on the last one. Building it on the middle peg doesn't count.
- Illegal moves
- They don't happen: the game lets you know, and you're still holding the disk. Picking up a disk and putting it back on the same peg doesn't count as a move.
- Stars
- Three stars for the minimum number of moves; two for up to one and a half times the minimum, rounded up; one for anything more.
- 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. You can also earn up to 100 speed points, which drain to zero after 2.5 seconds for each move in the minimum. The whole game is worth at most 6,900 points.
- Undo
- Takes back the last move, and it comes off your count. You can undo all the way to the start of the level and still go for three stars.
- Hint
- Shows the next move on the shortest path from wherever the tower is. If you use a hint, the most you can get on that level is two stars.
- Saved game and leaderboard
- There are no lives. The game saves your level and score on your device, and after the sixth tower your score goes to the site's TOP 5.
- One player
- It's a solo puzzle: there's no game against the computer or with friends.
