Towers of Hanoi: Difference between revisions
Content added Content deleted
(autoit) |
(→{{header|Ruby}}: ++ sather) |
||
Line 939: | Line 939: | ||
hanoi (n-1), via, to, from |
hanoi (n-1), via, to, from |
||
end</lang> |
end</lang> |
||
=={{header|Sather}}== |
|||
{{trans|Fortran}} |
|||
<lang sather>class MAIN is |
|||
move(ndisks, from, to, via:INT) is |
|||
if ndisks = 1 then |
|||
#OUT + "Move disk from pole " + from + " to pole " + to + "\n"; |
|||
else |
|||
move(ndisks-1, from, via, to); |
|||
move(1, from, to, via); |
|||
move(ndisks-1, via, to, from); |
|||
end; |
|||
end; |
|||
main is |
|||
move(4, 1, 2, 3); |
|||
end; |
|||
end;</lang> |
|||
=={{header|Scala}}== |
=={{header|Scala}}== |