/ Published in: Haskell

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
--Haskell Towers of Hanoi -- ... because you know you want to... import System.Environment -- you are moving from a to b using c as an intermediate hanoi 0 _ _ _ = [] hanoi n a b c = hanoi (n - 1) a c b ++ [(a,b)] ++ hanoi (n - 1) c b a -- for some reason this doesn't work in GHCi. Use main' in GHCi main = do args <- getArgs main' = hanoiIO 3
Comments
