Towers of Hanoi: Difference between revisions

no edit summary
(→‎{{header|BASIC}}: fix implementation link)
No edit summary
Line 888:
Using it (5 is the number of disks.)
<lang joy>[source destination temp] 5 hanoi.</lang>
 
=={{header|Liberty BASIC}}==
This looks much better with a GUI interface.
<lang lb>
source$ ="A"
via$ ="B"
target$ ="C"
 
call hanoi 4, source$, target$, via$ ' ie call procedure to move legally 4 disks from peg A to peg C via peg B
 
wait
 
sub hanoi numDisks, source$, target$, via$
if numDisks =0 then
exit sub
else
call hanoi numDisks -1, source$, via$, target$
print " Move disk "; numDisks; " from peg "; source$; " to peg "; target$
call hanoi numDisks -1, via$, target$, source$
end if
end sub
 
end
</lang>
 
 
=={{header|Logo}}==
Anonymous user