\ Towers of Hanoi, Raul Deluth Miller's version \ Provided by Marcel Hendrix : MOVERING ( depth dir -- depth dir ) ." Moving disk '" DUP 0 .R ." '" cr ; create TO! ( direction -- otherdirection ) 0 , 2 , 1 , 5 , 0 , 3 , 7 , 6 , \ use alternate dest create FRO! ( direction -- otherdirection ) 0 , 7 , 5 , 6 , 0 , 2 , 3 , 1 , \ use alternate source :this to! does> + @c ; :this fro! does> + @c ; : SMALLER ( depth direction -- depth-1 direction ) SWAP 1- SWAP ; : BIGGER ( depth direction -- depth+1 direction ) SWAP 1+ SWAP ; : HANOI ( depth direction -- depth direction ) smaller OVER IF to! RECURSE to! movering fro! RECURSE fro! ELSE movering THEN bigger ; .( Using a table: ) cr 10 1 hanoi 2DROP