<?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/"
	>

<channel>
	<title>Logan Buesching &#187; School</title>
	<atom:link href="http://agoln.net/archives/category/school/feed" rel="self" type="application/rss+xml" />
	<link>http://agoln.net</link>
	<description>Development and personal site</description>
	<lastBuildDate>Thu, 09 Sep 2010 21:01:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Hanzi Recognizer</title>
		<link>http://agoln.net/archives/78</link>
		<comments>http://agoln.net/archives/78#comments</comments>
		<pubDate>Sun, 25 Nov 2007 08:04:09 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/78</guid>
		<description><![CDATA[Hanzi Recognizer is a project that has been born out of CS490t at Purdue University by myself and Nathan Hobbs. The information below is current as of 11/24/2007. Features When you draw a Chinese character in the drawing panel, and look it up, it gives 5 of the closest matches. For each character, it also [...]]]></description>
			<content:encoded><![CDATA[<p>Hanzi Recognizer is a project that has been born out of <a href="http://www.cs.purdue.edu/homes/cs490t/" title="Tablet PC Programming">CS490t</a> at <a href="http://www.purdue.edu" title="Purdue University">Purdue University</a> by myself and Nathan Hobbs.  The information below is current as of 11/24/2007.</p>
<h2>Features</h2>
<p>When you draw a Chinese character in the drawing panel, and look it up, it gives 5 of the closest matches.  For each character, it also informs the user of the definition, pronunciation, main radical and main radical definition.</p>
<p><a href='http://agoln.net/wp-content/uploads/2007/11/hanzirecognizer.png' title='hanzirecognizer.png'><img src='http://agoln.net/wp-content/uploads/2007/11/hanzirecognizer.thumbnail.png' alt='hanzirecognizer.png' /></a></p>
<h2>High Level Implementation Details</h2>
<p>The stroke recognition and scoring algorithm isn&#8217;t the greatest, but it is based upon <a href="http://www.cs.arizona.edu/projects/japan/JavaDict/" title="Java Dictionary">JavaDict</a>, a 10 year old Java 1.2 program.  A stroke is defined as pen down until pen up.  What it does, is it turns a single stroke into a number.  The number represents the direction the stroke was made.  When you make a multiple direction stroke (Like drawing a capital L), it is registered as two directional strokes.</p>
<pre>
Directional strokes:
         7   8   9
          \  |  /
        4 ---5--- 6
          /  |  \
         1   2   3
</pre>
<p>So an L would be considered a 26 stroke.  Currently then, it scores the given stroke against every stroke in the database, with the lowest score being the best match.</p>
<p>We then have a Unistrok file that contains how to draw every character.  This file looks similar to:</p>
<pre>
6c34 | 61 2 1 3
</pre>
<p>Where it is [unicode | strokes].  </p>
<h2>To Do</h2>
<p>Currently, we need a better scoring algorithm.  If there are too many or too few strokes drawn, then we just arbitrarily give it a bad score.  This can be improved through implementing an <a href="http://en.wikipedia.org/wiki/Edit_distance" title="edit algorithm">edit distance algorithm</a>.</p>
<p>Allowing for characters to be searched by pronunciation or radical.</p>
<p>It takes a long time to load.  This is a side effect of the fact that our characters are stored unsorted, therefore it takes O(n) time to search for a character.  In itself that&#8217;s not slow, but doing that 50,000 times is slow.  We need to sort the characters as we store them and search with a binary search (or hash and search in O(1)).</p>
<p>Nate just implemented some basic speech functionality.  We need to get some speakers to speak the pronunciations and implement this.</p>
<p>Currently we are creating our own XML file format to store the characters so we don&#8217;t have to get information from 3 different databases.  This file can be rebuilt as the others are updated, and itself would cut down on the load times by almost a full order of magnitude.</p>
<p>We need to add more support for more variants of radicals and simplified / traditional characters.  Currently, there are many places where we (seemingly) arbitrarily choose to display either a traditional or simplified variant.</p>
<h2>References</h2>
<p><a href="http://unicode.org/charts/unihan.html" title="CJK Unified Ideographs">Unihan Database</a><br/><br />
<a href="http://www.mandarintools.com/cedict.html" title="Chinese-English Dictionary">CEDict</a></p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/78/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rubix Cube in C# using LINQ</title>
		<link>http://agoln.net/archives/70</link>
		<comments>http://agoln.net/archives/70#comments</comments>
		<pubDate>Wed, 17 Oct 2007 18:40:33 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/70</guid>
		<description><![CDATA[Today I finished up some of the coding for the my Rubix Cube project using Direct X and LINQ. Luke Hoersten and Nate Hobbs were my partners in developing the program. All of us worked on coming up with designing a sufficient data structure. I worked on implementing the data structure and the user interface [...]]]></description>
			<content:encoded><![CDATA[<p>Today I finished up some of the coding for the my <a href="archives/62" title="Rubix Cube - LINQ Application">Rubix Cube</a> project using Direct X and LINQ.  <a href="http://openradix.org" title="Luke's Blog">Luke Hoersten</a> and Nate Hobbs were my partners in developing the program.  All of us worked on coming up with designing a sufficient data structure.  I worked on implementing the data structure and the user interface / Direct X stuff.  Luke focused on refactoring the code, and coming up with parts of the solving algorithm.  Nate worked on parts of the solving algorithm.</p>
<h3>Previous Posts</h3>
<p>I have <a href="archives/63" title="Some headaches with DirectX">outlined some problems</a> we had while developing the application and also some <a href="archives/58">design decisions</a> that were made to include LINQ.  The way our program solves it is that it goes about it the way that a human would.  </p>
<h3>Solving the cube</h3>
<p>The program starts with trying to solve the bottom layer, then solve the middle layer, then finally the top layer.  Luke would be able to give a much better explanation of how it worked.  It was suggested by our professor that we create a tree by attempting every move, then for every move try every move, etc&#8230;  This we thought would not be a great way to solve it for two reasons.  The first being that there are 18 possible moves to make on a cube, and if you want to try and go n levels deep, it would have to compute 18<sup>n</sup> states.  Not only that, but it would have to store every state, score them, then take the path with the best score.  To go 6 levels deep, you need to compute 34 million different states, for 7 levels deep, you need to compute 612 million states.  Computers are good, but they aren&#8217;t <strong>that</strong> good.</p>
<p>This would not be <em>completely</em> terrible, if you had a smart heuristic for scoring.  If every time you computed every one of those states, you were guaranteed to get closer to the solution, then you would only be spending time solving it, and time a computer has.  The heuristic that was presented was to find proximity of where a block is to where it should be.  This is not the greatest either because what happens when you are almost finished solving it, and you have only one or two cubes out of place (or oriented wrong).  You have to end up messing up your cube really bad in order to solve it, and if you&#8217;re algorithm doesn&#8217;t go deep enough, you won&#8217;t find your solution because your current state will always be better than where you are going.</p>
<h3>The Program</h3>
<p>Basically, here is the outline of the program:</p>
<p>Block.cs &#8211; A tiny block within the rubix cube.  The rubix cube contains 27 of these blocks.<br />
Cube.cs &#8211; The cube structure, contains helper functions to orient and move sides of the cube.<br />
Solver.cs &#8211; The class that solves the rubix cube.<br />
UI.cs &#8211; Handles the DirectX and drawing of the rubix cube.</p>
<p>We haven&#8217;t formally licensed the program, but I&#8217;m sure Luke and Nate wouldn&#8217;t mind if we say it&#8217;s GPL&#8217;d.  Basically give us credit for whatever you do with it and don&#8217;t sell it.</p>
<p>URL: <a href='http://agoln.net/wp-content/uploads/2007/10/rubix.zip' title='Rubix Cube in C# using LINQ'>Rubix Cube in C# using LINQ</a><br />
Alternatively, you can also check out the Mercurial sources at: <a href="http://hg.openradix.org/rubix/">Luke&#8217;s Mercurial Sources</a></p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/70/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rubix Cube &#8211; LINQ Application</title>
		<link>http://agoln.net/archives/62</link>
		<comments>http://agoln.net/archives/62#comments</comments>
		<pubDate>Wed, 29 Aug 2007 20:02:43 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/62</guid>
		<description><![CDATA[In CS 490T I am working on a team with two others creating a Rubix Cube project, one being Luke. We have have been struggling to find a nice, clean, object oriented way to represent the cube, but I believe that we have found a good solution. We are going to have a Cube class [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.cs.purdue.edu/homes/cs490t/" title="Tablet PC Programming">CS 490T</a> I am working on a team with two others creating a Rubix Cube project, one being <a href="http://openradix.org" title="Luke's Blog">Luke</a>.  We have have been struggling to find a nice, clean, object oriented way to represent the cube, but I believe that we have found a good solution.  We are going to have a Cube class with methods that rotate sides of the cube.  This class will have one property, a collection of Blocks.  A single block has six properties: front, left, right, bottom, top, back.  The way we will rotate the block will be by specifying a face (top, left, etc&#8230;) and a direction, clockwise or counter clockwise.  Class outline is below.</p>
<pre>
Class Cube {
 Block blocks[20];
 rotate(Face, Direction);
}

Class Block {
 Color top;
 Color bottom;
 Color left;
 Color right;
 Color front;
 Color back;
}
</pre>
<p>The way that you can represent the position of the block is which faces are defined.  If a color is not present in the block, then the color will not be defined.  Such as the top middle piece will only have the top property not set to null.  This way, you can know which position a block is in by knowing which sides have colors defined.  So the position of the block with the top, left and front defined is the block in the upper left corner closest to you.</p>
<pre>
 ______
|\\_\\_\\_\\
|\\|X| | |
|\\| | | |
 \\|_|_|_|
</pre>
<p>I belive that this Rubix cube has many valid uses for <a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx" title="The LINQ project">LINQ</a>. One such way defined below.</p>
<p>We were going to do a lot of nasty if statements like</p>
<pre>
if (top!=null) { //some block on top
 if (front !=null) { //some front block
  if (left !=null) { //top front left
  } else { //top front right
  }
  etc...
}
</pre>
<p>But instead, with LINQ, we can do the following:</p>
<pre>
SELECT * FROM blocks WHERE top!=NULL AND front!=NULL AND left!=NULL;
</pre>
<p>And that will do all the work for us.</p>
<p>I was thinking about other ways to use LINQ, such as the actual updates when a move is done.</p>
<pre>
UPDATE blocks SET top=(SELECT color FROM blocks WHERE...) WHERE ...
</pre>
<p>This will update all the block colors for a given move.  This may or may not be simpler than a lot of if/else if&#8217;s with manual updating.</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/62/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

