Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: tower hanoi problem (Joel Neely)
2. Re: tower hanoi problem (Roelof Wobben)
3. Re: tower hanoi problem
(Sumit Sahrawat, Maths & Computing, IIT (BHU))
4. Re: tower hanoi problem (Joel Neely)
----------------------------------------------------------------------
Message: 1
Date: Tue, 17 Feb 2015 06:05:59 -0600
From: Joel Neely <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] tower hanoi problem
Message-ID:
<CAEEzXAifYjbjBhPB=nk-hmNvrzf-cSSVrXQeC6shBnA7Z9=e...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
?Let's tweak your answers? just a bit, calling the three pegs the "source",
"goal", and "spare" pegs:
On Tue, Feb 17, 2015 at 5:23 AM, Roelof Wobben <[email protected]> wrote:
> - Where do I move the bottom (largest disk) ?
>
> To the last peg, which do not contain any disk then
> ?.
>
>From the source peg to the goal peg, which will
/must
not contain any disks.?
> ?
>
>
> - What must happen before I can move the bottom disk ?
>
> I have to move the disk which above that disk.
>
Move everything else from ____ to ____.?
>
> - What must happen after I move the bottom disk ?
>
> All the other disk must be placed above that disk.
>
?Move everything else from ____ to ____.?
?So more questions/hints:
1. How do you fill in the blanks?
2. How do you put the three statements in order?
3. How many disks does each statement talk about?
-jn-
?
--
Beauty of style and harmony and grace and good rhythm depend on simplicity.
- Plato
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150217/61ee5c10/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 17 Feb 2015 13:23:27 +0100
From: Roelof Wobben <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] tower hanoi problem
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150217/071a7904/attachment-0001.html>
------------------------------
Message: 3
Date: Tue, 17 Feb 2015 20:39:32 +0530
From: "Sumit Sahrawat, Maths & Computing, IIT (BHU)"
<[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] tower hanoi problem
Message-ID:
<CAJbEW8OnNKYgWU5=N5yhu40f=9poeksysjzcovn57x+rbtd...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Think of the function,
hanoi :: Integer -> Peg -> Peg -> Peg -> [Move]
As printing the following moves:
1. Move (n - 1) discs from peg1 to peg2 using peg3
2. Move 1 disc from peg1 to peg3 using peg2
3. Move (n - 1) discs from peg2 to peg3 using peg1
The main idea behind towers of hanoi is that you are constrained, and
cannot move many discs at once. But using an *intermediate peg*, you can
eventually move all discs to the target peg.
On 17 February 2015 at 17:53, Roelof Wobben <[email protected]> wrote:
> Joel Neely schreef op 17-2-2015 om 13:05:
>
> ?Let's tweak your answers? just a bit, calling the three pegs the
> "source", "goal", and "spare" pegs:
>
> On Tue, Feb 17, 2015 at 5:23 AM, Roelof Wobben <[email protected]> wrote:
>
>> - Where do I move the bottom (largest disk) ?
>>
>> To the last peg, which do not contain any disk then
>> ? .
>>
>
> From the source peg to the goal peg, which will
> /must
> not contain any disks.?
>
>
>> ?
>>
>>
>> - What must happen before I can move the bottom disk ?
>>
>> I have to move the disk which above that disk.
>>
>
> Move everything else from source to sparel peg.?
>
>
>>
>> - What must happen after I move the bottom disk ?
>>
>> All the other disk must be placed above that disk.
>>
>
> ? Move everything else from spare to goal.?
>
>
> ?So more questions/hints:
>
> 1. How do you fill in the blanks?
> 2. How do you put the three statements in order?
> 3. How many disks does each statement talk about?
>
>
> -jn-
> ?
>
>
> 1. I did already.
> 2. First move everything except the bottom one to the spare peg.
> Move the bottom one to the goal peg.
> Move everything else from the spare peg to the goal peg.
>
> 3. Only 2
>
> Roelof
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150217/3b72bdfc/attachment-0001.html>
------------------------------
Message: 4
Date: Tue, 17 Feb 2015 10:13:04 -0600
From: Joel Neely <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] tower hanoi problem
Message-ID:
<CAEEzXAhNstcwmDuFcvkve7MDfnr5sH+ka5t55ddD+jJz-1wO=q...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Regarding your last answer...
3. Only 2
...let me suggest a different perspective. If we begin with n disks, then:
First move everything except the bottom one to the spare peg.
?"everything except the bottom one" refers to
?(
n
? - 1)?
disks
Move the bottom one to the goal peg.
?"the bottom one" refers to 1 disk?
Move everything else from the spare peg to the goal peg.
?"everything else" refers to
(
n
? - 1)?
disks
So that moves the thought process toward the "fancier recursion pattern"
per Doug McIlroy's excellent summary.
On Tue, Feb 17, 2015 at 6:23 AM, Roelof Wobben <[email protected]> wrote:
> Joel Neely schreef op 17-2-2015 om 13:05:
>
> ?Let's tweak your answers? just a bit, calling the three pegs the
> "source", "goal", and "spare" pegs:
>
> On Tue, Feb 17, 2015 at 5:23 AM, Roelof Wobben <[email protected]> wrote:
>
>> - Where do I move the bottom (largest disk) ?
>>
>> To the last peg, which do not contain any disk then
>> ? .
>>
>
> From the source peg to the goal peg, which will
> /must
> not contain any disks.?
>
>
>> ?
>>
>>
>> - What must happen before I can move the bottom disk ?
>>
>> I have to move the disk which above that disk.
>>
>
> Move everything else from source to sparel peg.?
>
>
>>
>> - What must happen after I move the bottom disk ?
>>
>> All the other disk must be placed above that disk.
>>
>
> ? Move everything else from spare to goal.?
>
>
> ?So more questions/hints:
>
> 1. How do you fill in the blanks?
> 2. How do you put the three statements in order?
> 3. How many disks does each statement talk about?
>
>
> -jn-
> ?
>
>
> 1. I did already.
> 2. First move everything except the bottom one to the spare peg.
> Move the bottom one to the goal peg.
> Move everything else from the spare peg to the goal peg.
>
> 3. Only 2
>
> Roelof
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
--
Beauty of style and harmony and grace and good rhythm depend on simplicity.
- Plato
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150217/4ff991bc/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 80, Issue 36
*****************************************