Towers of Hanoi: Difference between revisions

add language: Retro
(Factor)
(add language: Retro)
Line 1,130:
hanoi: func [
{Begin moving the golden disks from one pole to the next.
Note: when last disk movedmoved, the world will end.}
disks [integer!] "Number of discs on starting pole."
/poles "Name poles."
from to via
][
Line 1,162:
left -> middle
right -> middle</pre>
 
=={{header|Retro}}==
<lang Retro>
4 elements a b c n
 
: vars !c !b !a !n ;
: hanoi ( num from to via -- )
vars
@n 0 <>
[
@n @a @b @c
@n 1- @a @c @b hanoi
vars
@b @a "\nMove a ring from %d to %d" puts
@n 1- @c @b @a hanoi
] ifTrue ;
 
4 1 3 2 hanoi
</lang>
 
=={{header|REXX}}==
Anonymous user