<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>KwartzLab Makerspace &#187; chess</title>
	<atom:link href="http://www.kwartzlab.ca/tag/chess/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kwartzlab.ca</link>
	<description>Home of Kwartzlab Makerspace in Kitchener/Waterloo, Ontario</description>
	<lastBuildDate>Sun, 19 May 2013 23:30:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<!-- podcast_generator="Blubrry PowerPress/4.0.7" -->
	<itunes:summary>Regular discussions with hackers, makers and artists at the Kwartzlab Makerspace. We talk about what projects people are working on, what events are coming up and how you can get involved.</itunes:summary>
	<itunes:author>kwartzlab</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.kwartzlab.ca/wp-content/uploads/powerpress/light_box_logo.jpg" />
	<itunes:owner>
		<itunes:name>kwartzlab</itunes:name>
		<itunes:email>podcast@kwartzlab.ca</itunes:email>
	</itunes:owner>
	<managingEditor>podcast@kwartzlab.ca (kwartzlab)</managingEditor>
	<itunes:subtitle>A hackerspace radio show</itunes:subtitle>
	<itunes:keywords>kwartzlab, hackerspace, makerspace, diy, hardware, software, maker, hacker, artist, roundtable</itunes:keywords>
	<image>
		<title>KwartzLab Makerspace &#187; chess</title>
		<url>http://www.kwartzlab.ca/wp-content/uploads/powerpress/light_box_logo.jpg</url>
		<link>http://www.kwartzlab.ca</link>
	</image>
	<itunes:category text="Technology" />
	<itunes:category text="Arts" />
	<itunes:category text="Games &amp; Hobbies">
		<itunes:category text="Hobbies" />
	</itunes:category>
		<rawvoice:location>Kitchener, ON</rawvoice:location>
		<item>
		<title>Chess Pathfinder (Knight&#8217;s Tour) 1.2</title>
		<link>http://www.kwartzlab.ca/2010/02/chess-pathfinder-knights-tour/</link>
		<comments>http://www.kwartzlab.ca/2010/02/chess-pathfinder-knights-tour/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:24:24 +0000</pubDate>
		<dc:creator>Jonathan Lamothe</dc:creator>
				<category><![CDATA[Member Blogs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[knight's tour]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[progress]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>It seems I've made some significant progress with the algorithm, just not enough yet.</p>

<p>After some discussion in the comments of my last entry, I decided that my next attempt should be to add a check after every move to make sure that I hadn't boxed any positions in, making them unreachable.
<!--more-->
I almost dismissed this idea because I originally thought that it would involve checking every position on the board after every move, but it's only necessary to check the eight positions that can be moved to from the current one.</p>

<p>The end result was this: on a 7x7 board, I can now compute the same path in 614 iterations as opposed to the 4430 required before.  This represents an efficiency increase of slightly better than 720% (although that admittedly doesn't account for the overhead added to each iteration by the check itself).  An 8x8 board still takes an unknown amount of time however.</p>

<p>The thing that this check doesn't take into account is the fact that there could be a cluster of positions that can reach each other, but can't be reached from outside; as opposed to a single, isolated position.  I had thought of this before I implemented the check, but hoped that it wouldn't be a significant problem.  It now seems that it may be.</p>

<p>It would seem that the next step is to find a way to look for clusters of isolated positions, although I haven't yet quite decided how to go about that from a programming standpoint.  Whatever I do, I'll have to make sure that the checking process itself is as efficient as possible.</p>

<p>More details as I make more progress.  As usual, here's the <a href="http://github.com/jlamothe/pathfinder/tree/v1.2">source</a> and <a href="http://www.jlamothe.net/projects/pathfinder/v1.2/">documentation</a>.</p>

<p><strong>EDIT - 13 Feb 2011:</strong>
The source and documentation for this version were lost.  I was able to recover the source (without doxygen comments) from Google's cache, but I had to re-write much of the documentation.  The code is now hosted at <a href="http://github.com">GitHub</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>It seems I&#8217;ve made some significant progress with the algorithm, just not enough yet.</p>
<p>After some discussion in the comments of my last entry, I decided that my next attempt should be to add a check after every move to make sure that I hadn&#8217;t boxed any positions in, making them unreachable.<br />
<span id="more-296"></span><br />
I almost dismissed this idea because I originally thought that it would involve checking every position on the board after every move, but it&#8217;s only necessary to check the eight positions that can be moved to from the current one.</p>
<p>The end result was this: on a 7&#215;7 board, I can now compute the same path in 614 iterations as opposed to the 4430 required before.  This represents an efficiency increase of slightly better than 720% (although that admittedly doesn&#8217;t account for the overhead added to each iteration by the check itself).  An 8&#215;8 board still takes an unknown amount of time however.</p>
<p>The thing that this check doesn&#8217;t take into account is the fact that there could be a cluster of positions that can reach each other, but can&#8217;t be reached from outside; as opposed to a single, isolated position.  I had thought of this before I implemented the check, but hoped that it wouldn&#8217;t be a significant problem.  It now seems that it may be.</p>
<p>It would seem that the next step is to find a way to look for clusters of isolated positions, although I haven&#8217;t yet quite decided how to go about that from a programming standpoint.  Whatever I do, I&#8217;ll have to make sure that the checking process itself is as efficient as possible.</p>
<p>More details as I make more progress.  As usual, here&#8217;s the <a href="http://github.com/jlamothe/pathfinder/tree/v1.2">source</a> and <a href="http://www.jlamothe.net/projects/pathfinder/v1.2/">documentation</a>.</p>
<p><strong>EDIT &#8211; 13 Feb 2011:</strong><br />
The source and documentation for this version were lost.  I was able to recover the source (without doxygen comments) from Google&#8217;s cache, but I had to re-write much of the documentation.  The code is now hosted at <a href="http://github.com">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2010/02/chess-pathfinder-knights-tour/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Chess Pathfinder 1.1</title>
		<link>http://www.kwartzlab.ca/2010/02/chess-pathfinder-11/</link>
		<comments>http://www.kwartzlab.ca/2010/02/chess-pathfinder-11/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 18:33:50 +0000</pubDate>
		<dc:creator>Jonathan Lamothe</dc:creator>
				<category><![CDATA[Member Blogs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[curse you exponential growth!]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>So, after a talk on IRC with @flying_squirrel (<a href="http://kwartzlab.ca/users/darcy-casselman">Darcy</a>), I decided to add a progress indicator to the program.  This indicator would tell me what estimated percentage of the total number of permutations the program had exhausted and display this information in increments of 1%.  As it turns out, this wasn't very helpful.  Let me explain:
<!--more-->
Starting from the upper left hand corner (0, 0) the smallest board on which a path can be found has dimensions of 5x5.  A path is found after exhausting somewhere between 1-2% of the possible permutations.  As I mentioned in my previous blog entry, my computer essentially calculates this instantly.</p>

<p>If we increase the size of the board to 6x6, we don't even use up 1% of the possible permutations and the result is still calculated in an imperceptibly small amount of time.</p>

<p>By the time we increase to 7x7, we're still using less than 1% (I'm assuming much less) of the possible permutations, but the result takes a few fractions of a second to calculate.</p>

<p>At 8x8 it gets really interesting.  The gauge still doesn't register (as expected) but I let the program run for about a minute or so with no result.</p>

<p>This would seem to indicate that as the size of the board increases, the percentage of permutations that we need to exhaust decreases (I'm assuming exponentially) but the amount of time needed increases (also exponentially... which I kind of expected).</p>

<p>From this we can extrapolate that at a size of 10x10, I will probably die before the program reaches a conclusion.  If there's a better way of calculating this it'll either involve a radical optimization of the existing program or (more likely) writing a new one from scratch.</p>

<p>Once again, here's my <a href="http://github.com/jlamothe/pathfinder/tree/v1.1">code</a> and <a href="http://www.jlamothe.net/projects/pathfinder/v1.1/">documentation</a>.</p>

<p>As a matter of interest, I left the original program running in the background.  We're currently sitting at 18+ hours with (surprise) still no result.</p>

<p><strong>EDIT - 13 Feb 2011:</strong>
The source code and documentation were lost.  I found the source cached on Google (it's now hosted at <a href="http://github.com">GitHub</a>) and regenerated the documentation.</p>
]]></description>
				<content:encoded><![CDATA[<p>So, after a talk on IRC with @flying_squirrel (<a href="http://kwartzlab.ca/users/darcy-casselman">Darcy</a>), I decided to add a progress indicator to the program.  This indicator would tell me what estimated percentage of the total number of permutations the program had exhausted and display this information in increments of 1%.  As it turns out, this wasn&#8217;t very helpful.  Let me explain:<br />
<span id="more-293"></span><br />
Starting from the upper left hand corner (0, 0) the smallest board on which a path can be found has dimensions of 5&#215;5.  A path is found after exhausting somewhere between 1-2% of the possible permutations.  As I mentioned in my previous blog entry, my computer essentially calculates this instantly.</p>
<p>If we increase the size of the board to 6&#215;6, we don&#8217;t even use up 1% of the possible permutations and the result is still calculated in an imperceptibly small amount of time.</p>
<p>By the time we increase to 7&#215;7, we&#8217;re still using less than 1% (I&#8217;m assuming much less) of the possible permutations, but the result takes a few fractions of a second to calculate.</p>
<p>At 8&#215;8 it gets really interesting.  The gauge still doesn&#8217;t register (as expected) but I let the program run for about a minute or so with no result.</p>
<p>This would seem to indicate that as the size of the board increases, the percentage of permutations that we need to exhaust decreases (I&#8217;m assuming exponentially) but the amount of time needed increases (also exponentially&#8230; which I kind of expected).</p>
<p>From this we can extrapolate that at a size of 10&#215;10, I will probably die before the program reaches a conclusion.  If there&#8217;s a better way of calculating this it&#8217;ll either involve a radical optimization of the existing program or (more likely) writing a new one from scratch.</p>
<p>Once again, here&#8217;s my <a href="http://github.com/jlamothe/pathfinder/tree/v1.1">code</a> and <a href="http://www.jlamothe.net/projects/pathfinder/v1.1/">documentation</a>.</p>
<p>As a matter of interest, I left the original program running in the background.  We&#8217;re currently sitting at 18+ hours with (surprise) still no result.</p>
<p><strong>EDIT &#8211; 13 Feb 2011:</strong><br />
The source code and documentation were lost.  I found the source cached on Google (it&#8217;s now hosted at <a href="http://github.com">GitHub</a>) and regenerated the documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2010/02/chess-pathfinder-11/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Chess Pathfinder</title>
		<link>http://www.kwartzlab.ca/2010/02/chess-pathfinder/</link>
		<comments>http://www.kwartzlab.ca/2010/02/chess-pathfinder/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:06:32 +0000</pubDate>
		<dc:creator>Jonathan Lamothe</dc:creator>
				<category><![CDATA[Member Blogs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>Yesterday I was presented with an interesting problem.  The task was this: write a program that can move a knight from an arbitrary position on a 10x10 chess board (yes, I know they're usually 8x8) so that it would move to every square on the board but never hit the same position twice.
<!--more-->
The idea I had was to have a two-dimensional array of integers, initialized to values of zero, representing the board.  A recursive function would then:</p>

<ol>
<li>be given a starting position and the number of moves already completed successfully (zero on the first call - obviously)</li>
<li>return true if the number of successful moves already completed would fill the entire board</li>
<li>make sure that the position is within the boundaries of the table (retuning false on failure)</li>
<li>make sure that position was unoccupied (check that the corresponding value in the array is zero - again returning false on failure)</li>
<li>change the value at that location of the array to the current number of moves completed</li>
<li>call the function again with starting positions for each legal move with the new number of successful moves</li>
<li>as soon as one of these functions return true, the function would then return true itself</li>
<li>if no paths were found (all of the functions returned false) the function would then set the value in the array back to zero and return false itself</li>
</ol>

<p>This table could then be displayed on the screen showing the calculated path.</p>

<p>I wrote a program to do this in about 15 minutes, but the problem is that it takes <strong>forever</strong> to calculate a path.  At present, the program has been running for over 16 hours and still hasn't come to a conclusion, nor do I even know how close it is to even getting to one.</p>

<p>Naturally, I wanted to rule out programmer error, so I adjusted the size of the board to 5x5 and ran it.  This is what I got back instantaneously:</p>

<pre><code>   1    6   15   10   21
  14    9   20    5   16
  19    2    7   22   11
   8   13   24   17    4
  25   18    3   12   23
</code></pre>

<p>This indicates to me that the code works, it just takes a long time to run through all the possible permutations.</p>

<p>I've posted the C source to my first attempt <a href="http://github.com/jlamothe/pathfinder/tree/v1.0">here</a> and the documentation <a href="http://www.jlamothe.net/projects/pathfinder/v1.0/">here</a>.</p>

<p>Hopefully someone can help me find a faster solution, or I can find it myself.</p>

<p><strong>EDIT - 13 Feb 2011:</strong>
The source code and documentation were lost.  I found the source cached on Google (it's now hosted at <a href="http://github.com">GitHub</a>) and regenerated the documentation.</p>
]]></description>
				<content:encoded><![CDATA[<p>Yesterday I was presented with an interesting problem.  The task was this: write a program that can move a knight from an arbitrary position on a 10&#215;10 chess board (yes, I know they&#8217;re usually 8&#215;8) so that it would move to every square on the board but never hit the same position twice.<br />
<span id="more-292"></span><br />
The idea I had was to have a two-dimensional array of integers, initialized to values of zero, representing the board.  A recursive function would then:</p>
<ol>
<li>be given a starting position and the number of moves already completed successfully (zero on the first call &#8211; obviously)</li>
<li>return true if the number of successful moves already completed would fill the entire board</li>
<li>make sure that the position is within the boundaries of the table (retuning false on failure)</li>
<li>make sure that position was unoccupied (check that the corresponding value in the array is zero &#8211; again returning false on failure)</li>
<li>change the value at that location of the array to the current number of moves completed</li>
<li>call the function again with starting positions for each legal move with the new number of successful moves</li>
<li>as soon as one of these functions return true, the function would then return true itself</li>
<li>if no paths were found (all of the functions returned false) the function would then set the value in the array back to zero and return false itself</li>
</ol>
<p>This table could then be displayed on the screen showing the calculated path.</p>
<p>I wrote a program to do this in about 15 minutes, but the problem is that it takes <strong>forever</strong> to calculate a path.  At present, the program has been running for over 16 hours and still hasn&#8217;t come to a conclusion, nor do I even know how close it is to even getting to one.</p>
<p>Naturally, I wanted to rule out programmer error, so I adjusted the size of the board to 5&#215;5 and ran it.  This is what I got back instantaneously:</p>
<pre><code>   1    6   15   10   21
  14    9   20    5   16
  19    2    7   22   11
   8   13   24   17    4
  25   18    3   12   23
</code></pre>
<p>This indicates to me that the code works, it just takes a long time to run through all the possible permutations.</p>
<p>I&#8217;ve posted the C source to my first attempt <a href="http://github.com/jlamothe/pathfinder/tree/v1.0">here</a> and the documentation <a href="http://www.jlamothe.net/projects/pathfinder/v1.0/">here</a>.</p>
<p>Hopefully someone can help me find a faster solution, or I can find it myself.</p>
<p><strong>EDIT &#8211; 13 Feb 2011:</strong><br />
The source code and documentation were lost.  I found the source cached on Google (it&#8217;s now hosted at <a href="http://github.com">GitHub</a>) and regenerated the documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2010/02/chess-pathfinder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
