[Haskell-beginners] tower hanoi problem

YCH dontdieych at gmail.com
Sun Feb 15 08:45:24 UTC 2015


How about if I say "Actually target was c not b and here is one more
disc. I put it on a. Now you should move all to c"

On Sun, Feb 15, 2015 at 5:29 PM, Roelof Wobben <r.wobben at home.nl> wrote:
> 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 at 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
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>


More information about the Beginners mailing list