Roelof Wobben schreef op 15-2-2015 om 9:23:
YCH schreef op 14-2-2015 om 22:53:

> You can put the first disk on the second or the thirth peg.

Think a, b, c as 'src, target, temp'

So if you have only one disk on src peg, it has to go target peg. But if you have two or more discs, you cannot put first peg on target peg.

hanoi 1 1 2 3 = [ (1, 2) ]
hanoi 2 1 2 3 = [ ?



_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners

Hanoi 1 a b c  - [ (a,b)]

Hanoi 2 123 = [ ( a,b)]
                       = [ (a,c) ]
                       =[ (b,c) ]


solved.

Roelof
 

Sorry, that one is wrong. Everything is on the 3th now.

Another attempt.

Hanoi 2 a b c = [ (a, c)]
                        = [ (a, b)]
                       = [ (c, b) ]

Roelof