GN Math

Tower of Hanoi Unblocked

Shift a ring stack peg to peg in as few moves as possible, then add rings to make it harder.

now playing: Tower of Hanoi

Three pegs, a pile of rings and one rule that never bends: a bigger ring can never rest on a smaller one. Tower of Hanoi unblocked asks you to carry the whole stack from the left peg to the right, one ring at a time.

It is also a neat bit of math in disguise. The fewest moves for any stack is two to the power of the ring count, minus one, so every extra ring roughly doubles the work. This version by Douile shows that target right next to your own count.

How to play Tower of Hanoi

Pick up the top ring from a peg, move over another peg and drop it. A ring can go onto an empty peg or onto any ring wider than itself. While you hold a ring, it hovers above the peg currently selected, so you can see where it would land.

You begin with three rings, which takes seven moves at best. Use the plus and minus icons to change the size, with three as the smallest stack. Changing the count starts a new puzzle.

The counter in the top right corner reads your moves against the minimum, such as 12/7. Every drop counts, even if you set a ring back where it started. When the full stack reaches the right peg, the view gives a quick zoom to mark the win.

Controls

To…KeyboardMouseTouch
Pick up or drop a ringSpace, Enter, Up/Down arrows, or W/SClick a pegTap a peg
Move the selection between pegsLeft/Right arrows or A/D——
Restart the puzzleRClick the circular arrows iconTap the circular arrows icon
Add or remove a ring—Click the plus or minus iconTap the plus or minus icon
Watch the puzzle solve itself—Click the play icon (click again to stop)Tap the play icon (tap again to stop)

Tips

  • Check odd or even first. When the ring count is odd, move the smallest ring to the right peg first. With an even number, start it on the middle peg.
  • Alternate with the small ring. In a perfect solve, the smallest ring moves on every other turn and always circles the pegs in the same direction.
  • Take the only other move. On the turns between, exactly one legal move does not involve the smallest ring, so make that one.
  • Break it into smaller towers. Moving five rings means moving four out of the way, shifting the biggest ring, then moving the four back on top.
  • Watch the auto-solver once. Let it run on a bigger stack to see the rhythm, then reset and try to copy it.

Tower of Hanoi questions

What is the smallest number of moves?

Take two to the power of the ring count and subtract one. That means 3 rings take 7 moves, 4 take 15 and 5 take 31. The counter shows this target after the slash.

Can I stop the solver halfway and take over?

Not really. A second press halts the demo, yet starting it again replays the whole solution from move one. Treat it as a lesson, then reset and do it by hand.

Does it work on a phone?

Yes. Tap the peg holding the ring you want, then tap where it should go. Small icons in the corner handle restart, the solver and the ring count.

Homework: games like Tower of Hanoi

all puzzle games