Towers of Hanoi Example Project


The classic Towers of Hanoi puzzle

Given three pegs with N rings of increasing size on one peg, the program must transfer all the rings to another peg.

The rules are: transfer only one ring at a time and never put a larger ring on top of a smaller one.

The correct strategy will require 2^n - 1 moves to transfer N disks. According to folklore, starting with 52 rings and transferring one ring per second, when the last ring is moved, the world will end.