Towers of Hanoi: Difference between revisions
Content added Content deleted
(Modula-3) |
No edit summary |
||
Line 1: | Line 1: | ||
{{puzzle}}[[Category:Recursion]][[Category:Games]]In this task, the goal is to solve the [http://en.wikipedia.org/wiki/Towers_of_Hanoi Towers of Hanoi] problem with recursion. |
{{puzzle}}[[Category:Recursion]][[Category:Games]]In this task, the goal is to solve the [http://en.wikipedia.org/wiki/Towers_of_Hanoi Towers of Hanoi] problem with recursion. |
||
=={{header|ActionScript}}== |
|||
<actionscript> |
|||
public function move(n:int, from:int, to:int, via:int):void |
|||
{ |
|||
if (n > 0) |
|||
{ |
|||
move(n - 1, from, via, to); |
|||
trace("Move disk from pole " + from + " to pole " + to); |
|||
move(n - 1, via, to, from); |
|||
} |
|||
} |
|||
</actionscript> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |