Towers of Hanoi: Difference between revisions
Content added Content deleted
(Frink) |
|||
Line 1,660: | Line 1,660: | ||
Move disk 1 from pole 3 to pole 2 |
Move disk 1 from pole 3 to pole 2 |
||
</pre> |
</pre> |
||
=={{header|Frink}}== |
|||
<lang frink> |
|||
/** Set up the recursive call for n disks */ |
|||
hanoi[n] := hanoi[n, 1, 3, 2] |
|||
/** The recursive call. */ |
|||
hanoi[n, source, target, aux] := |
|||
{ |
|||
if n > 0 |
|||
{ |
|||
hanoi[n-1, source, aux, target] |
|||
println["Move from $source to $target"] |
|||
hanoi[n-1, aux, target, source] |
|||
} |
|||
} |
|||
hanoi[7] |
|||
</lang> |
|||
=={{header|FutureBasic}}== |
=={{header|FutureBasic}}== |