<?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>Stuart Hacking</title>
	<atom:link href="http://stuarthacking.com/wordpress/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://stuarthacking.com/wordpress</link>
	<description></description>
	<lastBuildDate>Fri, 03 Sep 2010 15:40:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Rest in peace, ClickWheel</title>
		<link>http://stuarthacking.com/wordpress/?p=274</link>
		<comments>http://stuarthacking.com/wordpress/?p=274#comments</comments>
		<pubDate>Fri, 03 Sep 2010 14:24:11 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[clickwheel]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=274</guid>
		<description><![CDATA[Apple have unveiled the shiny new iPod Nano range and they are sexy! Half the size of the previous model and sporting the same screen technology as the touch devices. Wonderful! What I find surprising, though, is how many of my technically adept colleagues seem to be disgusted (or at least perturbed) at the disappearance [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">Apple have unveiled the shiny new iPod Nano range and they are sexy! Half the size of the previous model and sporting the same screen technology as the touch devices. Wonderful!</p>
<p><a href="http://www.apple.com/uk/ipodnano/"><img title="New iPod Nano" src="http://images.apple.com/euro/ipodnano/images/design_hero20100901.jpg" alt="New iPod Nano" width="474" height="203" /></a></p>
<p>What I find surprising, though, is how many of my technically adept colleagues seem to be disgusted (or at least perturbed) at the disappearance of the ClickWheel.</p>
<p>Don&#8217;t get me wrong: The ClickWheel was a marvellous idea and worked really well&#8230; five years ago. It was a solution to the problem of providing a sleek touch based scrolling interface in the days before cheap multi-touch screens. This was also the time when the big iPods needed to fit a mechanical hard disk in the back &#8211; so there was this area on the face that needed to be filled with something eye-catching. Yes, the ClickWheel was great- I&#8217;ll continue to use one until my 30GB iPod Video decides to die.</p>
<p>But it&#8217;s 2010 now. We have solid state drives that can cram tons of information into a really tiny space. We have multi-touch interfaces that are just really beautiful and slick to use. Let&#8217;s enjoy the memories we shared with the ClickWheel as we lay it to rest and look forward to new innovations to come. Live in the now.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=274</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outlook not so good.</title>
		<link>http://stuarthacking.com/wordpress/?p=271</link>
		<comments>http://stuarthacking.com/wordpress/?p=271#comments</comments>
		<pubDate>Mon, 16 Aug 2010 12:25:00 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=271</guid>
		<description><![CDATA[An important person in the company (all praise the company!) has just attempted to send me an updated security certificate by email. Oh, no, no, no, my friend! Surely you know that I&#8217;m running Micros~1 Outlook as my office mail client? You see: Outlook knows what&#8217;s good for you, and apparently, security certificates are not. [...]]]></description>
			<content:encoded><![CDATA[<p>An important person in the company (all praise the company!) has just attempted to send me an updated security certificate by email.</p>
<p><em>Oh, no, no, no, my friend! Surely you know that I&#8217;m running Micros~1 Outlook as my office mail client?</em></p>
<p>You see: Outlook knows what&#8217;s good for you, and apparently, security certificates are not. Indeed, Outlook will not allow me to access this file, or even give me the option of &#8220;Don&#8217;t worry, I know what I&#8217;m doing.&#8221;</p>
<p>[Here's a fun fact: The certificate was *sent* *using* *Outlook*. So, Outlook will happily send files that it deems to be unsafe, but the poor sap on the other end won't get to use it.]</p>
<p>Now, I tend to place a degree of value on others&#8217; time. So it pains me to have to reply to someone saying &#8220;Hi, Outlook won&#8217;t let me open your attachment. Can you jump through hoops X, Y, Z to get it to me?&#8221;</p>
<p>Outlook used to simply be a poor email client. Now it has become actively counterproductive.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=271</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWT &#8220;Event model&#8221;</title>
		<link>http://stuarthacking.com/wordpress/?p=267</link>
		<comments>http://stuarthacking.com/wordpress/?p=267#comments</comments>
		<pubDate>Tue, 06 Jul 2010 08:59:04 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=267</guid>
		<description><![CDATA[Have a look at this documentation for a VerifyEvent in SWT: void VerifyListener() {&#8230;}.verifyText(VerifyEvent e) Sent when the text is about to be modified. A verify event occurs after the user has done something to modify the text (typically typed a key), but before the text is modified. The doit field in the verify event [...]]]></description>
			<content:encoded><![CDATA[<p>Have a look at this documentation for a VerifyEvent in SWT:</p>
<p><em>void VerifyListener() {&#8230;}.verifyText(VerifyEvent e)<br />
Sent when the text is about to be modified. </em></p>
<p><em>A verify event occurs after the user has done something to modify the text (typically typed a key), but before the text is modified. The doit field in the verify event indicates whether or not to modify the text.</em></p>
<p>Wait, what?</p>
<p>What we basically want is a simple predicate function that returns <em>true </em>if the Contents of a Text Field are still valid after a change. What SWT gives us is this awkward event model where we have to modify the event that has just been generated. (In my opinion, events should be immutable, since they represent a historical occurence.) Next SWT will have a peek in the event to see how to proceed.</p>
<p>SWT is full of weird <a href="http://catb.org/jargon/html/B/bagbiter.html">bagbiters</a> like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=267</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>while true: Compile; Run; Debug</title>
		<link>http://stuarthacking.com/wordpress/?p=264</link>
		<comments>http://stuarthacking.com/wordpress/?p=264#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:30:48 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=264</guid>
		<description><![CDATA[The more I go through this cycle the more it amazes me that this is the development paradigm that won out. That back in the golden era people sat down and decided that this was the model of the future. For large applications it&#8217;s a major pain &#8211; much time spent compiling, starting up the [...]]]></description>
			<content:encoded><![CDATA[<p>The more I go through this cycle the more it amazes me that this is the development paradigm that won out. That back in the golden era people sat down and decided that this was the model of the future.</p>
<p>For large applications it&#8217;s a major pain &#8211; much time spent compiling, starting up the program anew and returning it to the state you need in order to test your latest fix. Even for a fairly trivial change or a bit of experimentation, this is a huge timesink.</p>
<p>And yet there is an alternative approach &#8211; incremental compilation, à la Lisp. When the Lisp environment hits a bug it pauses. It shows you the location of the bug, it gives you a full stack trace at the time of breakage. You can inspect just about everything. Here&#8217;s the kicker: you can fix the code while the debugger is waiting. Then you can load that fixed code right back into the running program and continue on your merry way.</p>
<p>Let me repeat that last bit: You compile only the code that needed fixed and load it into the running program. The running program then continues using the new code. No stopping, compiling, running, getting back to where you were, debugging.</p>
<p>This is special. It&#8217;s not even that new. Lot&#8217;s of hip, young, dynamic languages are attempting to copy it. Let&#8217;s now, in 2010, make an attempt to catch up to the technology of 50 years ago. We owe the founding hackers that much, right?</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=264</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse Development Lossitude</title>
		<link>http://stuarthacking.com/wordpress/?p=261</link>
		<comments>http://stuarthacking.com/wordpress/?p=261#comments</comments>
		<pubDate>Fri, 28 May 2010 13:44:27 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=261</guid>
		<description><![CDATA[Here are two things about Eclipse which recently annoyed me. (I imagine it&#8217;s Eclipse&#8217;s fault, I guess It may be Java&#8217;s.) 1) When you reach an exceptional condition, the correct response in debug mode is to freeze the program and allow the developer a chance to inspect the current state. Stack, Heap, location, all that [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two things about Eclipse which recently annoyed me. (I imagine it&#8217;s Eclipse&#8217;s fault, I guess It may be Java&#8217;s.)</p>
<p>1) When you reach an exceptional condition, the correct response in debug mode is to freeze the program and allow the developer a chance to inspect the current state. Stack, Heap, location, all that good stuff.</p>
<p>Throwing your arms in the air, screaming bloody murder and throwing away all the useful information when an error occurs is not useful. It turns debugging java into a game of &#8220;How close can you get to an error, without actually reaching the error.&#8221;</p>
<p>If you reach the error you lose the game, along with any useful data that might help you fix it.</p>
<p>2) You only seem to allow me to put breakpoints on lines on code. This implies that I already know where an error is. If I did, I&#8217;d probably fix it.</p>
<p>Why can&#8217;t you let me break on more useful things like when a particular variable has a particular value. This is similar to the previous point where I don&#8217;t want the program to drop everything and run away before I can look into it.</p>
<p>3) In 2010, the best way to debug a Java program is to pepper it with Print statements. This is sad.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=261</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress Lossage</title>
		<link>http://stuarthacking.com/wordpress/?p=244</link>
		<comments>http://stuarthacking.com/wordpress/?p=244#comments</comments>
		<pubDate>Fri, 14 May 2010 15:43:55 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=244</guid>
		<description><![CDATA[The latest update seems to have screwed up some plug-ins. Most notably the collapsible archives and source code highlighting. Hopefully this is only temporary.]]></description>
			<content:encoded><![CDATA[<p>The latest update seems to have screwed up some plug-ins. Most notably the collapsible archives and source code highlighting.</p>
<p>Hopefully this is only temporary.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=244</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fibonacci Optimisation</title>
		<link>http://stuarthacking.com/wordpress/?p=237</link>
		<comments>http://stuarthacking.com/wordpress/?p=237#comments</comments>
		<pubDate>Thu, 06 May 2010 00:01:59 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[memoization]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=237</guid>
		<description><![CDATA[Just some stuff I thought about today. Here&#8217;s a fibonacci function expressed in Lisp: &#40;defun fibonacci &#40;n&#41; &#160; &#40;if &#40;&#60;= n 1&#41; &#160; &#160; &#160; &#160;n &#160; &#160; &#160; &#160;&#40;+ &#40;fibonacci &#40;- n 1&#41;&#41; &#40;fibonacci &#40;- n 2&#41;&#41;&#41;&#41;&#41; It can be used to compute the fibonacci sequence: =&#62; &#40;mapcar #&#8217;fibonacci &#8216;&#40;1 2 3 4 5 [...]]]></description>
			<content:encoded><![CDATA[<p>Just some stuff I thought about today.  Here&#8217;s a fibonacci function expressed in Lisp:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#40;</span><span class="kw1">defun</span> fibonacci <span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#40;</span><span class="kw1">if</span> <span class="br0">&#40;</span>&lt;= n <span class="nu0">1</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;n</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span>+ <span class="br0">&#40;</span>fibonacci <span class="br0">&#40;</span>- n <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>fibonacci <span class="br0">&#40;</span>- n <span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> </div>
</li>
</ol>
</div>
<p>It can be used to compute the fibonacci sequence:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">=&gt; <span class="br0">&#40;</span><span class="kw1">mapcar</span> #&#8217;fibonacci &#8216;<span class="br0">&#40;</span><span class="nu0">1</span> <span class="nu0">2</span> <span class="nu0">3</span> <span class="nu0">4</span> <span class="nu0">5</span> <span class="nu0">6</span> <span class="nu0">7</span> <span class="nu0">8</span> <span class="nu0">9</span> <span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#40;</span><span class="nu0">1</span> <span class="nu0">1</span> <span class="nu0">2</span> <span class="nu0">3</span> <span class="nu0">5</span> <span class="nu0">8</span> <span class="nu0">13</span> <span class="nu0">21</span> <span class="nu0">34</span> <span class="nu0">55</span><span class="br0">&#41;</span> </div>
</li>
</ol>
</div>
<p>It&#8217;s simplicity is elegant, but, frightfully inefficient. In fact, the recursive definition of <em>fibonacci</em> is often used as an example of an inefficient method. Let&#8217;s look at why it&#8217;s poor. When fibonacci is called for a value of <em>n</em> there are two possible paths the program can take:</p>
<ol>
<li>If n &lt;= 1 give back the value of n</li>
<li>otherwise return the sum of the previous two numbers in the sequence</li>
</ol>
<p>So, if n is 0 or 1 then the value is simply 0 or 1 respectively. This is the <em>base case</em> of the function. In other words, from this piece of concrete knowledge, we can derive the remaining values.  If n is any value higher than 1, then we need to actually compute what it is. Notice that this case requires <em>fibonacci</em> to be called another two times.</p>
<p>This imposes significant overhead on the machine. In addition to this, the results of these two function calls must be added together. That means we need to hold onto some space in memory to store the results. Simplistically, we refer to the number of significant function calls as the time complexity of the program, and the amount of memory required as the space complexity. <em>Fibonacci</em> sure is expensive.</p>
<p>Anyway, this got me to thinking. What is the main problem with fibonacci? It&#8217;s the fact that it must repeat a lot of its calculations. If we want to find the value of <em>Fib(5)</em>, we must call <em>Fib(4)</em> and <em>Fib(3)</em>. But wait: To find the value of <em>Fib(4)</em> we must call <em>Fib(3)</em>. Hence, we do the same operation twice. What if we could tell the program to <em>remember</em> a value once it had been found? Wouldn&#8217;t this speed things up? Can this be done without sacrificing the simplicity of a recursive method?</p>
<p>Here&#8217;s a modified, partial fibonacci function:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#40;</span><span class="kw1">defun</span> hashed-fibonacci <span class="br0">&#40;</span>n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#40;</span>defvar fib-lookup <span class="br0">&#40;</span>make-hash-table<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#40;</span><span class="kw1">let</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>val <span class="br0">&#40;</span>gethash n fib-lookup<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#40;</span><span class="kw1">cond</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw1">not</span> <span class="br0">&#40;</span><span class="kw1">equal</span> val <span class="kw1">nil</span><span class="br0">&#41;</span><span class="br0">&#41;</span> val<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#40;</span><span class="br0">&#40;</span>&lt;= n <span class="nu0">1</span><span class="br0">&#41;</span> n<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#40;</span>t <span class="br0">&#40;</span><span class="kw1">let</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>new-val <span class="br0">&#40;</span>+ <span class="br0">&#40;</span>hashed-fibonacci <span class="br0">&#40;</span>- n <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>hashed-fibonacci <span class="br0">&#40;</span>- n <span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span><span class="kw1">progn</span> <span class="br0">&#40;</span>puthash n fib-lookup <span class="kw1">nil</span> new-val<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new-val<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> </div>
</li>
</ol>
</div>
<p>This one is a little more involved, but don&#8217;t panic: It still does the same thing, in much the same way.  It has an extra trick though: Before it attempts to compute the value of <em>n</em>, it check to see if it already has a value. It looks in a structure called a hash table (any type of lookup table should do). Think of this like a telephone directory. If you know someone&#8217;s name, you can look it up in a phone directory and it will tell you their number. In our hash table, if you know a value of <em>n</em>, you can look it up and find its <em>fibonacci</em> value.   Of course, some fibonacci values won&#8217;t be listed just yet.  If there is no value in the table, we continue with our normal process: If <em>n &lt;= 2</em> then return 1. If n is greater than 2 then we find it&#8217;s value by adding the previous 2 fibonacci numbers. Now we have one more change to make: Having just found this new value of <em>Fib(n)</em> we store it in the hashtable. This means we won&#8217;t have to do the hard work of finding it again later &#8211; It&#8217;s already there!</p>
<p>Now, this act of remembering our previous work means that we must use a bit more memory, but the gain is a remarkable improvement in speed. Today, memory is pretty cheap, so this is not a bad thing.  Look at the method we used. We start with a function that must call itself with a smaller value in order to discover a new value. When we discover a new value, we store it in a table so that we can quickly find it later.</p>
<p>This could most likely be generalised for any function that follows this pattern.  There&#8217;s another blog post for when I get time to look into that aspect of it. If this post was about the optimisation, the next will be about abstracting that into a common pattern.</p>
<p>I hope this was of some interest. It was just a little thing I thought about this afternoon then decided to try it out. After I tried it I thought it might make a quick, informal blog entry.    <strong></strong></p>
<p><strong>Update: </strong>It seems that I have inadvertently stumbled across the definition of <em>memoization </em>which was conceived in 1968<em>! </em>It&#8217;s fun to try something out and then learn about a formal definition of the same principle. The act of developing an example gives it more meaning. (Further reading: http://en.wikipedia.org/wiki/Memoization).</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=237</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Games: Math vs. Story</title>
		<link>http://stuarthacking.com/wordpress/?p=234</link>
		<comments>http://stuarthacking.com/wordpress/?p=234#comments</comments>
		<pubDate>Sun, 04 Apr 2010 23:49:10 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Self]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=234</guid>
		<description><![CDATA[It&#8217;s not a great title but none of the other drafts I came up with were any better&#8230; I&#8217;ve been thinking recently (and informally) about a schism in game design that seems to be developing. I think in part it&#8217;s due to the seeming rise in popularity of Role Playing elements within games. When I [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not a great title but none of the other drafts I came up with were any better&#8230;</p>
<p>I&#8217;ve been thinking recently (and informally) about a schism in game design that seems to be developing. I think in part it&#8217;s due to the seeming rise in popularity of Role Playing elements within games. When I say Role Playing elements I&#8217;m talking specifically about the idea of the player <em>assuming the role of a protagonist</em> from an early stage and gradually building that character; resulting in, for example, more powerful options during play, unlocked equipment, more locations or simply to make the character look better. This typically happens when a player has accumulated enough experience points to ascend to a new level of play. Experience points are typically accumulated by applying the skills previously unlocked. This idea has started to become more pervasive even in games not commonly associated with character building. Examples include puzzle games (<a href="http://www.infinite-interactive.com/index.php" target="_blank">Puzzle Quest</a>, <a href="http://www.puzzlepirates.com/" target="_blank">Puzzle Pirates</a>), First Person Shooters (<a href="http://www.borderlandsthegame.com/" target="_blank">Borderlands</a>, <a href="http://modernwarfare2.infinityward.com/" target="_blank">Call of Duty</a>), Racing Games (<a href="http://forzamotorsport.net/en-us/game/default.htm" target="_blank">Forza</a>, <a href="http://www.needforspeed.com/" target="_blank">Need for Speed</a>) and of course those games which are naturally Role Playing Games (<a href="http://dragonage.bioware.com/agegate/?url=%2F" target="_blank">Dragon Age</a>, <a href="http://masseffect.bioware.com/" target="_blank">Mass Effect</a>, <a href="http://www.elderscrolls.com/games/oblivion_overview.htm" target="_blank">Oblivion</a>, <a href="http://fallout.bethsoft.com/index.html" target="_blank">Fallout 3</a>, <a href="http://www.pokemon.com/us/games/gallery/" target="_blank">Pokémon</a>, &#8230;and many more). (Note: Shameless list of some of my favourite games.) For me, this additional mechanic adds a new dimension to the game: Narrative. I like stories and I like characters.</p>
<p>The observation I wish to describe is the contrast between two different ways of presenting this narrative information to the player. I don&#8217;t wish to claim that one method is more correct than the other. Although I think that there are merits and danger for each that should be considered. It is these points I wish to briefly outline. Also: I&#8217;m not an expert in this area but I do enjoy games.</p>
<p><strong>Introduction to RPG mechanics</strong></p>
<p>Originally, I included this section in the description for Case 1. As it grew, I decided it merited it&#8217;s own section. Note: Some games will use different ideas; this is only intended as an example. I&#8217;ll describe a simplified Dungeons and Dragons style method.</p>
<p>In traditional tabletop games (using pen &#038; paper, or boards) mathematical functions were devised as a way to roughly model expected outcomes of conflict/encounter. The idea was to avoid leaving everything to pure chance (dice rolls), but instead to modify the outcome of a dice roll based on the characters abilities. for example, A strong character will deal more damage, however, the range of damage is still affected by stamina and the type of armour the opponent is wearing. The dice roll itself merely introduces the idea of something going wrong, e.g. &#8220;Your character slips when swinging his weapon and only manages to graze your opponents forearm.&#8221;</p>
<p>It is not limited to performing moves in battle. Some characters in the game will have the ability to lie or persuade to gather information. These outcomes will also be based on the characters skill. Modified by the second person&#8217;s skills at detecting lies or flattery, and a chance dice roll. For example, &#8220;You attempt to impersonate a foreign diplomat to gain information&#8230;&#8221; <roll> &#8220;&#8230;however, the guard is not fooled by your accent.&#8221;</p>
<p>As your character gains experience, your chances of successfully exploiting a skill increase. On the tabletop, there was no computer to perform these calculations for you, so all of the functions where exposed to the players.</p>
<p><strong>Case 1: &#8220;The D&#038;D Method&#8221;</strong></p>
<p>Yes: I&#8217;m bad at naming but it fits with the introductory example. In this case the player is given the raw numbers: &#8220;You will do 5 points of damage per hit. Your foe has 8 points remaining.&#8221; This is demonstrated in the Pokémon series, Neverwinter Nights and Eve Online for example. This hails back to the tabletop method.</p>
<p>The benefits of having all the raw information are arguably that you can make strategic decisions by testing the mathematics in advance and your plans can be optimised by carefully adjusting the variables. The drawbacks, perhaps, are that the intended purpose of the functions &#8211; to provide a model for realism &#8211; are not achieved. i.e. The game is reduced to nothing more than balancing equations.</p>
<p><strong>Case 2: &#8220;The Once-upon-a-time Method&#8221;</strong></p>
<p>The titles get worse, but what I&#8217;m getting at here is that in this case, a lot of the raw information is hidden behind a façade which is more abstract or opaque. This tends to present in games which are more about advancing a plot than performing the precise strategic operations. Abstraction may ranges from cosmetic change (Displaying bars and graphics in place of numbers on screen) to making the game logic fuzzy (&#8220;Character is big and strong&#8221;, instead of &#8220;Character has weight 55 and strength of 60&#8243;). City of Heroes by default will show simplified hints about the underlying attributes while Mass Effect 2 gives the impression that knowing the exact power of every attack is not significant for the player.</p>
<p>The benefits here are that you can find ways to hide the games computations from the player and present them with only the experience of the characters and story progression. The player has enough information to decide how the character will develop and move from event to event but without micro-managing individual attributes. The drawback is in giving less control to the player.</p>
<p><strong>Thoughts/Conclusions</strong></p>
<p>Already? Well, this wasn&#8217;t intended to be a thoroughly detailed examination or case study. It was just putting down some thoughts into a post. At least my host will know I&#8217;m still alive.</p>
<p>If I have one concrete opinion, it&#8217;s that a computer game has the wonderful advantage of having a calculator sitting underneath it. To this end, the mathematics of the games progression shouldn&#8217;t come at the expense of immersion into the game&#8217;s world. Of course, in some games, the math is central to the objective and shouldn&#8217;t be compromised. However, for any functionality that can be delegated to the computer, the designer should attempt to make the presentation as natural for the player as possible.</p>
<p>The key challenge is finding the right balance between giving the player absolute control of the numbers and presenting the player with an abstraction of the information that is compelling as a story.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=234</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ Templates for XCode 3.2</title>
		<link>http://stuarthacking.com/wordpress/?p=229</link>
		<comments>http://stuarthacking.com/wordpress/?p=229#comments</comments>
		<pubDate>Thu, 19 Nov 2009 16:17:02 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=229</guid>
		<description><![CDATA[Here are a couple of Project templates I made for XCode 3.2. One for a WxWidgets based project (wxMac 2.8), and one for a GLUT project. Hope they work. GLUT C++ Project &#8211; Initializes GLUT and creates a scene containing a cube which can be rotated using the keyboard arrow keys. toggle an axis widget [...]]]></description>
			<content:encoded><![CDATA[<p>Here are a couple of Project templates I made for XCode 3.2. One for a WxWidgets based project (wxMac 2.8), and one for a GLUT project. Hope they work.</p>
<ul>
<li><a href="http://www.stuarthacking.com/pub/xcode/C++_GLUT_App.zip">GLUT C++ Project</a> &#8211; Initializes GLUT and creates a scene containing a cube which can be rotated using the keyboard arrow keys. toggle an axis widget using &#8216;w&#8217;, toggle fullscreen using &#8216;o&#8217; and exit using ESC. The FPS is displayed in the titlebar.</li>
<li><a href="http://www.stuarthacking.com/pub/xcode/WxWidgets_App.zip">WxWidgets C++ Project</a> &#8211; Initializes a WxWidgets based app with an empty frame.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=229</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nethack on OS X 10.6 (Snow Leopard)</title>
		<link>http://stuarthacking.com/wordpress/?p=222</link>
		<comments>http://stuarthacking.com/wordpress/?p=222#comments</comments>
		<pubDate>Fri, 13 Nov 2009 14:47:16 +0000</pubDate>
		<dc:creator>smh</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[nethack]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://stuarthacking.com/wordpress/?p=222</guid>
		<description><![CDATA[O.K. So, this is kind of a followup to a previous post I did about how I like to setup Nethack on my Mac. However, more recently, some of the patches I had used stopped working on later versions of Mac OS (10.5 and 10.6). So I spent a bit of time looking into this [...]]]></description>
			<content:encoded><![CDATA[<p>O.K. So, this is kind of a followup to a <a title="The old Nethack post" href="http://stuarthacking.com/wordpress/?p=39" target="_blank">previous post</a> I did about how I like to setup <a title="Nethack official Site" href="http://www.nethack.org" target="_blank">Nethack</a> on my Mac. However, more recently, some of the patches I had used stopped working on later versions of Mac OS (10.5 and 10.6). So I spent a bit of time looking into this today and I got some positive results. (update: I think the problem I had with Menucolor compiling was that it didn&#8217;t like the regexp method &#8211; I changed this to simply use the wildcard matching.)</p>
<div id="attachment_224" class="wp-caption aligncenter" style="width: 310px"><a href="http://stuarthacking.com/wordpress/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-14.34.00.png" rel="shadowbox[post-222];player=img;"><img class="size-medium wp-image-224 " title="Nethack with Status Colors and Menu Colors" src="http://stuarthacking.com/wordpress/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-14.34.00-300x185.png" alt="Nethack with Status Colors and Menu Colors" width="300" height="185" /></a><p class="wp-caption-text">Nethack with Status Colors and Menu Colors</p></div>
<p>Unfortunately, because the two patches I&#8217;m applying have resulting conflicts- it meant manually applying the patches to the source code in some cases (also: I&#8217;m lazy). I, therefore, don&#8217;t have an elegant method of actually applying the two patches that I can pass on. What I am doing instead is providing two things: The complete refined archive of the patched Nethack source which should be ready-to-compile on OS 10.6; And also the .diff file produced from a vanilla copy of the source and my own patched version. I will also provide my new updated nethackrc file. (ok&#8230; 3 things <img src='http://stuarthacking.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<p>Here&#8217;s some details about the setup this provides:</p>
<ol>
<li>The Status Colors patch is applied. This is a configurable patch allowing you to color code status effects &#8211; hunger, blindness, HP, Gold, AC, etc. It&#8217;s very, very cool! <img src='http://stuarthacking.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>Menucolors patch applied. This is a configurable patch that let&#8217;s you apply colors to popup menus. e.g. inventory items can be red for cursed, green for blessed, etc. Again, this patch is very neat!</li>
<li>The initial configuration for getting Nethack to build on mac has been taken care of.</li>
</ol>
<p>So Here are the links to get everything up and running. I should say at this point that this stuff works on <em>my machine</em> and YMMV. If something is broken and you want my to take a look at it just leave a comment of send an email &#8211; I&#8217;ll try to fix it if I have time. You may also want to dig through the changes in the patch.</p>
<ol>
<li><a href="http://www.stuarthacking.com/pub/nethack-3.4.3-patched.zip">nethack-3.4.3-patched.zip</a></li>
<li><a href="http://www.stuarthacking.com/pub/nh343_menustatus_orig.diff">nh343-_menustatus_orig.diff</a></li>
<li><a href="http://www.stuarthacking.com/pub/nethackrc.txt">.nethackrc</a></li>
</ol>
<p>I hope this is useful for someone who wants a nice shiny setup of Nethack on Snow Leopard. <img src='http://stuarthacking.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://stuarthacking.com/wordpress/?feed=rss2&amp;p=222</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
