hanoi 1 p1 _ p3 = move 1 disc from p1 to p3 hanoi n p1 p2 p3 = move n discs from p1 to p3 using p2 in between The definition of the first equation is easy. To complete the second equation, you need to use hanoi again recursively. I detailed a way to complete the second equation in my previous mail (which hopefully didn't spoil it). Hope this helps. On 17 February 2015 at 22:39, Roelof Wobben <r.wobben@home.nl> wrote:
Stupid error
Then it must be like this :
hanoi n 1 2 3 | n = 1 -> moves the last disk to the goal peg | n > 1 -> moves all the other disk to the spare peg or to the moves n -1 to the goal peg
Roelof
Mike Meyer schreef op 17-2-2015 om 17:57:
On Feb 17, 2015 10:50 AM, "Roelof Wobben" <r.wobben@home.nl> wrote:
N reprent the number of disk
So how does moving 0 disks happen? That is what your first case deals with.
Roelof
Mike Meyer schreef op 17-2-2015 om 17:47:
On Feb 17, 2015 10:18 AM, "Roelof Wobben" <r.wobben@home.nl> wrote:
This part I understand well.
So you could do something like this:
hanoi n 1 2 3 | n = 0 -> moves the last disk to the goal peg | n != 0 -> moves all the other disk to the spare peg or to the
moves n -1 to the goal peg
What does n represent here?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards Sumit Sahrawat