<div dir="ltr">Think of the function,<div> hanoi :: Integer -> Peg -> Peg -> Peg -> [Move]</div><div><br></div><div>As printing the following moves:</div><div><ol><li>Move (n - 1) discs from peg1 to peg2 using peg3</li><li>Move 1 disc from peg1 to peg3 using peg2</li><li>Move (n - 1) discs from peg2 to peg3 using peg1</li></ol><div>The main idea behind towers of hanoi is that you are constrained, and cannot move many discs at once. But using an <i>intermediate peg</i>, you can eventually move all discs to the target peg.</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 17 February 2015 at 17:53, Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Joel Neely schreef op 17-2-2015 om
13:05:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra"><span class="">
<div class="gmail_default" style="font-family:georgia,serif;font-size:small">Let's
tweak your answers just a bit, calling the three pegs the
"source", "goal", and "spare" pegs:</div>
<br>
</span><div class="gmail_quote"><span class="">On Tue, Feb 17, 2015 at 5:23 AM,
Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">- Where do I move
the bottom (largest disk) ? <br>
<br>
To the last peg, which do not contain any disk then
<div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">
.</div>
</div>
</blockquote>
<div><br>
</div>
<div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">From
the source peg to the goal peg, which will</div>
<span style="font-family:georgia,serif">/must</span>
<div class="gmail_default" style="font-family:georgia,serif;display:inline"> not
contain any disks.</div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline"></div>
<br>
<br>
- What must happen before I can move the bottom disk ? <br>
<br>
I have to move the disk which above that disk. <br>
</div>
</blockquote>
<div><br>
</div>
</span><div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">Move
everything else from source to sparel peg.</div>
</div><span class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <br>
- What must happen after I move the bottom disk ?<br>
<br>
All the other disk must be placed above that disk. <br>
</div>
</blockquote>
<div><br>
</div>
</span><div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small;display:inline">
Move everything else from spare to goal.</div>
</div>
</div><span class="">
<br>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small">So more
questions/hints:</div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small">
<ol>
<li>How do you fill in the blanks?<br>
</li>
<li>How do you put the three statements in order?<br>
</li>
<li>How many disks does each statement talk about?<br>
</li>
</ol>
</div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br>
</div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small">-jn-</div>
<div class="gmail_default" style="font-family:georgia,serif;font-size:small"></div>
</span></div>
</div>
</blockquote>
<br>
1. I did already.<br>
2. First move everything except the bottom one to the spare peg.
<br>
Move the bottom one to the goal peg. <br>
Move everything else from the spare peg to the goal peg. <br>
<br>
3. Only 2 <br><span class="HOEnZb"><font color="#888888">
<br>
Roelof<br>
<br>
<br>
</font></span></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>