<?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>Jamie&#039;s Blog &#187; Software</title>
	<atom:link href="http://www.angelforge.org/wordpress/topics/programming/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.angelforge.org/wordpress</link>
	<description>My life is words.</description>
	<lastBuildDate>Sat, 28 Jan 2012 04:35:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sandwich Roulette</title>
		<link>http://www.angelforge.org/wordpress/programming/software/sandwich-roulette/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/sandwich-roulette/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 04:30:21 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=3123</guid>
		<description><![CDATA[Over the weekend I had the idea to create an app which creates a random sandwich for you to get at Wawa. The result is the Sandwich Roulette! Here&#8217;s the source on Github.]]></description>
			<content:encoded><![CDATA[<p>Over the weekend I had the idea to create an app which creates a random sandwich for you to get at Wawa. The result is the <a href="http://sandwich-roulette.heroku.com/">Sandwich Roulette</a>! Here&#8217;s the <a href="https://github.com/jamiely/sandwich-roulette">source on Github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/sandwich-roulette/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pathfinding &#8211; Hide and Seek Game</title>
		<link>http://www.angelforge.org/wordpress/programming/software/pathfinding-hide-and-seek-game/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/pathfinding-hide-and-seek-game/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 12:00:18 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[School]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[A Star]]></category>
		<category><![CDATA[A*]]></category>
		<category><![CDATA[camera controller]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[hide and seek]]></category>
		<category><![CDATA[Lenguins]]></category>
		<category><![CDATA[path finding]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=3004</guid>
		<description><![CDATA[Intro For the last assignment for CIS564, we created a simple tag/hide-and-seek game using path-finding, and the behavioral steering from the last assignment. A* A* (A-star) is a path-finding algorithm which finds an optimal path between two nodes given a cost function which yields the distance from the start and a good heuristic estimating the [...]]]></description>
			<content:encoded><![CDATA[<h2>Intro</h2>
<p>For the last assignment for CIS564, we created a simple tag/hide-and-seek game using path-finding, and the behavioral steering from the last assignment.</p>
<h2>A*</h2>
<p>A* (A-star) is a path-finding algorithm which finds an optimal path between two nodes given a cost function which yields the distance from the start and a good heuristic estimating the distance to the goal. The game field is divided into a grid of 1600 squares. Each square is marked as open or obstructed, based on the presence of a mushroom obstacle. Obstacles may be placed dynamically by holding ALT and LEFT-clicking with the mouse. In Path-finding mode, Lenguins will plan a path around the mushrooms to the target.</p>
<div id="attachment_3010" class="wp-caption aligncenter" style="width: 199px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.12.25-AM.png"><img class="size-medium wp-image-3010" title="Mushroom obstacle" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.12.25-AM-189x300.png" alt="Mushroom obstacle" width="189" height="300" /></a><p class="wp-caption-text">Mushroom obstacle</p></div>
<p>The algorithm was implemented in C++ and compiled in XCode to a OSX Bundle for use with Unity. I turned out to be the only one to work on OSX. Since a Visual Studio project was required, I ported the code over to Windows after I was sure it worked. I&#8217;ve noticed interesting differences in the way the code works in OSX versus Windows&#8211;or it could be a difference in compilation between XCode and Visual Studio. For example, I was using a route where I subsampled a list of vectors that represented an agent path. I had something like:</p>
<pre class="brush: cpp; title: ; notranslate">
std::list&lt;vec3&gt;&amp; Environment::subsamplePath(std::list&lt;vec3&gt;&amp; path, int factor) {
    int i = 0;
    for(std::list&lt;vec3&gt;::iterator it = path.begin(); it != path.end(); ++it) {
        if(i % factor == 0) {
			    path.remove(*it);
        }
        i++;
    }
    return path;
}
</pre>
<p>This seemed to work fine on OSX, but Windows threw a fit. Unity would immediately crash when I ran the game. I traced the problem to this function and a little investigation shed some light on the matter. When you call remove, it invalidates the iterator&#8211;makes sense. So I changed the code to the following:</p>
<pre class="brush: cpp; title: ; notranslate">
std::list&lt;vec3&gt;&amp; Environment::subsamplePath(std::list&lt;vec3&gt;&amp; path, int factor) {
    int i = 0;
    for(std::list&lt;vec3&gt;::iterator it = path.begin(); it != path.end(); ) {
        if(i % factor == 0) {
			it = path.erase(it);
        }
		else {
			++it;
		}
        i++;
    }
    return path;
}
</pre>
<h2>Freeze Tag</h2>
<p>Clicking the &#8220;Hide &amp; Seek&#8221; button will enable the Freeze Tag mode.</p>
<div id="attachment_3013" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.17.51-AM.png"><img class="size-medium wp-image-3013" title="Game Options" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.17.51-AM-300x46.png" alt="Game Options" width="300" height="46" /></a><p class="wp-caption-text">Game Options</p></div>
<p>You control a player and may select various camera control schemes.</p>
<div id="attachment_3014" class="wp-caption aligncenter" style="width: 131px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.19.29-AM.png"><img class="size-full wp-image-3014" title="Camera Modes" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.19.29-AM.png" alt="Camera Modes" width="121" height="133" /></a><p class="wp-caption-text">Camera Modes</p></div>
<p>The AI-controlled Lenguin agents head towards various hiding spots placed on the map. New hiding spots may be placed using SHIFT + LEFT-click. They appear as blue spots on the map. Each Lenguin will head towards the nearest hiding spot. Once a Lenguin reaches a hiding spot, it will claim that spot, and other Lenguins which were seeking that spot will acquire a new target. The process repeats while there are empty hiding spots.</p>
<p>When the player comes into an agent&#8217;s line of sight, the agent will flee away from it. If the player is able to tag the agent, it freezes in place.</p>
<div id="attachment_3015" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.29.09-AM.png"><img class="size-medium wp-image-3015" title="Frozen Lenguin" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.29.09-AM-300x264.png" alt="Frozen Lenguin" width="300" height="264" /></a><p class="wp-caption-text">Frozen Lenguin</p></div>
<p>Non-frozen Lenguin agents will attempt to tag the closest frozen agent. If the tag happens, the Lenguin is unfrozen. The game ends when the player freezes all the agents. Then, the game restarts and play continues.</p>
<div id="attachment_3016" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.37.27-AM.png"><img class="size-medium wp-image-3016" title="Game Field" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-12.37.27-AM-300x295.png" alt="Game Field" width="300" height="295" /></a><p class="wp-caption-text">Game Field</p></div>
<h2>Demo Video</h2>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/zht6KOkMeHI?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zht6KOkMeHI?version=3" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>Downloads</h2>
<ul>
<li>Source &#8211; will be available someday, when I am done the program</li>
<li><a href="http://dl.dropbox.com/u/4073777/angelforge/cis564_game_design_hw7_astar.app.zip">OSX Universal (13.1 MB)</a></li>
<li><a href="http://dl.dropbox.com/u/4073777/angelforge/cis564_game_design_hw7_astar.exe.zip">Win 32-bit (3.1 MB)</a></li>
</ul>
<h2>Progress Log</h2>
<p>Here&#8217;s a progress log that I started but neglected to finish:</p>
<ul>
<li>Started work on A* algorithm  20100625 10:00 AM.</li>
<li>A* code written but untested  1:00 PM.</li>
<li>Difficulties debugging. An hour lost trying to setup some sort of debugging via Igloo.  3:00 PM.</li>
<li>Formal debugging abandoned. A* code rewritten to be more clear using a AStarNode class 6:00 PM</li>
<li>Started to test A* code with new class approach 6:00 PM</li>
<li>Debugging slow and awkward. Results written to file. 8:00 PM</li>
<li>Code finally works without sigaborts by eliminating pointer issues. More debugging. Logs seem to be increasing exponentially for some reason. 10:00 PM</li>
<li>Debugging problem fixed. Stringstream used for debugging was not cleared each time it was used, resulting in exponential increase in log size. Lenguins move but in wrong direction. 11:30 PM</li>
<li>In a stroke of insight, I try reversing the condition used in the priority queue (the A* open list). Things magically work after that. 20110626 12:30 AM</li>
<li>More testing, creation of mazes, videos, showing path finding. Implemented code sent by TA to prevent agents stuck on obstacles. 2:00 AM</li>
<li>Work started on camera and player actions 12:30 PM</li>
<li>Issue with third-person control resolved by raising player slightly above map. Issue with camera enabling resolves player control with perspective camera. Mario-style camera hooked up to player. 2:15 PM</li>
<li>Got freeze behavior working along with some game mechanics. There are some issues with collisions. 3:45 PM</li>
<li>And then I stopped keeping track&#8230;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/pathfinding-hide-and-seek-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Behavioral Animation Project</title>
		<link>http://www.angelforge.org/wordpress/programming/software/behavioral-animation-project/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/behavioral-animation-project/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 12:00:11 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[behavioral animation]]></category>
		<category><![CDATA[flocking]]></category>
		<category><![CDATA[Lenguins]]></category>
		<category><![CDATA[steering behaviors]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2987</guid>
		<description><![CDATA[My most recent assignment for the Game Design class I&#8217;m taking is to implement some behavioral animation steering behaviors. The task was to implement steering behaviors such as: seek, flee, separation, avoid, follow the leader, and flocking. We were provided a framework featuring Lenguin characters and a menu like this: and entry points to call [...]]]></description>
			<content:encoded><![CDATA[<p>My most recent assignment for the Game Design class I&#8217;m taking is to implement some behavioral animation steering behaviors. The task was to implement steering behaviors such as: seek, flee, separation, avoid, follow the leader, and flocking.</p>
<p>We were provided a framework featuring Lenguin characters</p>
<div id="attachment_2988" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/06/Screen-shot-2011-06-24-at-11.15.19-PM.png"><img class="size-medium wp-image-2988" title="A gaggle of lenguins" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/06/Screen-shot-2011-06-24-at-11.15.19-PM-300x270.png" alt="A gaggle of lenguins" width="300" height="270" /></a><p class="wp-caption-text">A gaggle of lenguins</p></div>
<p>and a menu like this:</p>
<div id="attachment_2989" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/06/Screen-shot-2011-06-24-at-11.15.02-PM.png"><img class="size-medium wp-image-2989" title="Steering behavior menu" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/06/Screen-shot-2011-06-24-at-11.15.02-PM-300x29.png" alt="Steering behavior menu" width="300" height="29" /></a><p class="wp-caption-text">The in-game menu to choose steering behaviors</p></div>
<p>and entry points to call a C++ dll that would return force and torque vectors given agent properties and world data. It was a really interesting exercise, and it&#8217;s always tricky and fun implementing algorithms. One of the more difficult ones was the avoid behavior, which allows agents to go around obstacles</p>
<div id="attachment_2990" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2011/06/Screen-shot-2011-06-24-at-11.20.28-PM.png"><img class="size-medium wp-image-2990" title="Lenguins avoiding obstacles while seeking" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/06/Screen-shot-2011-06-24-at-11.20.28-PM-300x300.png" alt="Lenguins avoiding obstacles while seeking" width="300" height="300" /></a><p class="wp-caption-text">Lenguins avoiding obstacles while seeking</p></div>
<p>This is done by detecting a collision with an object, and adding a tangential velocity to the agent&#8217;s current velocity, allowing it to walk around an object, hugging its radius. This was both an exercise in implementing algorithms and using Unity&#8217;s native plugin capability. Although the Framework was provided for Visual Studio, it was fairly straightforward to port it to XCode, and Unity allows OSX users to compile native plugins into Bundles.</p>
<p>One of the weirdest things I found is when I went to port my XCode c++ back to Visual Studio, I was getting crazy velocities back. It took me a couple hours to discover that the default constructors for the vec3 structures, which store the values in a float array, did not initialize the array values. It&#8217;s odd because this worked fine on XCode/OSX, and I&#8217;m wondering if XCode did something special with the array values, like initialize them to 0.</p>
<p>Here&#8217;s a short video of the Lenguins in action:</p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/nmFGMYFaNk0?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/nmFGMYFaNk0?version=3" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Here are links to executables if you&#8217;re interesting in trying yourself. Use ctrl-click to move the target, and click on the Behavior menu to change the behavior.</p>
<ul>
<li><a title="OSX Universal Binary" href="http://dl.dropbox.com/u/4073777/angelforge/cis564_game_design_hw5.app.zip">OSX Universal (12.7 MB)</a></li>
<li><a href="http://dl.dropbox.com/u/4073777/angelforge/cis564_game_design_hw5.exe.zip">Win 32-bit (3.1 MB)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/behavioral-animation-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Innovation Tournament</title>
		<link>http://www.angelforge.org/wordpress/programming/software/innovation-tournament/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/innovation-tournament/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 12:00:24 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[foursquare]]></category>
		<category><![CDATA[free lottery]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[lottery]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[social storefront]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[yelp]]></category>
		<category><![CDATA[youtube]]></category>
		<category><![CDATA[youtube api]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2863</guid>
		<description><![CDATA[This week I was in San Francisco participating in a Wharton class about innovation. We had a week to sort through various ideas for web products and create a prototype. I worked on two projects. One is a lottery site, with a simple demo available. I got to use the Youtube API for playing a [...]]]></description>
			<content:encoded><![CDATA[<p>This week I was in San Francisco participating in a Wharton class about innovation. We had a week to sort through various ideas for web products and create a prototype. I worked on two projects. One is a lottery site, with a <a href="http://angelforge.org/lottery">simple demo available</a>. I got to use the Youtube API for playing a video and then performing some action upon completion. It was Â a little clunky to get setup, but afterwards worked flawlessly.</p>
<p>The other was an idea for a social dashboard for restaurants to keep them up to date with the latest reviews on sites like FourSquare and Yelp. I worked with a great programmer named Sean, who worked mostly on integrating the 3rd-party APIs. It was a Rails app that we pushed to Heroku.
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxd/' title='Social Store Front Splash'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxd-150x150.png" class="attachment-thumbnail" alt="Social Store Front Splash" title="Social Store Front Splash" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxe/' title='Social Storefront - Dashboard Various APIs'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxe-150x150.png" class="attachment-thumbnail" alt="Social Storefront - Dashboard Various APIs" title="Social Storefront - Dashboard Various APIs" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxg/' title='Social Storefront - Analytics (Highcharts)'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxg-150x150.png" class="attachment-thumbnail" alt="Social Storefront - Analytics (Highcharts)" title="Social Storefront - Analytics (Highcharts)" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxh/' title='Social Storefront - Chatter View'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxh-150x150.png" class="attachment-thumbnail" alt="Social Storefront - Chatter View" title="Social Storefront - Chatter View" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxi/' title='Social Storefront - Follow Up Screen'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxi-150x150.png" class="attachment-thumbnail" alt="Social Storefront - Follow Up Screen" title="Social Storefront - Follow Up Screen" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxn/' title='Lottery Page - Video Ad (Youtube)'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxn-150x150.png" class="attachment-thumbnail" alt="Lottery Page - Video Ad (Youtube)" title="Lottery Page - Video Ad (Youtube)" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/769277-213201160637am/' title='Lottery Page'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/769277-213201160637am-150x150.png" class="attachment-thumbnail" alt="Lottery Page" title="Lottery Page" /></a>
<a href='http://www.angelforge.org/wordpress/programming/software/innovation-tournament/attachment/8vxu/' title='Lottery - Numbers Selected'><img width="150" height="150" src="http://www.angelforge.org/wordpress/wp-content/uploads/2011/02/8Vxu-150x150.png" class="attachment-thumbnail" alt="Lottery - Numbers Selected" title="Lottery - Numbers Selected" /></a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/innovation-tournament/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Local Maxima in Edge Detection</title>
		<link>http://www.angelforge.org/wordpress/programming/software/local-maxima-in-edge-detection/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/local-maxima-in-edge-detection/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 12:00:16 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[computer vision]]></category>
		<category><![CDATA[edge detection]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2754</guid>
		<description><![CDATA[I&#8217;ve been working on some homework for computer vision. It&#8217;s such an interesting class because of how rich the visualization of my code results can be. Matlab has also been a real pleasure to work with. Everything is well documented and the IDE has features I haven&#8217;t seen in other IDEs. I am working on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on some homework for computer vision. It&#8217;s such an interesting class because of how rich the visualization of my code results can be. Matlab has also been a real pleasure to work with. Everything is well documented and the IDE has features I haven&#8217;t seen in other IDEs. I am working on an assignment in edge detection.</p>
<p>There are several steps required including performing a convolution of the image with with the derivative of the Gaussian, determining the magnitude of the gradient, and using it to find local maxima (in terms of intensity) of the image. That&#8217;s the part I&#8217;m at right now. Instead of using the x and y components of the gradient to compute edge orientation, I just determine local maxima by querying all the pixel neighbors of each pixel. This was quicker and helped me to make sure my code worked. Here&#8217;s the magnitude of the gradient of the image and the local maxima as computed by my algorithm. They&#8217;re very bad points for edge detection, but I&#8217;m happy I get something resembling the shapes of the image! One step at a time.</p>
<p style="text-align: center;"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2010/09/localmaxima.png"><img class="aligncenter size-full wp-image-2755" title="localmaxima" src="http://www.angelforge.org/wordpress/wp-content/uploads/2010/09/localmaxima.png" alt="" width="517" height="660" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/local-maxima-in-edge-detection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Matlab&#8217;s Image Edge Detection</title>
		<link>http://www.angelforge.org/wordpress/programming/software/matlabs-image-edge-detection/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/matlabs-image-edge-detection/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 00:14:32 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[canny]]></category>
		<category><![CDATA[computer vision]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/uncategorized/matlabs-image-edge-detection/</guid>
		<description><![CDATA[I&#8217;ve been doing some homework for Computer Vision class. Matlab apparently has extensive image processing capabilities. One handy function is &#8220;edge&#8221; which will return a zero-filled matrix with 1s corresponding to edges.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some homework for Computer Vision class. Matlab apparently has extensive image processing capabilities. One handy function is &#8220;edge&#8221; which will return a zero-filled matrix with 1s corresponding to edges.</p>
<div id="attachment_2739" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2010/09/edge_detection_matlab.png"><img class="size-medium wp-image-2739" title="Matlab Edge Detection" src="http://www.angelforge.org/wordpress/wp-content/uploads/2010/09/edge_detection_matlab-300x181.png" alt="The picture shows the results of using various types of edge detection." width="300" height="181" /></a><p class="wp-caption-text">From left to right, top to bottom, the methods of edge detection are: Sobel, Prewitt, Laplacian of Gaussian, Canny, Roberts, and Zero-cross</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/matlabs-image-edge-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Word Jumble Game: Part 5</title>
		<link>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-5/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-5/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 03:23:08 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[word game]]></category>
		<category><![CDATA[word jumble]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2394</guid>
		<description><![CDATA[I used jQuery for the UI. I am a recent convert to jQuery, having mostly used Prototype + Scriptaculous. The word list is embedded into the page script as a javascript array. On document ready, html is generated, which writes the first and last word to the page, and creates blank input boxes for the [...]]]></description>
			<content:encoded><![CDATA[<p>I used jQuery for the UI. I am a recent convert to jQuery, having mostly used Prototype + Scriptaculous.</p>
<p>The word list is embedded into the page script as a javascript array. On document ready, html is generated, which writes the first and last word to the page, and creates blank input boxes for the intermediate words.</p>
<p>There is a keyup event bound on each input box, which will determine if the word is correct. If it is, a css class will be added which shows a green underline underneath the box. Otherwise, a red underline will be shown.</p>
<p>Finally, there are buttons on the page which are created dynamically and provides hints or reveal all of the answers.</p>
<div id="attachment_2395" class="wp-caption aligncenter" style="width: 254px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2010/03/wordjumble21.png"><img class="size-full wp-image-2395" title="Word Jumble Filled" src="http://www.angelforge.org/wordpress/wp-content/uploads/2010/03/wordjumble21.png" alt="Word Jumble Filled" width="244" height="425" /></a><p class="wp-caption-text">Word Jumble Filled</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Word Jumble Game: Part 4</title>
		<link>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-4/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-4/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 02:23:07 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[word game]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2392</guid>
		<description><![CDATA[Search The problem of generating the chain of clues is a simple search problem. In this case, depth-first search was used, because the algorithm would attempt path depth-wise and only explore another branch if the generated chain was not long enough. Another tactic would have been to use a breadth first search. To use breadth-first [...]]]></description>
			<content:encoded><![CDATA[<h2><span>Search</span></h2>
<p>The problem of  generating the chain of clues is a simple search problem. In this case,  depth-first search was used, because the algorithm would attempt path  depth-wise and only explore another branch if the generated chain was  not long enough.</p>
<p>Another tactic would have been to use a breadth  first search. To use breadth-first search, we could have modified the  regex pattern to find all words that differed from the base word by just  one letter.</p>
<p>Using water as the base word, that regular  expression looks something like: <strong>/([^w]ater|w[^a]ter|wa[^t]er|wat[^e]r|wate[^r])/</strong>.  This would find all words in the dictionary that differed by one word  (let&#8217;s call this word set B).</p>
<p>If we were using breadth-first  search, we would then repeat the process with all of the words we just  found (word set B).</p>
<p>If you were to visualize the difference  between breadth-first and depth-first search, breadth-first would look  like a tree with wide but shallow roots. Depth-first search would look  like a tree with few but deep roots.</p>
<h2><span>Query Params</span></h2>
<p>The flexibility of the puzzle is  enhanced by optional query parameters that may be applied. The <strong>word </strong>param  allows specification of the starting or seed word. The <strong>length </strong>param  specifies the maximum length of the puzzle.</p>
<h2><span>Recursion</span></h2>
<p>The program uses  recursion to perform the search. This almost goes without saying, for it  is difficult to do general search without recursion (although you could  do so with macros and similar programming constructs). Search may be  done using loop control structures but I can&#8217;t imagine an elegant  solution using loops.</p>
<p>The pseudocode for the recursion is  basically:</p>
<pre class="brush: jscript; title: ; notranslate">
function build(baseWord, chainWords, maxLength)

    regex = generateRandomRegex(baseWord)
    wordSetB = getPossibleWords(regex, notIn=chainWords)
    for(word in wordSetB)

        chain = build(word, chainWords+word, maxLength)
        if Length(chain) &gt;= maxLength

            break

    return chain
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Word Jumble Game: Part 3</title>
		<link>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-3/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-3/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 15:17:47 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[word game]]></category>
		<category><![CDATA[word jumble]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2365</guid>
		<description><![CDATA[The first thing I did was made sure that the word list would be cached on application start. This was as simple as creating an Application.cfc cfcomponent and implementing the onApplicationStart function.Â  This function reads the dictionary in (described in the last entry) and caches the word list in a ColdFusion array. There are other [...]]]></description>
			<content:encoded><![CDATA[<p>The first thing I did was made sure that the word list would be cached  on application start. This was as simple as creating an Application.cfc  cfcomponent and implementing the onApplicationStart function.Â  This  function reads the dictionary in (described in the last entry) and  caches the word list in a ColdFusion array. There are other options for  storing this data, but this had the best mix of speed and function  considering the method of search I wanted to use against it.</p>
<p>Although  the dictionary was only 52K, this caching probably helped performance a  great deal.</p>
<p>To generate the word list, I decided on the  following algorithm:</p>
<ol>
<li>Choose an initial starting word (at  random, or via user entry)</li>
<li>Use the word to generate a regular  expression.<br />
Replace a random single letter with the Regex pattern  [^L] (where L is the letter you have replaced).</p>
<p>Example:</p>
<p>word:  water<br />
regex: w[^a]ter</li>
<li>Next, iterate through all of the  words, testing each word against the regular expression. Store all  matches.</li>
<li>With each match, one-by-one, repeat Step 2 until we get  a chain of N words. (Where N is the maximum length of the chain.)</li>
<li>Obviously,  if we have no more matches, we stop. If we have at least a 3-word  chain, we can use it.</li>
</ol>
<p>There are a few considerations not  discussed above in generating the puzzle:</p>
<ul>
<li>If we match a word  that is already in the chain, we should ignore that word to avoid  duplicates.</li>
<li>Not implemented: we should not replace a letter in  the same position twice. For example, if we replace the &#8220;w&#8221; in water,  don&#8217;t replace the &#8220;h&#8221; hater (if hater is the 2nd word).</li>
<li>Depth-first  versus Breadth-first searching&#8230;to be discussed</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Word Jumble Game: Part 2</title>
		<link>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-2/</link>
		<comments>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-2/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 15:12:55 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[word game]]></category>
		<category><![CDATA[word jumble]]></category>

		<guid isPermaLink="false">http://www.angelforge.org/wordpress/?p=2359</guid>
		<description><![CDATA[In my last entry, I described the concept behind the Word Jumble game. In this entry, I will describe initial steps in creating the game. Firstly, I needed some dictionary of words. The Unix flavors have built-in dictionaries, and I develop on OSX, so I Googled the location of its dictionary: I knew I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>In my last entry, I described the concept behind the Word Jumble game.   In this entry, I will describe initial steps in creating the game.</p>
<p>Firstly, I needed some dictionary of words. The Unix flavors have  built-in dictionaries, and I develop on OSX, so I Googled the location  of its dictionary:</p>
<pre class="brush: bash; title: ; notranslate">
/usr/share/dict/words
</pre>
<p>I knew I wanted to do puzzles of only 5-letter words, so I used the</p>
<pre class="brush: bash; title: ; notranslate">grep</pre>
<p>command to create a file of just these words.</p>
<pre class="brush: bash; title: ; notranslate">
grep ^.....$ /usr/share/dict/words &gt; dictionary-5letterwords.txt
</pre>
<p>Notice the regular expression I used. I wanted to demonstrate an actual  use of regular expressions for this project. The regular expression</p>
<pre class="brush: jscript; title: ; notranslate">
/^.....$/
</pre>
<p>says to match a line of just 5 characters. The period means to match  any character. I made the assumption that there would be no words in the  dictionary with a space or other punctuation&#8211;although that was,  perhaps, a faulty assumption.</p>
<p>Next, I started working on the code. Since we use mostly ColdFusion at  Wharton, that&#8217;s what I wrote the app in.</p>
<div id="attachment_2383" class="wp-caption aligncenter" style="width: 254px"><a href="http://www.angelforge.org/wordpress/wp-content/uploads/2010/03/wordjumble2.png"><img class="size-full wp-image-2383" title="Word Jumble Filled" src="http://www.angelforge.org/wordpress/wp-content/uploads/2010/03/wordjumble2.png" alt="Word Jumble Filled" width="244" height="425" /></a><p class="wp-caption-text">Word Jumble Filled</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.angelforge.org/wordpress/programming/software/word-jumble-game-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

