Towers of Hanoi: Difference between revisions
Content added Content deleted
(→{{header|Imp77}}: added tested output) |
(PascalABC.NET) |
||
Line 4,946: | Line 4,946: | ||
MoveStack(4,tpLeft,tpCenter,tpRight); |
MoveStack(4,tpLeft,tpCenter,tpRight); |
||
end.</syntaxhighlight> |
end.</syntaxhighlight> |
||
=={{header|PascalABC.NET}}== |
|||
<syntaxhighlight lang="delphi"> |
|||
## procedure Hanoi(n,rfrom,rto,rwork: integer); |
|||
begin |
|||
if n = 0 then |
|||
exit; |
|||
Hanoi(n-1,rfrom,rwork,rto); |
|||
Print($'{rfrom}→{rto} '); |
|||
Hanoi(n-1,rwork,rto,rfrom); |
|||
end; |
|||
Hanoi(5,1,3,2); |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
1→3 1→2 3→2 1→3 2→1 2→3 1→3 1→2 3→2 3→1 2→1 3→2 1→3 1→2 3→2 1→3 2→1 2→3 1→3 2→1 3→2 3→1 2→1 2→3 1→3 1→2 3→2 1→3 2→1 2→3 1→3 </pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |