<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Polymath Programmer</title>
	
	<link>http://polymathprogrammer.com</link>
	<description>Coding with both sides of the brain</description>
	<lastBuildDate>Sun, 05 Jul 2009 03:33:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/PolymathProgrammer" type="application/rss+xml" /><feedburner:emailServiceId>PolymathProgrammer</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Moving backgrounds, different speeds</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/BoOytjlKp18/</link>
		<comments>http://polymathprogrammer.com/2009/07/02/moving-backgrounds-different-speeds/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 09:00:02 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[game-development]]></category>
		<category><![CDATA[parallax scrolling]]></category>
		<category><![CDATA[perspective]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1305</guid>
		<description><![CDATA[Back when I was younger (which is an obtuse way of saying &#8220;I haven&#8217;t the friggin&#8217; idea exactly when&#8221;), I dabbled a bit in game development. There was a period when I was studying side scroller games. Remember those? The classic Super Mario Brothers was one of them.
I also noticed that in some of the [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/07/02/moving-backgrounds-different-speeds/">Moving backgrounds, different speeds</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Back when I was younger (which is an obtuse way of saying &#8220;I haven&#8217;t the friggin&#8217; idea exactly when&#8221;), I dabbled a bit in game development. There was a period when I was studying side scroller games. Remember those? The classic Super Mario Brothers was one of them.</p>
<p>I also noticed that in some of the games, the backgrounds moved. Yes, backgrounds, plural. I could understand forming a background &#8220;tile&#8221; made up of hills, clouds, trees, grass, flowers, rocks and whatever suited the game as background. But there was something, <em>else</em>, moving in the (for lack of a better word) background.</p>
<p>There was another background layer, moving at a different speed. Wait. Oh, it&#8217;s moving at a <em>slower</em> speed.</p>
<p>When I moved that little sprite (that&#8217;s representing my sole means of interacting with the game) on the screen to the right, the flowers and trees and rocks sped past to the left. But that faraway mountain was moving to the left at a slower speed. And the overall effect was a realistic simulation of 3D, a semblance of depth in an essentially 2D game.</p>
<p>Now that I think about it, I have one question. <strong>How do you calculate how slow the other background should be?</strong> I searched high and low, though I found what this effect is called (<a href="http://en.wikipedia.org/wiki/Parallax_scrolling">parallax scrolling</a>), I found no trace of any suggestion to the relative speeds between the 2 backgrounds.</p>
<p>So I did a little thinking. And drawing. I was trying to work out mathematically the slower speed, given the &#8220;distance&#8221; between the background layers (there&#8217;s practically no distance in implementation. Maybe 0.01 units&#8230;) and the speed of the background that&#8217;s &#8220;in front&#8221;.</p>
<p>It didn&#8217;t make sense, because no matter how I pivot the movement, the calculations don&#8217;t work out.</p>
<p><img src="http://polymathprogrammer.com/images/blog/200907/parallaxscrollingbackgrounds.png" width="400" height="320" alt="Parallax scrolling backgrounds" /></p>
<p>L1 and L2 are the &#8220;distances&#8221; between the respective layers. d1 and d2 are the distances from the objects in question to the perpendicular line formed by the sprite position. v1 and v2 are the velocities of the respective layers moving to the left (or right, depending on how you view this whole thing and how you define the direction&#8230; never mind).</p>
<p>The layers aren&#8217;t really separate. There is a tiny distance between the layers, say 0.01 units. If you&#8217;re in a fully 2D environment, then the farthest layer is drawn, then the next closest layer is drawn, subject to transparency to allow elements from the farthest layer to be shown, and then the playing layer is drawn (where our sprite and other objects are). There&#8217;s no distance (between the layers) to speak of in a true 2D rendering environment.</p>
<p>I started with the &#8220;<a href="http://polymathprogrammer.com/2009/03/19/stationary-camera-moving-scene/">don&#8217;t move the focus, move everything else</a>&#8221; approach, keeping the sprite in place, and moving both backgrounds to the left. This meant pivoting around the sprite. The objects drawn on the other two layers are what our sprite would see in a straight line towards somewhere forward. Those objects should coincide at the &#8220;perpendicular&#8221; line together.</p>
<p>Since the distances d1 and d2 are obviously different, therefore the velocity (or speed. I&#8217;m just trying to be scientifically correct here) of the two objects moving to the left must be different. There lies my problem. It meant the farthest object had to travel <em>faster</em>, contradicting our original observation.</p>
<p>What if we pivoted around the object in the &#8220;front&#8221; layer? The sprite moves to the right, and the object on the &#8220;back&#8221; layer moves to the left, and all three line up in a perpendicular line (perpendicular to the layers anyway). Too troublesome. Same with pivoting around the farthest object.</p>
<p>I toyed with the idea of pivoting around the <a href="http://en.wikipedia.org/wiki/Vanishing_point">vanishing point</a>. At this point (no pun intended), I decided to give up.</p>
<p>So I assumed that the background image(s) in the &#8220;back&#8221; layer are appropriately sized with respect to the &#8220;front&#8221; layer. I decided a simple ratio probably worked best. Thus we have<br />
v2 = v1 / (L1 + L2)<br />
which should give an appropriately slowed velocity.</p>
<p>And now, finally, I&#8217;m telling you this. <strong>It might not matter</strong>. What matters is that you test the velocities, and if the 2 background layers scroll at a pleasing velocity, then there you have it. Ultimately, we&#8217;re just trying to simulate a 3D perspective given a 2D environment. If it&#8217;s believable, then that&#8217;s the correct velocity.</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/07/02/moving-backgrounds-different-speeds/">Moving backgrounds, different speeds</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2007/11/28/round-cornered-images-in-paintdotnet/" rel="bookmark" title="November 28, 2007">Round cornered images in Paint.NET</a></li>

<li><a href="http://polymathprogrammer.com/2009/03/19/stationary-camera-moving-scene/" rel="bookmark" title="March 19, 2009">Stationary camera, moving scene</a></li>

<li><a href="http://polymathprogrammer.com/2007/11/09/multi-sensory-input-ai/" rel="bookmark" title="November 9, 2007">Multi-sensory input in artificial intelligence</a></li>

<li><a href="http://polymathprogrammer.com/2008/12/01/autonomous-intelligent-loading-of-scene-objects/" rel="bookmark" title="December 1, 2008">Autonomous intelligent loading of scene objects</a></li>

<li><a href="http://polymathprogrammer.com/2009/03/09/revolve-the-world-around-you/" rel="bookmark" title="March 9, 2009">Revolve the world around you</a></li>
</ul><!-- Similar Posts took 6.311 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=BoOytjlKp18:0tyAmbWwVNs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=BoOytjlKp18:0tyAmbWwVNs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=BoOytjlKp18:0tyAmbWwVNs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=BoOytjlKp18:0tyAmbWwVNs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=BoOytjlKp18:0tyAmbWwVNs:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=BoOytjlKp18:0tyAmbWwVNs:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=BoOytjlKp18:0tyAmbWwVNs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/BoOytjlKp18" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/07/02/moving-backgrounds-different-speeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/07/02/moving-backgrounds-different-speeds/</feedburner:origLink></item>
		<item>
		<title>Birthdays and paradoxes</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/jHhCUe3uAAk/</link>
		<comments>http://polymathprogrammer.com/2009/06/22/birthdays-and-paradoxes/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 09:00:39 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[birthday]]></category>
		<category><![CDATA[paradox]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1302</guid>
		<description><![CDATA[I was sitting down, thinking of an amusing article to write, and I didn&#8217;t quite feel up to writing. It&#8217;s been a long weekend, and besides, it&#8217;s a special day for me today.

So I thought, &#8220;What the heck&#8221;.
Then I thought I should at least leave you with something. So I&#8217;ll introduce you to the concept [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/22/birthdays-and-paradoxes/">Birthdays and paradoxes</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I was sitting down, thinking of an amusing article to write, and I didn&#8217;t quite feel up to writing. It&#8217;s been a long weekend, and besides, it&#8217;s a <a href="http://twitter.com/orcasquall/status/2266809399">special day</a> for me today.</p>
<p><img src="http://polymathprogrammer.com/images/blog/200906/32yearsold.png" width="606" height="232" alt="32 years old" /></p>
<p>So I thought, &#8220;What the heck&#8221;.</p>
<p>Then I thought I should at least leave you with something. So I&#8217;ll introduce you to the concept of the <a href="http://en.wikipedia.org/wiki/Birthday_paradox">birthday paradox</a>. Basically, given a group of 23 people, what&#8217;s the percentage chance that any 2 persons in that group share the same birthday? (hint: it&#8217;s higher than you think. Here&#8217;s a <a href="http://betterexplained.com/articles/understanding-the-birthday-paradox/">less clinical explanation of the paradox</a> than the one from Wikipedia.).</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/22/birthdays-and-paradoxes/">Birthdays and paradoxes</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2008/03/17/barber-paradox/" rel="bookmark" title="March 17, 2008">The barber paradox</a></li>

<li><a href="http://polymathprogrammer.com/2008/06/12/conversation-with-blog/" rel="bookmark" title="June 12, 2008">Conversation with a blog</a></li>

<li><a href="http://polymathprogrammer.com/2008/06/27/from-dilemma-to-tragedy/" rel="bookmark" title="June 27, 2008">From dilemma to tragedy</a></li>

<li><a href="http://polymathprogrammer.com/2008/08/01/be-careful-when-timing-one-liners/" rel="bookmark" title="August 1, 2008">Be careful when timing one-liners</a></li>

<li><a href="http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/" rel="bookmark" title="June 11, 2009">If you miss, little else matters</a></li>
</ul><!-- Similar Posts took 6.347 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=jHhCUe3uAAk:SJCbRoHJ38g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=jHhCUe3uAAk:SJCbRoHJ38g:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=jHhCUe3uAAk:SJCbRoHJ38g:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=jHhCUe3uAAk:SJCbRoHJ38g:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=jHhCUe3uAAk:SJCbRoHJ38g:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=jHhCUe3uAAk:SJCbRoHJ38g:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=jHhCUe3uAAk:SJCbRoHJ38g:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/jHhCUe3uAAk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/22/birthdays-and-paradoxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/22/birthdays-and-paradoxes/</feedburner:origLink></item>
		<item>
		<title>How long does your program live? Part 1</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/9NoeCpTqiVU/</link>
		<comments>http://polymathprogrammer.com/2009/06/18/how-long-does-your-program-live-part1/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 09:00:20 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[financial year]]></category>
		<category><![CDATA[lifespan]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1295</guid>
		<description><![CDATA[Have you considered the lifespan of your programs? You might have thought of scaling issues, security concerns and hardware settings. What if your program is still used 5 years down the road? 10 years? 20? Will it still work?
I had the occasion to work on a system. The thing was, it dealt with financial years. [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/18/how-long-does-your-program-live-part1/">How long does your program live? Part 1</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Have you considered the lifespan of your programs? You might have thought of scaling issues, security concerns and hardware settings. What if your program is still used 5 years down the road? 10 years? 20? Will it still work?</p>
<p>I had the occasion to work on a system. The thing was, it dealt with financial years. In case you&#8217;re wondering, a financial year (typically?) starts on April to the following March. So financial year 2009/2010 starts from April 2009 to March 2010. Calendar years are the &#8220;normal&#8221; ones, starting from January to December of that year.</p>
<p>Where was I? Oh right, the system with the financial years. So the Unix shell script that runs as an interface displayed up to the latest 5 financial years. There&#8217;s an accompanying set of C programs, as well as a corresponding set of database tables. It&#8217;s not well thought of, but it&#8217;s the best under the circumstances.</p>
<p>What happened was, every time a new financial year arrived, a new set of database tables was created (appropriately named of course). And a new set of C programs copied and pasted and edited (to insert, update and delete from the new database tables). And new lines of code added to that Unix shell script. This happens in late February and March, to prepare for the imminent arrival of April (April has more clout than August, even though August is well respected&#8230;)</p>
<p>So I did that for one year. Then the next year arrived, and I found myself with 7 financial years worth of program options, but only needed to display 5. The manager and senior colleague were already set to go for the path of least resistance: doing whatever worked last year. I decided otherwise.</p>
<p>I went through the code for the shell scripts, database scripts, stored procedures and C programs. The code were all flexible in that only the financial year portion was changed. So I told them that I&#8217;m going to change all the code so that the code took in the financial year as a parameter, or that it automatically calculated the correct financial years. The manager gave me the go ahead, and I went to work quickly, for it was February, and it&#8217;s unknown if I could get it to work in time.</p>
<p>There were some problems, and I&#8217;ll tell you about them in the 2nd part of this exciting mini-series&#8230;</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/18/how-long-does-your-program-live-part1/">How long does your program live? Part 1</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2008/05/14/heaps-of-by-products/" rel="bookmark" title="May 14, 2008">Heaps of by-products</a></li>

<li><a href="http://polymathprogrammer.com/2008/02/29/get-your-leap-years-right/" rel="bookmark" title="February 29, 2008">Get your leap years right</a></li>

<li><a href="http://polymathprogrammer.com/2007/10/05/multilingual-programming/" rel="bookmark" title="October 5, 2007">Multilingual programming</a></li>

<li><a href="http://polymathprogrammer.com/2008/06/20/know-enough-to-maintain-code/" rel="bookmark" title="June 20, 2008">You just need to know enough to maintain code</a></li>

<li><a href="http://polymathprogrammer.com/2007/12/03/can-your-program-survive-reruns/" rel="bookmark" title="December 3, 2007">Can your program survive reruns?</a></li>
</ul><!-- Similar Posts took 6.119 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=9NoeCpTqiVU:-mrotmr6Isg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=9NoeCpTqiVU:-mrotmr6Isg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=9NoeCpTqiVU:-mrotmr6Isg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=9NoeCpTqiVU:-mrotmr6Isg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=9NoeCpTqiVU:-mrotmr6Isg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=9NoeCpTqiVU:-mrotmr6Isg:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=9NoeCpTqiVU:-mrotmr6Isg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/9NoeCpTqiVU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/18/how-long-does-your-program-live-part1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/18/how-long-does-your-program-live-part1/</feedburner:origLink></item>
		<item>
		<title>Our future – The Sims and The Matrix</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/lUj7znpnUTs/</link>
		<comments>http://polymathprogrammer.com/2009/06/15/our-future-the-sims-and-the-matrix/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 09:00:39 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[sims]]></category>
		<category><![CDATA[thought experiment]]></category>
		<category><![CDATA[virtual world]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1289</guid>
		<description><![CDATA[I was wondering, what would happen if we run out of resources on Earth? We&#8217;d probably all die, which is kind of depressing. So I thought of how not to run out of resources in the first place.

[image by Andrejs Zemdega]
I have 2 obvious answers. One is regeneration of our resources, through recycling, reusing and [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/15/our-future-the-sims-and-the-matrix/">Our future &#8211; The Sims and The Matrix</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I was wondering, what would happen if we run out of resources on Earth? We&#8217;d probably all die, which is kind of depressing. So I thought of how <em>not</em> to run out of resources in the first place.</p>
<p><img src="http://polymathprogrammer.com/images/blog/200906/earthplant.jpg" width="415" height="289" alt="Earth plant" /><br />
[image by <a href="http://www.istockphoto.com/user_view.php?id=1759308">Andrejs Zemdega</a>]</p>
<p>I have 2 obvious answers. One is regeneration of our resources, through recycling, reusing and reducing. That doesn&#8217;t appear to be enough, since we consume too much.</p>
<p>The second answer is intergalactic colonisation. &#8220;We can&#8217;t control our own planet&#8217;s resources, so we&#8217;ll just take over another planet!&#8221; Even if we disregard the moral and selfish motivation of that reason, there&#8217;s still one tiny problem. Our scientific space program isn&#8217;t up to par yet. We might run out of resources before our science and technology is advanced enough.</p>
<p>So I came up with another answer. Now, if you assume that humans are driven by needs and wants, then&#8230; ok, let me define needs and wants first. Needs are critical to human survival, or at least make it easier to survive. Wants are wishes&#8230; let me give examples then. You need food, shelter and clothing (to protect from weather). You want to travel, to play video games and to wear Gucci products.</p>
<p>The distinction between a need and want is subjective (does steak qualify as a need or want?). We don&#8217;t need the distinction to be obvious anyway. So what&#8217;s the answer? Push the wants into a virtual world.</p>
<p><strong>Create a virtual world where the wants can be satisfied by bits and bytes rather than carbon, wool, oil, water and other natural resources.</strong></p>
<p>For it to work, the experience must be indistinguishable from what can be experienced now. Hence The Matrix. What we call reality, is just a sum total of what our senses tell us anyway. Simulate the senses correctly, and you get &#8220;reality&#8221;. The game franchise &#8220;The Sims&#8221; has been steadily heading towards this end. Its limits are the number of objects available (including other Sims), the number of interactions available and the number of sensory inputs.</p>
<p>With the wants satisfied in the virtual world, there should be more resources in the real world. If nothing else, this should give the option of regeneration more time to regenerate resources. Or more time to spread our human genes to other galaxies.</p>
<p>Is the virtual world solution easier to implement (we programmers have much to do then)? Will it upset the economy (most definitely)? Will the virtual world consume <em>more</em> resources (servers have carbon footprints too)?</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/15/our-future-the-sims-and-the-matrix/">Our future &#8211; The Sims and The Matrix</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2008/11/28/percentage-calculation-with-negative-numbers/" rel="bookmark" title="November 28, 2008">Percentage calculation with negative numbers</a></li>

<li><a href="http://polymathprogrammer.com/2009/03/02/what-the-sims-taught-me-about-socialising/" rel="bookmark" title="March 2, 2009">What The Sims taught me about socialising</a></li>

<li><a href="http://polymathprogrammer.com/2008/01/09/simcity-societies-review/" rel="bookmark" title="January 9, 2008">SimCity Societies review</a></li>

<li><a href="http://polymathprogrammer.com/2009/03/16/problem-of-looking-down/" rel="bookmark" title="March 16, 2009">The problem of looking down</a></li>

<li><a href="http://polymathprogrammer.com/2008/04/09/human-first-software-development/" rel="bookmark" title="April 9, 2008">Human-first software development</a></li>
</ul><!-- Similar Posts took 6.049 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=lUj7znpnUTs:lEsj5qTt9JE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=lUj7znpnUTs:lEsj5qTt9JE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=lUj7znpnUTs:lEsj5qTt9JE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=lUj7znpnUTs:lEsj5qTt9JE:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=lUj7znpnUTs:lEsj5qTt9JE:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=lUj7znpnUTs:lEsj5qTt9JE:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=lUj7znpnUTs:lEsj5qTt9JE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/lUj7znpnUTs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/15/our-future-the-sims-and-the-matrix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/15/our-future-the-sims-and-the-matrix/</feedburner:origLink></item>
		<item>
		<title>If you miss, little else matters</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/vFawT4B-jEs/</link>
		<comments>http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 09:00:33 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[dnd]]></category>
		<category><![CDATA[hit rate]]></category>
		<category><![CDATA[miss rate]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1283</guid>
		<description><![CDATA[I&#8217;ve played 2 more game sessions since I last failed at rolling dice. I&#8217;m starting to get the hang of playing Dungeons and Dragons. In case you&#8217;re not a DnD person, I&#8217;ll keep most of the deep references out.
Here&#8217;s my general observation: It&#8217;s actually very easy to miss. Generally speaking, in a neutral setting, where [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/">If you miss, little else matters</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve played 2 more game sessions since I last <a href="http://polymathprogrammer.com/2009/05/11/i-suck-at-rolling-dice/">failed at rolling dice</a>. I&#8217;m starting to get the hang of playing Dungeons and Dragons. In case you&#8217;re not a DnD person, I&#8217;ll keep most of the deep references out.</p>
<p>Here&#8217;s my general observation: <strong>It&#8217;s actually very easy to miss.</strong> Generally speaking, in a neutral setting, where there are no bonuses to hit, the percentage to hit range from 20% to 40%. Let me give you an example.</p>
<p>Suppose our hero fighter is engaged in battle with a kobold minion. He swings his sword at the kobold as a melee attack. In DnD terms, this means to roll 15 or higher on a d20, 15 being the kobold&#8217;s armour class (or AC). In mathematical terms, that&#8217;s a 6 out of 20 chance of hitting, or 30% chance.</p>
<p>And most of the hit rolls are like this. The most one could hope for, was to need to roll only an 11 or higher on a d20. That&#8217;s a slightly less than 50% chance to hit. And that&#8217;s the best case scenario.</p>
<p>My experience with video game role playing games was that, you issue an attack and it hits. Usually. Most of the time. I&#8217;ve never found the use of support skills or spells significant. I would cast a protection spell to reduce the amount of damage, and that would be the extent.</p>
<p>So I was in a bit of a quandary when playing Dungeons and Dragons. I like magical stuff. The characters wielding magic are controller types, meaning they can deal damage to multiple enemies but do less damage. They are supposed to slow the enemies, daze them, teleport them, immobilise them, lower their defenses, increase their vulnerability and so on. Basically supportive skills.</p>
<p>Now for my previous game, I was offered help in creating a character. So I took it, and let the helper create whatever he deemed fit. And I got a character geared towards those supportive skills. I thought, &#8220;Interesting. I thought boosting damage might be better. Oh well.&#8221;</p>
<p>And I truly saw the error of my ways for that game. The enemies had super high defenses. The miss rate was like 70% or 80%. Until the bonuses started to stack.</p>
<p>We had 6 players (which was large), and we buffed the 1 or 2 players with high damage. Because if we didn&#8217;t, we would never get any of the enemies killed, because we would never hit them. A +1 to your next attack roll, a -2 to the enemy&#8217;s defense, a +2 because of that power, a +2 because I used mine.</p>
<p>As for me, I shone at one particular part, where a few enemies bunched up together, and my spell disintegrated them in one shot. Ok, maybe not all of them, but it cleared most of them. Because it allowed the other players to concentrate on that demon with tons of hit points.</p>
<p>And for the last battle, the buffing really helped. There was this ranger, who could hit using two weapons with one of his skills. After we buffed him, <em>he was able to hit with anything better than 1</em> (because a 1 was an automatic miss). He hit, and started rolling dice for damage. I believe he needed to roll 6 d10&#8217;s (and an additional d6 or d8 because he had a critical hit). After stacking all his damage bonuses, he dealt 73 points of damage. <strong>He simply needed to hit.</strong></p>
<p>So from the few games I played, I finally realised the power of team work in DnD. As the characters I favoured, I was to harass the enemies, and disrupt them from harassing my team members. My job was to make it harder for the enemy, and make it easier for us to destroy them. My supportive skills are crucial to this.</p>
<p>Because if my team members miss the enemy, little else matters.</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/">If you miss, little else matters</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2009/05/11/i-suck-at-rolling-dice/" rel="bookmark" title="May 11, 2009">I suck at rolling dice</a></li>

<li><a href="http://polymathprogrammer.com/2007/06/13/the-2nd-best-theory-finding-balance/" rel="bookmark" title="June 13, 2007">The &#8220;2nd best&#8221; theory &#8211; Finding balance</a></li>

<li><a href="http://polymathprogrammer.com/2009/04/16/exploring-dungeons-and-slaying-dragons/" rel="bookmark" title="April 16, 2009">Exploring dungeons and slaying dragons</a></li>

<li><a href="http://polymathprogrammer.com/2008/05/09/courting-danger/" rel="bookmark" title="May 9, 2008">Courting danger</a></li>

<li><a href="http://polymathprogrammer.com/2008/07/07/forget-about-writing-perfect-code/" rel="bookmark" title="July 7, 2008">Forget about writing perfect code</a></li>
</ul><!-- Similar Posts took 6.302 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=vFawT4B-jEs:zLjk_2LUpng:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=vFawT4B-jEs:zLjk_2LUpng:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=vFawT4B-jEs:zLjk_2LUpng:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=vFawT4B-jEs:zLjk_2LUpng:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=vFawT4B-jEs:zLjk_2LUpng:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=vFawT4B-jEs:zLjk_2LUpng:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=vFawT4B-jEs:zLjk_2LUpng:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/vFawT4B-jEs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/</feedburner:origLink></item>
		<item>
		<title>Sort algorithm choice is immaterial for small numbers</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/TRFrwVSaMV4/</link>
		<comments>http://polymathprogrammer.com/2009/06/08/sort-algorithm-choice-immaterial-for-small-numbers/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 09:00:46 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[humour]]></category>
		<category><![CDATA[managerial]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1276</guid>
		<description><![CDATA[I was debating with myself whether I should do a time comparison for the sort algorithms. Then I decided other people had already explained it much better than I could (and the real reason was that I was too lazy to code it and measure it. But you didn&#8217;t hear it from me&#8230;). So I&#8217;ll [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/08/sort-algorithm-choice-immaterial-for-small-numbers/">Sort algorithm choice is immaterial for small numbers</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I was debating with myself whether I should do a time <a href="http://www.cprogramming.com/tutorial/computersciencetheory/sortcomp.html">comparison for the sort algorithms</a>. Then I decided other people had already explained it much better than I could (and the real reason was that I was too lazy to code it and measure it. But you didn&#8217;t hear it from me&#8230;). So I&#8217;ll tell you a story instead.</p>
<p><img src="http://polymathprogrammer.com/images/blog/200906/manageratdesk.jpg" width="421" height="285" alt="Manager at desk" /><br />
[image by <a href="http://www.istockphoto.com/user_view.php?id=107002">diane39</a>]</p>
<p>It was a few years back. I was just a rookie programmer back then. My manager didn&#8217;t understand why his superiors hired me. I didn&#8217;t even have a proper degree in computer science. He seemed to think my degree in applied mathematics and computational science was irrelevant. In fact, I think he&#8217;s afraid of me on some level.</p>
<p>Every day, I walked into my cubicle, sat in my chair, and waited for the phone to ring off its hook. It was a boring existence, doing small maintenance code changes to the C source code, helping users with their queries and basically making sure the System continues to stand on its rickety feet.</p>
<p>I was too &#8220;lowly&#8221; to be given work in the frontend, the web programming parts, the &#8220;high value&#8221; work.</p>
<p>One senior colleague, relieved of the maintenance duties by me, got the chance to work on higher level design stuff. A new project arrived, Highly Perceptible Project Opportunity or HiPPO for short. The manager got 3 more new staff to help out. The backend programs would be done by one of the new staff and the senior colleague (since the business processing logic was entrenched there), and the frontend web application would be handled by the rest of the team.</p>
<p>Me? I was given the task of making sure the System continues to stand on its rickety feet. I was considered too &#8220;lowly&#8221; to handle high level design work or web application development, yet too senior and knowledgeable about the System to remove me from the System.</p>
<p>One day, while I was looking at an email trying to figure out what the user wanted, one of the web application developers came over to me. Let me repeat that. <strong>One of the web application developers came into my cubicle to talk to me!</strong> I barely even get to see anyone from the HiPPO team.</p>
<p>Anyway, Tyler (as I&#8217;ll call him) asked me if I knew anything about sorting. In particular, how to implement a sorting algorithm. What? I went over to Tyler&#8217;s computer (wow, I&#8217;ve never been in that area&#8230;) and took a look at his code, and what he needed to implement. I told him to send me the source code, and I&#8217;ll try something out first before getting back to him.</p>
<p>I went back to my desk, elated that I had something to work on other than <code>update</code> statements and Excel spreadsheets. Tyler sent me the source code (we didn&#8217;t have source control, and even if we had, I doubt I&#8217;d be given access), and I tried sorting using bubble sort.</p>
<p>After testing the results, the bubble sort implementation worked fine for the requirements, so I sent the code file back to Tyler. Tyler&#8217;s happy that the sort worked, and I went back to my boring existence.</p>
<p>The next day, my manager called me to go into his office. I went in, and he gestured me to sit down. He looked at me for a few seconds, a furrow forming between his eyebrows.</p>
<p>&#8220;Vincent, I heard from Tyler from this morning&#8217;s HiPPO project update that you helped him with his sorting implementation.&#8221;</p>
<p>&#8220;Yes.&#8221;</p>
<p>He looked at me wordlessly for another few seconds.</p>
<p>&#8220;Is it fast? Have you looked at other sorting algorithms? There&#8217;s quicksort and heapsort I believe.&#8221;</p>
<p>My manager had obviously done his homework.</p>
<p>&#8220;Yes, I know of the other algorithms. I have chosen bubble sort because it&#8217;s easy to implement, and based on the requirements, it&#8217;s also fast enough.&#8221;</p>
<p>&#8220;I&#8217;m concerned about the speed. It has to be fast.&#8221;</p>
<p>&#8220;I&#8217;ve already tested with the higher ranges of the number of expected records. The performance is good. Tyler had also tested with the records from the test database, and it works fine.&#8221;</p>
<p>&#8220;But I&#8217;m worried about the user finding the web application slow.&#8221;</p>
<p>Now it&#8217;s my turn to look at him for a few seconds. I took a deep breath.</p>
<p>&#8220;We only need to sort maybe 3 or 4 records. Bubble sort is fast enough.&#8221;</p>
<p>[Story had been <em>unbelievably</em> distorted and exaggerated to make it interesting.]</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/08/sort-algorithm-choice-immaterial-for-small-numbers/">Sort algorithm choice is immaterial for small numbers</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2008/11/07/null-is-foreign-concept-to-users/" rel="bookmark" title="November 7, 2008">Null is foreign concept to users</a></li>

<li><a href="http://polymathprogrammer.com/2009/02/27/every-user-query-is-a-puzzle/" rel="bookmark" title="February 27, 2009">Every user query is a puzzle</a></li>

<li><a href="http://polymathprogrammer.com/2008/02/01/flexibility-can-hurt/" rel="bookmark" title="February 1, 2008">Too much flexibility can hurt</a></li>

<li><a href="http://polymathprogrammer.com/2009/06/18/how-long-does-your-program-live-part1/" rel="bookmark" title="June 18, 2009">How long does your program live? Part 1</a></li>

<li><a href="http://polymathprogrammer.com/2007/06/19/its-not-about-you-its-about-results/" rel="bookmark" title="June 19, 2007">It&#8217;s not about you. It&#8217;s about results.</a></li>
</ul><!-- Similar Posts took 6.262 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=TRFrwVSaMV4:PtsVjH4WONo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=TRFrwVSaMV4:PtsVjH4WONo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=TRFrwVSaMV4:PtsVjH4WONo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=TRFrwVSaMV4:PtsVjH4WONo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=TRFrwVSaMV4:PtsVjH4WONo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=TRFrwVSaMV4:PtsVjH4WONo:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=TRFrwVSaMV4:PtsVjH4WONo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/TRFrwVSaMV4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/08/sort-algorithm-choice-immaterial-for-small-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/08/sort-algorithm-choice-immaterial-for-small-numbers/</feedburner:origLink></item>
		<item>
		<title>Are they recruiting secret agents?</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/aM0CXrDS9BA/</link>
		<comments>http://polymathprogrammer.com/2009/06/04/are-they-recruiting-secret-agents/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 09:00:17 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[humour]]></category>
		<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1267</guid>
		<description><![CDATA[So I told you about the time when the security guard stopped me because I was too hot. I went for an interview, and it ended with stepping into the company building. This is where the story continues&#8230;
[What follows had been highly exaggerated for entertainment purposes. About 72.59% of it was created out of thin [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/04/are-they-recruiting-secret-agents/">Are they recruiting secret agents?</a></p>
]]></description>
			<content:encoded><![CDATA[<p>So I told you about the time when the <a href="http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/">security guard stopped me because I was too hot</a>. I went for an interview, and it ended with stepping into the company building. This is where the story continues&#8230;</p>
<p>[What follows had been highly exaggerated for entertainment purposes. About 72.59% of it was created out of thin air.]</p>
<p><img src="http://polymathprogrammer.com/images/blog/200906/brightlobby.jpg" width="425" height="282" alt="Bright lobby" /><br />
[image by <a href="http://www.istockphoto.com/user_view.php?id=581761">Freezingtime</a>]</p>
<p>The gigantic lobby was brightly lit. The company representative had said nothing other than &#8220;Follow me&#8221; since I passed the security heat scan. He moved purposefully to the lifts and pressed a button.</p>
<p>I noticed the receptionist was staring at me. Not with adoration, sadly, but with an ever so slight frown on her face. The lift doors opened, and she went back to looking at her computer screen. The representative had already went into the lift, and I moved in quickly.</p>
<p>He pressed the button &#8220;B3&#8243;. <em>We&#8217;re going below ground?</em> He faced the button panel in a stiff manner, and I didn&#8217;t dare to engage him in conversation.</p>
<p>The doors opened, and I saw a long hallway stretching away from me. He exited the lift and I followed suit.</p>
<p>*Glung glong glung glong* The sound of our footsteps echoed emptily in the hallway. The tiled floor was clinically white. The walls were a uniform washed out grey, devoid of decorations.</p>
<p>I was half-expecting a door on the side to break the monotony when the representative stopped. A glass door was in front of us! There was a security panel on the right.</p>
<p>&#8220;Please move to behind me.&#8221; It wasn&#8217;t a request.</p>
<p>I practically leapt behind him, for fear of lasers sweeping the hallway. But the curiosity in me won. I took a quick peek at what he&#8217;s doing at the security panel. I mean, it&#8217;s not everyday you see retinal and fingerprint scans in action. But he&#8217;s just entering a few digits on the security panel. Oh, he just didn&#8217;t want me seeing him entering his passcode.</p>
<p>The glass doors opened with an almost imperceptible swoosh. I waited for him to take the lead, but he stayed where he was.</p>
<p>&#8220;This is as far as I can take you.&#8221;</p>
<p>I stared at him incredulously. &#8220;Uh, how do I get to where I&#8217;m supposed to go then?&#8221;</p>
<p>&#8220;Go down the hallway. When you reach the fork, turn right. There&#8217;ll be a room at the end. Wait there. Your interviewer will be a bit late.&#8221;</p>
<p>I almost wanted to ask him how was I supposed to return to civilisation when he turned abruptly and walked swiftly back to the lift. I went past the glass doors and they swooshed shut. My throat constricted a bit.</p>
<p>Following his instructions, I found the door leading to the room he mentioned. My hands shook while I turned the door knob. I entered the room.</p>
<p>It was a fairly large room. There was another door on the other side of the room. The lighting was uneven, where the brightest part was on a corner. Coincidentally, that&#8217;s where a table and two chairs reside (the only pieces of furniture in the room). A ceiling light flickered at the darker regions, momentarily allowing me to see&#8230; nothing there. The walls were the same pale grey, and even the light switches blended into the walls. The only thing missing in the room was a polygraph near the table. I swallowed.</p>
<p>There was a sign on the wall, near the table. I moved closer to read it, happy to see any form of decoration. It was a &#8220;No camera phones allowed&#8221; sign. My heart jumped, and I instinctively touched my pockets where my camera phone rested.</p>
<p>&#8220;I am <em>so</em> dead.&#8221;</p>
<p>After waiting for ten minutes, I decided they wouldn&#8217;t kill me if I sat down first. I placed my briefcase against the leg of the table, and mentally rehearsed what I was going to say. I had to tell the interviewer about my camera phone, of course. Checking that I had extra copies of my resume and academic accomplishments did nothing to calm me.</p>
<p>I jumped when a door opened. The interviewer came in from the other side of the room. &#8220;Sit down,&#8221; he said, a smile on his face. &#8220;I&#8217;m sorry I was late. Held up by a meeting.&#8221;</p>
<p>&#8220;I have to tell you this. I have a camera phone, but I&#8217;ve already switch it off.&#8221;<br />
&#8220;Oh. It&#8217;s ok.&#8221;</p>
<p>He proceeded with what I felt were standard interview protocol. I was still in shock, when he threw an unexpected &#8220;I have a grandfather&#8217;s clock and it&#8217;s faster than my watch. Should I shorten or lengthen the pendulum?&#8221; I stared at him for a few seconds before answering. He must have sensed my confusion, because he said, &#8220;Oh it&#8217;s not part of the interview. I&#8217;m just curious.&#8221;</p>
<p>Then he showed me a piece of code on string concatenation and asked me how to make it faster. Then he showed me another piece of code, and asked about the rounding errors of the monetary calculations (<a href="http://polymathprogrammer.com/2008/05/26/only-quarters-counted/">oh I know that one</a>!).</p>
<p>Finally, it ended. He told me he had to attend to something, and he couldn&#8217;t take me back (to the surface). But it should be easy that I retrace my steps back to the glass doors. Someone would pick me up from there. He exited via the same door he came in. I packed my stuff and left the room too.</p>
<p>Retracing my steps, I found the glass doors. And the representative waiting for me. How did he know when my interview would finish? As I walked towards the glass doors, he entered his passcode, and the doors slid open.</p>
<p>He took me wordlessly through the (endless) hallway, back to the lift, back to ground floor, past the (cute) receptionist, and out into the afternoon sun. &#8220;Thank you for your time, and we&#8217;ll be in touch.&#8221; was all he said.</p>
<p>I&#8217;m just glad I&#8217;m still alive.</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/04/are-they-recruiting-secret-agents/">Are they recruiting secret agents?</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2008/02/04/fear-of-security-panel/" rel="bookmark" title="February 4, 2008">Fear of the security panel</a></li>

<li><a href="http://polymathprogrammer.com/2008/10/30/swing-doors-reopened-flawed-assumption/" rel="bookmark" title="October 30, 2008">Swing doors reopened &#8211; Flawed assumption</a></li>

<li><a href="http://polymathprogrammer.com/2008/10/23/math-of-swing-doors/" rel="bookmark" title="October 23, 2008">The math of swing doors</a></li>

<li><a href="http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/" rel="bookmark" title="May 29, 2009">So hot, I was stopped by security</a></li>

<li><a href="http://polymathprogrammer.com/2009/03/09/revolve-the-world-around-you/" rel="bookmark" title="March 9, 2009">Revolve the world around you</a></li>
</ul><!-- Similar Posts took 6.497 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=aM0CXrDS9BA:JZolGA6d0Ko:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=aM0CXrDS9BA:JZolGA6d0Ko:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=aM0CXrDS9BA:JZolGA6d0Ko:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=aM0CXrDS9BA:JZolGA6d0Ko:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=aM0CXrDS9BA:JZolGA6d0Ko:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=aM0CXrDS9BA:JZolGA6d0Ko:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=aM0CXrDS9BA:JZolGA6d0Ko:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/aM0CXrDS9BA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/04/are-they-recruiting-secret-agents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/04/are-they-recruiting-secret-agents/</feedburner:origLink></item>
		<item>
		<title>If you try exceptional code, make sure you catch the exceptions</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/wsFK0K0ghco/</link>
		<comments>http://polymathprogrammer.com/2009/06/01/if-you-try-exceptional-code-make-sure-you-catch-the-exceptions/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 09:00:54 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[try-catch]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1261</guid>
		<description><![CDATA[Recently, an application failed on me. And I didn&#8217;t receive any notification. I only knew it failed because the next hour, I received a notification that it couldn&#8217;t start. Let me tell you more about the application first.
The application was supposed to run every hour. At the start, it would update a datetime column in [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/01/if-you-try-exceptional-code-make-sure-you-catch-the-exceptions/">If you try exceptional code, make sure you catch the exceptions</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Recently, an application failed on me. And I didn&#8217;t receive any notification. I only knew it failed because the next hour, I received a notification that it couldn&#8217;t start. Let me tell you more about the application first.</p>
<p>The application was supposed to run every hour. At the start, it would update a datetime column in the database. At the end, it would update another datetime column in the database. On start, before continuing with the bulk of its operations, the application checked that the start date was earlier than the end date (from the previous operations). This way, it won&#8217;t accidentally run once more while presumably another copy of itself was running.</p>
<p>Anyway, if it did happen to hit that start-date-later-than-end-date condition, then it failed. And a notification would be sent to me. The details were logged in a log file. Due to some complexities of its implementation, I had to check the log file of the earlier run to get the details.</p>
<p>And I found nothing. I mean the log file obviously wasn&#8217;t complete. But the error message wasn&#8217;t there. I was perplexed. I remembered there was a giant try-catch clause in the program, so I should at least see something. Can you see the flaw?</p>
<div class="codediv">
<pre>
try
{
    // do stuff here
}
catch (SqlException se)
{
    log.WriteLog(se.ToString());
}
catch (OleDbException oe)
{
    log.WriteLog(oe.ToString());
}
</pre>
</div>
<p><strong>What if the exception wasn&#8217;t database-related?</strong> And that&#8217;s exactly what happened. There was an input file, and it wasn&#8217;t properly formatted, thus creating all sorts of parsing errors. It was an IO problem. Since the action taken was the same in exceptional cases, I rewrote the above to this:</p>
<div class="codediv">
<pre>
try
{
    // do stuff here
}
catch (Exception e)
{
    log.WriteLog(e.ToString());
}
</pre>
</div>
<p>If you&#8217;re going to catch specific exceptions, make sure you catch all of them.</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/06/01/if-you-try-exceptional-code-make-sure-you-catch-the-exceptions/">If you try exceptional code, make sure you catch the exceptions</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2007/11/02/using-and-formatting-datetime-and-timespan/" rel="bookmark" title="November 2, 2007">Using and formatting DateTime and TimeSpan data types</a></li>

<li><a href="http://polymathprogrammer.com/2008/07/17/translating-database-column-names-for-globalisation/" rel="bookmark" title="July 17, 2008">Translating database column names for globalisation</a></li>

<li><a href="http://polymathprogrammer.com/2007/12/03/can-your-program-survive-reruns/" rel="bookmark" title="December 3, 2007">Can your program survive reruns?</a></li>

<li><a href="http://polymathprogrammer.com/2008/10/16/confounding-digital-clock-puzzle/" rel="bookmark" title="October 16, 2008">The confounding digital clock puzzle</a></li>

<li><a href="http://polymathprogrammer.com/2009/01/19/depend-on-order-use-order-by/" rel="bookmark" title="January 19, 2009">If you depend on order, use an order by</a></li>
</ul><!-- Similar Posts took 5.946 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=wsFK0K0ghco:--VK5wJLUus:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=wsFK0K0ghco:--VK5wJLUus:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=wsFK0K0ghco:--VK5wJLUus:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=wsFK0K0ghco:--VK5wJLUus:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=wsFK0K0ghco:--VK5wJLUus:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=wsFK0K0ghco:--VK5wJLUus:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=wsFK0K0ghco:--VK5wJLUus:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/wsFK0K0ghco" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/06/01/if-you-try-exceptional-code-make-sure-you-catch-the-exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/06/01/if-you-try-exceptional-code-make-sure-you-catch-the-exceptions/</feedburner:origLink></item>
		<item>
		<title>So hot, I was stopped by security</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/C5oplPV0ZX4/</link>
		<comments>http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/#comments</comments>
		<pubDate>Fri, 29 May 2009 09:00:56 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Offtopic]]></category>
		<category><![CDATA[heat]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[scan]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1255</guid>
		<description><![CDATA[The recent heat wave in Singapore, and the unfortunate H1N1 epidemic reminded me of a story. I&#8217;ve only told this to a few people, but here is where you&#8217;ll read about the full story.
It was slightly later than the SARS period. People were frightened of getting infected. The basic detection method was the temperature check, [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/">So hot, I was stopped by security</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The recent heat wave in Singapore, and the unfortunate H1N1 epidemic reminded me of a story. I&#8217;ve only told this to a few people, but here is where you&#8217;ll read about the full story.</p>
<p>It was slightly later than the SARS period. People were frightened of getting infected. The basic detection method was the temperature check, so thermometers and heat scans were employed.</p>
<p>I was also looking for a potential job position, and I got an afternoon interview with a company. I arrived early because the location was a bit remote.</p>
<p>Now, it&#8217;s a habit of mine. Whenever I know something important is happening later, I stop drinking. Just so I won&#8217;t have to go to the bathroom at the most inopportune moments. I don&#8217;t know why, it&#8217;s just a personal quirk.</p>
<p>So I was walking from the bus stop to the company&#8217;s location, under the hot sun, in long sleeves and pants (thankfully no suit and tie needed), and heated, slightly sweaty and parched. It was a wonder I reached the security guardroom of the company not dripping wet from my own sweat.</p>
<p>Now this company had a very high security level. They had a full temperature head scanner. They had this device that scans people, and a heat map shows up on their screens.</p>
<p>Well, it was after the SARS period, so I could understand their security concerns. Someone from the company was waiting for me. He waited by the side while the security guard asked me to stand at a designated spot. Then the guard activated the scanner.</p>
<p>Apparently, my temperature scan looked like a sunset with lavish swathes of reds and oranges, because the guard told me to stand still again while he scanned again. Sensing something wrong, the adrenaline in me surged a little, which didn&#8217;t help cool down my body temperature. I held still. I even held my breath. I still failed the temperature scan.</p>
<p>The company liaison, surprised by this unexpected unfolding of events, took me to the inner parts of the guardroom, where the air conditioning was stronger. He also offered me a cup of water from the dispenser. Then he told me to sit and wait for a while first. I got myself a cup of water, drank and accepted his suggestion.</p>
<p>&#8220;I&#8217;m gonna fail the interview before I even step into the company office, aren&#8217;t I?&#8221; silently and matter-of-factly entered my thoughts.</p>
<p>After 15 minutes (or half an hour, I didn&#8217;t keep track), I stood up, and took the temperature scan again. I placed my feet at the exact position of the designated spot, shifting my shoes to fit the exact outline of the pre-drawn shoe print. My hands were held in a limbo of alternating tenseness and forced relaxation. I looked up as confidently as I could, keeping my breathing steady, taking deep breaths&#8230; And the guard scanned.</p>
<p>What took seconds felt like the time passed while running around a 400 metre track 2 times, then jumping into a pool to swim 100 metres and then work out a 6 digit long division. By hand. I was getting ready to dive into that imaginary pool in my mind when the guard said it&#8217;s ok. <strong>I passed.</strong></p>
<p>The company liaison, obvious relief on his face, took me into the company proper. And the interview itself? Well, it&#8217;s not as interesting as the guardroom episode&#8230; alright fine, I&#8217;ll tell you about it some other time.</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/">So hot, I was stopped by security</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2009/06/04/are-they-recruiting-secret-agents/" rel="bookmark" title="June 4, 2009">Are they recruiting secret agents?</a></li>

<li><a href="http://polymathprogrammer.com/2008/07/26/response-to-stack-overflow-podcast-15/" rel="bookmark" title="July 26, 2008">Response to Stack Overflow podcast 15</a></li>

<li><a href="http://polymathprogrammer.com/2008/02/04/fear-of-security-panel/" rel="bookmark" title="February 4, 2008">Fear of the security panel</a></li>

<li><a href="http://polymathprogrammer.com/2008/05/07/heat-other-and-pens/" rel="bookmark" title="May 7, 2008">The heat, the other and the pens</a></li>

<li><a href="http://polymathprogrammer.com/2008/11/12/nz-nov2004-fox-glacier-walk/" rel="bookmark" title="November 12, 2008">New Zealand Nov 2004 trip &#8211; Fox Glacier walk</a></li>
</ul><!-- Similar Posts took 6.247 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=C5oplPV0ZX4:L9NBudb-Vfo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=C5oplPV0ZX4:L9NBudb-Vfo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=C5oplPV0ZX4:L9NBudb-Vfo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=C5oplPV0ZX4:L9NBudb-Vfo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=C5oplPV0ZX4:L9NBudb-Vfo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=C5oplPV0ZX4:L9NBudb-Vfo:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=C5oplPV0ZX4:L9NBudb-Vfo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/C5oplPV0ZX4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/05/29/so-hot-i-was-stopped-by-security/</feedburner:origLink></item>
		<item>
		<title>Obsessive character sheeting</title>
		<link>http://feedproxy.google.com/~r/PolymathProgrammer/~3/SEhRjeLH_4c/</link>
		<comments>http://polymathprogrammer.com/2009/05/25/obsessive-character-sheeting/#comments</comments>
		<pubDate>Mon, 25 May 2009 09:00:48 +0000</pubDate>
		<dc:creator>Vincent Tan</dc:creator>
				<category><![CDATA[Curiosita]]></category>
		<category><![CDATA[character sheet]]></category>
		<category><![CDATA[game]]></category>

		<guid isPermaLink="false">http://polymathprogrammer.com/?p=1247</guid>
		<description><![CDATA[So I was alone and bored of creating perfect characters. Tired of flipping through the rule books, I returned to my other hobby: playing video games.
At this point in my young life, I was also mildly fascinated with notepads. Small booklets, large A4 sized pads, lined pages, blank pages, thick pages, recycled paper. I was [...]<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/05/25/obsessive-character-sheeting/">Obsessive character sheeting</a></p>
]]></description>
			<content:encoded><![CDATA[<p>So I was <a href="http://polymathprogrammer.com/2009/05/18/when-lonely-and-bored-you-max-out-character-stats/">alone and bored of creating perfect characters</a>. Tired of flipping through the rule books, I returned to my other hobby: playing video games.</p>
<p>At this point in my young life, I was also mildly fascinated with notepads. Small booklets, large A4 sized pads, lined pages, blank pages, thick pages, recycled paper. I was itching to write something on a piece of paper.</p>
<p>And I started &#8220;documenting&#8221; my games.</p>
<p>[Warning: What follows are some drawn out descriptions of games long past. You may or may not be interested in the relevance. Read on at your own risk.]</p>
<p>There was this platform game called Mappy Kids. You took the form of a mouse travelling through the levels, acquiring cash. Your goal was to acquire enough cash to buy stuff, to build a house, so you could win the heart of the female rodent of your dreams.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/HtcAo4yrCW4&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/HtcAo4yrCW4&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Your main form of attack was the kick. The power ups altered your kick. The normal kick sent an enemy straight horizontally away from you. A lightning kick sent an enemy flying away in a zig zag manner, bouncing from the bottom to the top of the screen. The loop-de-loop kick sent the enemy rolling in a wide circle.</p>
<p>Well, the kicks were fascinating, but they really came into play when you&#8217;re in 2 player mode. In 2 player mode, both of you compete to build that dream house. When you kicked an enemy into the other player, the other player would lose a stash of cash. If you&#8217;re quick, you could grab that stash. The various power kicks made it hard to avoid the enemy, who&#8217;s flying in a certain pattern. The fun multiplied when the other player, when timed correctly, kicked the kicked enemy again, sending the enemy flying back towards you.</p>
<p>What&#8217;s this got to do with character sheets? And programming? Well, I started jotting down notes on the power ups. And health bars. And the cash value. And items bought. To do this, I needed to understand the game play, not just as a gamer, but as a programmer. The programmer in me started translating game elements of that mouse I was controlling into representable code elements, namely variables. Not so much on game/code logic. I didn&#8217;t know about programming or even have a computer back then.</p>
<p>And I started on a rampage to turn every game into representable character sheets, even action games. Do you remember <a href="http://www.youtube.com/watch?v=Yg5jy6RHEhE">Super Mario Brothers 3</a> (which incidentally started me on the <a href="http://polymathprogrammer.com/2007/09/17/path-of-polymath-programmer-part4/">path of self-learning Japanese</a>)? The game had the novel concept of storing power ups. Stars (for invincibility), feathers (for that tail for whacking), flowers (for that fireball throwing ability) and others. There wasn&#8217;t much to document, just power ups and the level you were at and stuff.</p>
<p>Then there was &#8220;Hitler&#8217;s Revenge&#8221;, based on the Chinese game book manual I have (yes, I still have some of those game manuals). It&#8217;s titled &#8220;Bionic Commando&#8221; in America due to it&#8217;s controversial name.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/2HsIg_cA4Z8&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2HsIg_cA4Z8&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>I played the version in the earlier parts of the above video (click through to the post if you can&#8217;t view it in your feed reader). The main mechanism of play is the hook. You use it to hook onto something, usually as a means of moving from one place to another. I&#8217;ll let the video show you what I mean.</p>
<p>There were others. I managed to distill the game elements onto paper. I learnt to store game statistics. How do I store this item? How do I know if the character has that power in the game?</p>
<p>As I <a href="http://polymathprogrammer.com/2007/10/01/path-of-polymath-programmer-part6/">tried my hand at game development</a>, I asked myself questions such as, &#8220;Do I use words, or numbers to represent them?&#8221; or &#8220;Should I use <code>int</code> or <code>byte</code>?&#8221;</p>
<p>With a little more data (such as game progress), <strong>a character sheet is basically the game data</strong>. What do you need to keep track of when the player saves? The character sheet. When the player wants to resume game play, just load the character sheet. Because it contains everything you need to continue the game.</p>
<p><br />Subscribe to my <a href="http://polymathprogrammer.com/2009/02/25/polymercation-aka-polymath-programmer-publication/">newsletter</a> for more content. Sign up form in blog sidebar.
<br />Written by Vincent Tan. Feel free to share. <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/sg/">BY-NC-SA</a> Creative Commons.</p>
<p><a href="http://polymathprogrammer.com/2009/05/25/obsessive-character-sheeting/">Obsessive character sheeting</a></p>
Similar Posts:<ul><li><a href="http://polymathprogrammer.com/2007/11/09/multi-sensory-input-ai/" rel="bookmark" title="November 9, 2007">Multi-sensory input in artificial intelligence</a></li>

<li><a href="http://polymathprogrammer.com/2009/06/11/if-you-miss-little-else-matters/" rel="bookmark" title="June 11, 2009">If you miss, little else matters</a></li>

<li><a href="http://polymathprogrammer.com/2009/04/16/exploring-dungeons-and-slaying-dragons/" rel="bookmark" title="April 16, 2009">Exploring dungeons and slaying dragons</a></li>

<li><a href="http://polymathprogrammer.com/2007/09/17/path-of-polymath-programmer-part4/" rel="bookmark" title="September 17, 2007">Path of a Polymath Programmer Part 4</a></li>

<li><a href="http://polymathprogrammer.com/2008/09/22/can-you-solve-this-game-math-puzzle-in-seconds/" rel="bookmark" title="September 22, 2008">Can you solve this game math puzzle in seconds?</a></li>
</ul><!-- Similar Posts took 6.319 ms --><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=SEhRjeLH_4c:B8EUihxAtXk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=SEhRjeLH_4c:B8EUihxAtXk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=SEhRjeLH_4c:B8EUihxAtXk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=SEhRjeLH_4c:B8EUihxAtXk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?i=SEhRjeLH_4c:B8EUihxAtXk:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=SEhRjeLH_4c:B8EUihxAtXk:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=cGdyc7Q-1BI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/PolymathProgrammer?a=SEhRjeLH_4c:B8EUihxAtXk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/PolymathProgrammer?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PolymathProgrammer/~4/SEhRjeLH_4c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://polymathprogrammer.com/2009/05/25/obsessive-character-sheeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://polymathprogrammer.com/2009/05/25/obsessive-character-sheeting/</feedburner:origLink></item>
	</channel>
</rss>
