Created
February 24, 2015 21:01
-
-
Save lykkin/a9a05c30bdb8c9d7b608 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Peg = String | |
type Move = (Peg, Peg) | |
hanoi :: Integer -> Peg -> Peg -> Peg -> [Move] | |
hanoi disks from to storage | disks > 1 = (hanoi (disks - 1) from storage to) ++ [(from, to)] ++ (hanoi (disks - 1) storage to from) | |
| otherwise = [(from, to)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment