Comment on It’s a game for kids!

<- View Parent
Knusper@feddit.de ⁨1⁩ ⁨year⁩ ago
hanoi :: Integer -> a -> a -> a -> [(a, a)]
hanoi 0 _ _ _ = []
hanoi n a b c = hanoi (n-1) a c b ++ [(a, b)] ++ hanoi (n-1) c b a

From here: www.rosettacode.org/wiki/Towers_of_Hanoi#Haskell

source
Sort:hotnewtop