<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title><![CDATA[Perl 6: Tower of Hanoi]]></title>
<link>http://www.perlfoundation.org/perl6/index.cgi?tower_of_hanoi</link>
<description></description>
<pubDate>Thu, 03 Jan 2008 10:31:25 -0000</pubDate>
<webMaster>synedra@gmail.com</webMaster>
<generator>Socialtext Workspace v2.14.7.2</generator>

<item>
<title><![CDATA[Tower of Hanoi]]></title>
<link>http://www.perlfoundation.org/perl6/index.cgi?tower_of_hanoi</link>
<description><![CDATA[<div class="wiki">
<h2 id="description">Description</h2>
<p>
Invented by the French mathematician Édouard Lucas in 1883, this is a mathematical game/puzzle about moving a set of disks between a set of pegs, limited by the following rules :</p>
<ul>
<li>Only one disk may be moved at a time.</li>
<li>Each move consists of taking the upper disk from one of the pegs and sliding it onto another peg, on top of the other disks that may already be present on that peg.</li>
<li>No disk may be placed on top of a smaller disk.</li>
</ul>
<h2 id="solutions">Solutions</h2>
<p>
<a target="_blank" title="(external link)" href="http://svn.pugscode.org/pugs/examples/algorithms/hanoi.pl">http://svn.pugscode.org/pugs/examples/algorithms/hanoi.pl</a></p>
<h2 id="status_with_current_release_of_perl_6_parrot">Status with current release of perl 6 / parrot</h2>
<ul>
<li>Parrot 0.5.1 December 2007 : compiler errors - subs and argv not implemented</li>
<li>Parrot SVN Revision 24336 20 December 2007 : works without // and argv syntax (<a target="_blank" title="(external link)" href="http://nopaste.snit.ch:8001/11939)">http://nopaste.snit.ch:8001/11939)</a></li>
<li>Parrot SVN Revision 24478 3 January 2008 : works as is</li>
<li>Pugs SVN revision 18224 : works as is</li>
</ul>
<h2 id="benchmarks">Benchmarks</h2>
<p>
1000 iterations with 6 disks - skip output ( or comment on output to file, etc : <a target="_blank" title="(external link)" href="http://sial.org/pbot/29516">http://sial.org/pbot/29516</a> thanks to Stephen Weeks / Tene on #perl6 )</p>
<ul>
<li>Pugs revision 18224 ( 1ghz, 640M ram )</li>

<ul>
<li>(100 iterations with 1 say per iteration) : real 0m22.611s, user 0m22.384s, sys 0m0.101s</li>
</ul>
<li>Parrot revision 24336 ( 1.6ghz, 2G ram )</li>

<ul>
<li>(1000 iterations no printing ) : real 0m3.577s, user 0m3.119s, 0m0.452s</li>
<li>(100 iterations with 1 say per iteration) : real 0m0.841s, user 0m0.694s, sys 0m0.141s</li>
</ul></ul>
<h2 id="comparisons_against_perl_5_etc">Comparisons against Perl 5, etc</h2>
<ul>
<li><a target="_blank" title="(external link)" href="http://hop.perl.plover.com/Examples/ALL/hanoi">http://hop.perl.plover.com/Examples/ALL/hanoi</a> # MJD's simple perl solution to Hanoi (further examples and detail in the Higher Order Perl book)</li>
<li><a target="_blank" title="(external link)" href="http://www.kernelthread.com/hanoi/html/rb.html">http://www.kernelthread.com/hanoi/html/rb.html</a> # simple ruby program to solve hanoi from command line</li>
<li><a target="_blank" title="(external link)" href="http://www.ruby-forum.com/topic/107700">http://www.ruby-forum.com/topic/107700</a> # object oriented ruby class to solve hanoi from command line and discussion thereof</li>
<li><a target="_blank" title="(external link)" href="http://codegolf.com/tower-of-hanoi">http://codegolf.com/tower-of-hanoi</a> # golfing tower of hanoi</li>
<li><a target="_blank" title="(external link)" href="http://www.kernelthread.com/hanoi/html/py.html">http://www.kernelthread.com/hanoi/html/py.html</a> # simple python solution</li>
</ul>
<h2 id="references">References</h2>
<ul>
<li><a target="_blank" title="(external link)" href="http://mathworld.wolfram.com/TowerofHanoi.html">http://mathworld.wolfram.com/TowerofHanoi.html</a></li>
<li><a target="_blank" title="(external link)" href="http://en.wikipedia.org/wiki/Tower_of_Hanoi">http://en.wikipedia.org/wiki/Tower_of_Hanoi</a></li>
</ul>
</div>
]]></description>
<author>Aaron TEEJAY Trevena</author>
<guid isPermaLink="true">http://www.perlfoundation.org/perl6/index.cgi?tower_of_hanoi</guid>
<pubDate>Thu, 03 Jan 2008 10:31:25 -0000</pubDate>
</item>

</channel>
</rss>