aigcgame

Puzzles & Logic

Tower of Hanoi

Three pegs and a stack that starts on the first peg, in 3, 4 or 5 disks. The goal is to move the whole stack to the third peg, never placing a larger disk on a smaller one. The page shows the minimum number of moves, 2ⁿ − 1, next to your own count.

Play Tower of Hanoi

Who it is for. Anyone who wants the classic disk puzzle at a small, human size. It is click-only. Five disks is already 31 moves if you play perfectly; this page does not offer more than five.

How it actually plays

Click a peg to pick up its top disk, then click a destination. Clicking the same peg again puts the disk back without counting a move. An illegal drop — a larger disk onto a smaller one — is refused, the disk is deselected, and the move is not counted. A legal drop increments the counter.

The puzzle is solved when all disks are on the third peg, and the message reports both your count and the minimum. The 3, 4 and 5 buttons start a fresh stack of that size; Reset starts the current size again.

Disks are numbered, with 1 the smallest.

Controls

Click a tower to pick up or to place. Use the 3, 4 and 5 buttons to change the stack size, and Reset to start the current size over.

Strategy and common mistakes

The standard recursion is still the whole idea: move n − 1 to the middle peg, move the largest, move n − 1 on top. If you are above the printed minimum, you have looped or undone work. Because an illegal drop deselects the disk, a sloppy second click can feel like the disk 'vanished' back to its peg — it did.

More in Puzzles & Logic

See all Puzzles & Logic games →

Back to the library