
Towers of Hanoi
The Towers of Hanoi is a wellknown game whose purpose is to move n rings of descending diameters, from post S (source) to post D (destination) using an intermediate post I, while obeying the following rules:
1. Move only one ring at a time from one post to another.
2. Never put a ring on top of a smaller one.
Starting Position   End Position 

=> 

S I D   S I D 
It is quite amazing that a very simple recursive algorithm solves this problem, for any number of rings. The solution is very elegant and looks like magic. The recursive mechanism takes care of everything: you just tell it to move the top n1 rings from S to I using D as the intermediate post, then move the last (and largest) ring from S to D, and than move the n1 rings from I to D using S as the intermediate post. And that's all!
Run the program and watch the solution (note that in order to decrease page transfer time we show here a simpler animation than the one obtained in the real program's document).

