Skip to main content
This page was machine-translated and may contain errors or omissions.

Tower of Hanoi

How to play

Gameplay

The Tower of Hanoi, the classic recursion problem. Three pegs hold a stack of discs in decreasing size, and the task is to move the whole stack to a different peg. Only one disc may move at a time and a larger disc may never rest on a smaller one. The minimum number of moves is two to the power of n minus one, so every extra disc doubles the difficulty.

Controls

Click a peg to lift its top disc, then click a destination peg to place it; illegal moves are refused with an explanation. The header shows your move count against the theoretical minimum, the disc count can be changed to alter the difficulty, and reset returns to the starting position.

FAQ

What is the fewest moves possible?

For n discs it is 2^n - 1. The header shows your move count against that theoretical minimum, so you always know how close you were to perfect.

What happens on an illegal move?

It is refused with an explanation - a larger disc may never rest on a smaller one.