Towers of Hanoi: Difference between revisions

Content added Content deleted
Line 3,355: Line 3,355:
Where n is the number of disks to move and from, to, and via are the poles.
Where n is the number of disks to move and from, to, and via are the poles.


Example:
{{out|Example use}}
<syntaxhighlight lang="java">move(3, 1, 2, 3);</syntaxhighlight>
<syntaxhighlight lang="java">move(3, 1, 2, 3);</syntaxhighlight>


{{out|Demonstration}}
Output:
<syntaxhighlight lang="java">Move disk from pole 1 to pole 2
<syntaxhighlight lang="java">Move disk from pole 1 to pole 2
Move disk from pole 1 to pole 3
Move disk from pole 1 to pole 3