## Towers of Hanoi Animation

**This Towers of Hanoi animation uses the <canvas> element and may not run in older versions
of Internet Explorer.**

This is an animation of the well-known Towers of Hanoi problem, generalised to allow multiple pegs and discs. You can select the number of discs and pegs (within limits).

Some Android (eg default) browsers can't render the site properly. We'll let you know if they fix the problem (41312). Or try another browser, eg Firefox.

If your browser supports WebGL, you can choose a 3D animation. If it looks clunky, get a better device! (or stay with 2D)

'Get Solution' button will generate a random solution to the problem from
**all possible optimal** solutions - note that for 3 pegs the solution is unique
(and fairly boring). If the total number of moves is too big (currently limited
to 512) the number of discs will be reduced to meet the limit. This is just to limit
the download size and may be increased later.

Solution shown always moves from peg 1 to peg 2. The total number of moves is displayed, so you can count along if you dont believe it!

Playback speed can be adjusted using the 'Speed Factor' box. 'Show Solution' button will play back the last generated solution, so you can get an action replay by lowering the speed factor and pressing the 'Show Solution' button again,

Enjoy!