Advertisement
flomath

hanoi

May 1st, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hanoi :: Int -> Position -> Position -> [Move]
  2. {- n Anzahl der Scheiben, i Startposition, j Zielposition -}
  3. hanoi 1 i j = [(i,j)]
  4. hanoi n i j = hanoi n' i otherT ++ [(i,j)] ++ hanoi n' otherT j
  5.     where n' = n-1
  6.          otherT = 1+2+3-i-j -- other tower
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement