Hanoi Tower programming challenge...
Colin Holgate
coiin at verizon.net
Thu Jul 19 08:40:48 EDT 2012
>
> >How about this? I think this is the classic recursive solution.
>
That looked good, and works in Director too. Given that you can call it from the message box (or message window in the case of Director), and Director doesn't need the 'end' part for handlers, it can be as short as this:
on tower N, start, destination, spare
if N = 0 then return
tower N - 1, start, spare, destination
put "Move " & N & " from "& start & " to "& destination
tower N - 1, spare, destination, start
More information about the use-livecode
mailing list