🗼 Tower of Hanoi
How to play Tower of Hanoi
The Tower of Hanoi is a 140-year-old puzzle about patience and planning. Four disks sit stacked on the left peg, largest at the bottom and smallest on top. Your job is to move the entire stack to the right peg — one disk at a time, never placing a larger disk on top of a smaller one, and never setting a disk anywhere but on a peg. The middle peg is your helper. With four disks, the perfect solution takes exactly 15 moves, and every extra move is a small detour. There is no timer here; the only thing you are racing is the ideal solution.
Controls
- Tap or click a peg to pick up its top disk, then tap or click a destination peg to drop it. Tap the same peg again to put the disk back down.
- Keyboard: press 1, 2, or 3 to pick the pegs directly, or move between pegs with the arrow keys and press Space or Enter to select and place.
- Illegal drops are rejected with a warning — the game never lets you break the one big rule.
- Hit “Restart” for a fresh tower anytime; your best (fewest moves) is saved on your device.
Tips & strategy
- The golden rule: to move N disks, first park N−1 disks out of the way, move the biggest disk, then rebuild on top of it. The middle peg is a parking spot, not a trap.
- The smallest disk moves every other move — keep it circling in a steady pattern and the solution flows naturally.
- Always know where your largest disk needs to go next. It moves the least, but its path decides everything.
- If you get stuck, undo your last two moves and try a different parking order on the middle peg.
- Measure yourself against the magic number: 15. Landing close to it means you are thinking the way the puzzle wants you to.
Scoring
Every move counts as one — fewer is better, with 15 as the perfect score for four disks. Finish in 15 and you have played it perfectly; under 25 is strong play. Your best result is stored in your browser so you can watch your efficiency improve. The real reward is the moment the final disk lands and the whole tower stands on the last peg.