[Haskell-beginners] tower hanoi problem

Roelof Wobben r.wobben at home.nl
Fri Feb 13 21:25:55 UTC 2015


Thanks,

Is it the second time a c b because the next step will be a disk from 
the a to the c disk ?

Roelof



Steven Williams schreef op 13-2-2015 om 22:16:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I am really horrible at helping people which is why I delayed replying
> to this. Your email got through to the list twice, you don't need to
> send it again.
>
> The steps you need to take are in the homework assignment. The items
> 1-3 are literally the algorithm you need to use. Something to keep in
> mind is that the pegs can change per function call. For example
> initially you call it with "hanoi 2 a b c", then hanoi calls itself
> again with "hanoi 1 a c b" to achieve one of the steps that you need
> to take.
>
> Steven Williams
> My PGP Key: http://pgp.mit.edu/pks/lookup?op=get&search=0xCACA6C74669A54FA
>
> On 02/13/2015 03:09 PM, Roelof Wobben wrote:
>> Hello,
>>
>> After a short break I try to make the next assignment of the CIS
>> 194 course. I do self-study.
>>
>> Lets say we have 1 disk with 2 pegs then we have this :
>>
>>
>> type Peg = String. type Move = (Peg, Peg) Hanoi :: Integer -> Peg
>> -> Peg -> [Move]
>>
>> So I can do this Hanoi 2 a b
>>
>> How can I proceed further.
>>
>> I do not see how I can tell that the disk can move from a to b And
>> I do not see what the base case will be . I think when a is empty
>> and b has a value.
>>
>> Can anyone shine a light on this matter without telling me the
>> answer ?
>>
>> Roelof
>>
>> typ
>>
>>
>>
>> _______________________________________________ Beginners mailing
>> list Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iQIcBAEBAgAGBQJU3mmnAAoJEMrKbHRmmlT6zHMP/iOKoYXJejbt7CbEGsVhCvEl
> HXm1qPDNY+1wRAVVVmyCPSY3xXieE8Q+yPagfS4DhzUhsJjCnXZ1ZUBvm+Bx0tww
> 427ofFTuMYlrQ2gFlT2feHTm2l3NfSeeOQ8KiWS1XT6/UxQddarF8GIyO2tp29b8
> 51NxiOLJJpfGmGK0u2i0moDqMavHLeKWERToUrfkhTHcSVzyC7Aw4zAiG2ScaRzD
> CrYjIRq8SLB38svs8X31jx4vGVsVvwvCnoxReNjCNfYULgOHjfXE4kRz+pb0fScc
> A46uIkNxZ34sQdIWbuGbVe4sGDQl+BUh0HzdRDtviMbj38attE8WAjd8r+3SRpr9
> ZgFoXGbj1Z0l9Pm82auvrKRX5aP2OmVAkCCyQW/PrsqRq8Ezz+t1bC0jNlYQbQc+
> tgWUoQFeejJgxvmFqp693wpFe9gkbZ7pTjKYXFtv22IHsb7vlW9+Hhe7qxsLRPF9
> QuSh1mkBElnK604b79HV8HtPmRezuQtFlKgmnkoT/fcu2KaAvReIdnGkTgjbs1qW
> JTvTCnxI9wHGUPpBLh8F5bx79UH/rKh43rz5IQZIA/fqwS+25OkFpAbm7UhB6pOh
> vknsLjaH4yzTqMJT15IWF/RMXITgMengmon2hzjzySqxEeK84rO8kIrOzYMqK3dr
> Z6ZSaA1o8Ba00Iz6EMpS
> =7773
> -----END PGP SIGNATURE-----
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



More information about the Beginners mailing list