<?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>lifesnotsimple.com</title>
	<atom:link href="http://lifesnotsimple.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifesnotsimple.com</link>
	<description>penitentiary is _not_ easy to spell</description>
	<lastBuildDate>Sat, 04 Sep 2010 19:01:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IPL &#8212; The Swaperator</title>
		<link>http://lifesnotsimple.com/index.php/2010/09/ipl-the-swaperator/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/09/ipl-the-swaperator/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 10:00:53 +0000</pubDate>
		<dc:creator>wall</dc:creator>
				<category><![CDATA[IPL -- the Ideal Programming Language]]></category>
		<category><![CDATA[IPL]]></category>
		<category><![CDATA[non-humor]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[swap]]></category>
		<category><![CDATA[swaperator]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=478</guid>
		<description><![CDATA[This one&#8217;s gonna be short.
I propose the following syntax for swapping:

a &#60;=&#62; b;

There, simple eh?
  is the &#8220;swap operator&#8221;, or, as it is known in some circles (the depths of my twisted mind), the &#8220;swaperator&#8221;. This operator will be overloaded. For example, int &#60;=&#62; int will swap the values of two integers, container &#60;=&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lifesnotsimple.com/wp-content/uploads/2010/09/swaperator.png"><img src="http://lifesnotsimple.com/wp-content/uploads/2010/09/swaperator.png" alt="" title="swaperator" width="96" height="96" class="alignleft size-full wp-image-496" /></a>This one&#8217;s gonna be short.</p>
<p>I propose the following syntax for swapping:<br />
<code><br />
a &lt;=&gt; b;<br />
</code></p>
<p>There, simple eh?</p>
<p> <code><=></code> is the &#8220;swap operator&#8221;, or, as it is known in some circles (the depths of my twisted mind), the &#8220;swaperator&#8221;.<span id="more-478"></span> This operator will be overloaded. For example, <code><i>int</i> &lt;=&gt; <i>int</i></code> will swap the values of two integers, <code><i>container</i> &lt;=&gt; <i>container</i></code> will swap the elements of a container (but not necessarily all the values, if the elements are pointers), or perhaps just the pointers to the containers themselves (see the optimization section below). </p>
<h3>What this replaces</h3>
<p>Traditionally, swapping is done with a temporary variable as follows:<br />
<code><br />
temp = a;<br />
a = b;<br />
b = temp;<br />
</code></p>
<p>Though there are also a couple of &#8220;in place&#8221; swapping algorithms that don&#8217;t require the extra memory;</p>
<p>The XOR swap:<br />
<code><br />
a = a xor b;<br />
b = a xor b;<br />
a = a xor b;<br />
</code></p>
<p>And the arithmetic swap:<br />
<code><br />
a = a + b;<br />
b = a - b;<br />
a = a - b;<br />
</code></p>
<p>Though the general consensus is to just use the temp swap or library swap() call and let the compiler do with it what it will (illustrated <a href="http://big-bad-al.livejournal.com/98093.html">here</a>).</p>
<p>But it doesn&#8217;t matter, because we&#8217;re replacing all of these, up in here, with one line of code.</p>
<h3>What this gains</h3>
<p>It&#8217;s short. It&#8217;s also a lot easier to understand than the alternatives, and a lot harder to mess up. Also, the compiler can do static analysis (and perhaps runtime analysis) to determine the best (most optimized) swapping algorithm to use (see below).</p>
<h3>Implementation and Optimization</h3>
<p>The compiler can look at the size of the thing being swapped and decide if it wants to do a temp swap, an xor swap to save memory, or simply treat the values being swapped like pointers and swap memory addresses in nearby access contexts.</p>
<p>One problem with certain swap algorithms (such as the xor swap) is that it doesn&#8217;t work if a.) the values are pointing to the same address or b.) the values are pointing to addresses that overlap. In IPL, there won&#8217;t be support for pointer arithmetic, and variables should be allocated in such a way that they do not overlap in memory. But the first issue of variables pointing at the same address might still come up.</p>
<p>I propose for static analysis to take us as far as it can regarding swapping the same address. For example, anything of the form <code>a &lt;=&gt; a</code> should be treated as a noop and compiled out. If multiple pointers/references point to the same thing, and this can be proven at compile time, then a noop will be recognized:<br />
<code><br />
a = &#038;c;<br />
b = &#038;c;<br />
*a <=> *b; // noop<br />
</code></p>
<p>If it can be proven that the swap will swap two values with <u>distinct</u> addresses but <u>identical</u> values, then the swap can be treated as a noop:<br />
<code><br />
a = "blah";<br />
b = "blah";<br />
a <=> b; //noop, should be compiled out<br />
</code><br />
<code><br />
void doSomeStuff(var a, var b)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;...<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (a == b)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a <=> b; // noop, because a must equal b in this context<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// or this line won't be reached<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>If it can not be proven that the swap is a noop, then a typical swap instruction sequence will be generated by the compiler. For example:<br />
<code><br />
a = waitForUserInput();<br />
b = waitForUserInput();<br />
a <=> b; // a &#038; b could be the same or different, don't know until runtime<br />
</code></p>
<p>generates:<br />
<code><br />
a = waitForUserInput();<br />
b = waitForUserInput();<br />
temp = a;<br />
a = b;<br />
b = temp;<br />
</code></p>
<p>Of course, in simple static contexts, the values don&#8217;t actually need to be swapped, even if swapping them is a noop. <a href="http://big-bad-al.livejournal.com/98093.html">As can be seen here</a>, it is entirely possible for the compiler to simply do a static register swap from the access context of swapped variables. For example, the following code:<br />
<code><br />
void blah(var a, var b)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;Println("BEFORE: a = " + a + ", b = " + b);<br />
&nbsp;&nbsp;&nbsp;&nbsp;a <=> b;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Println("AFTER:  a = " + a + ", b = " + b);<br />
}<br />
</code></p>
<p>Could easily have the swap line removed completely and the variable accesses themselves swapped statically, to generate the equivalent of the following:<br />
<code><br />
void blah(var a, var b)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;Println("BEFORE: a = " + a + ", b = " + b);<br />
&nbsp;&nbsp;&nbsp;&nbsp;Println("AFTER:  a = " + b + ", b = " + a);<br />
}<br />
</code></p>
<h3>Summary</h3>
<p>In short, <code>a <=> b</code> is less typing, taking only one line of code. The <code><=></code> operator is built into the language, so it can be used from any context without having to include some library (like with std::swap). <code><=></code> is the only thing you should ever need to use to swap two variables. Forget about the implementation details, forget about clever but non-intuitive tricks with bitwise operators or abelian groups. In the IPL, the compiler will do all the dirty work for you. If all you want is for two variables to exchange values, you can count on <code><=></code>. </p>
<h3>Addendum</h3>
<p>Just before posting this, I did a good old fashioned last-second Google search and found that <a href="http://cs.oberlin.edu/~jwalker/opal/proposeAdd/swap.html">I am not the first to propose</a> <a href="http://www.mail-archive.com/digitalmars-d@puremagic.com/msg13770.html">such an operator with such a syntax</a>. If two or more people think it&#8217;s a good idea, then it has to be a good idea!</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/09/ipl-the-swaperator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hack is Wack</title>
		<link>http://lifesnotsimple.com/index.php/2010/09/hack-is-wack/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/09/hack-is-wack/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 14:38:18 +0000</pubDate>
		<dc:creator>ren</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Ren]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=463</guid>
		<description><![CDATA[I read that Nortorn—you know, the security company that has been bogging down your computer since 1962—had teamed up with Snoop Dogg to host an online rap competition where the subject matter is cyber-crime.
“No way.  No—that’s fucking impossible.”

Cyber-crime is real, dawg.

First of all, being a computer programmer by profession, I was shocked to learn [...]]]></description>
			<content:encoded><![CDATA[<p>I read that Nortorn—you know, the security company that has been bogging down your computer since 1962—had teamed up with Snoop Dogg to host an online rap competition where the subject matter is cyber-crime.</p>
<p>“No way.  No—that’s fucking impossible.”</p>
<p><img src="/wp-content/uploads/2010/09/hackiswack.png" alt="Photo of one contestant about to start rapping." /></p>
<p><a href="http://www.hackiswack.com/index.php/home/viewvideo/49/hack-is-wack/cybercrime-is-real.html">Cyber-crime is real, dawg.</a></p>
<p><span id="more-463"></span></p>
<p>First of all, being a computer programmer by profession, I was shocked to learn that cyber-crime is such a big deal.  I live in a city in the United States where gang violence continuously thrives in a spacious, sprawling, low-economy ghetto that everyone turns a blind-eye towards, assuming they can afford to do so.  It’s a place where the middle-class and above go to bed at night pretending that people five blocks over aren’t being murdered just because they maybe won the wrong game of basketball or something.  I’m adjusted to the concept of crime being all around me.</p>
<p>But not in my <em>work-place</em>.  So you probably can’t imagine my surprise to learn that cyber-crime is such a threat.  For example, I never knew about ‘drive-by downloads’.  As Norton describes them on the contest site:</p>
<blockquote><p>You’re sitting in front of your computer surfing the Web when all of a sudden, your computer is hit with a threat just because you visited an infected website. Drive-by downloads can catch you off guard, just like crime on the street, if you don’t have t he right protection.</p></blockquote>
<p>“Just like crime on the street….”  Indeed.  Like earlier today I clicked on a link to read a tech blog, and a pop-up advertisement came up unexpectedly.  Maybe it was downloading something!  Until today I never realized how similar experiences like that are to the time I rounded a corner downtown in the car with my ex-girlfriend, to the sight of two police cars, and a number of police officers chasing down two men with their guns drawn.  It was like a pop-up ad, <em>but on the streets.</em></p>
<p>That shit was whack.</p>
<p>What I also didn’t realize is that there must be some sizable intersection between</p>
<ol>
<li>Hard-ass rappin’ gangstas dat know how to drop dat shit fo realz.</li>
<li>Security-conscious youth interested in staving off online crimes.</li>
</ol>
<p>I thought that maybe I fit into that intersection, but then it occured to me that I don’t belong in either of those categories to begin with.  So oh well.</p>
<p>I also thought it may be fun to try and compose a rap to send in.  But it turns out that rapping is <em>hard</em>.  This was a revalation, as I had always thought that the best rappers were those who were ‘eductionally challenged’ and never developed the proper literary skills—such as ‘a vocabulary’—to create any type of poem or verse, let only observe the rules of rhyme and meter.  What they do is well beyond my abilities.</p>
<p>But that doesn’t mean I’m not going to try to come up with <em>something</em>.  I did just recently buy a laptop with a web-cam, that’s a first for me.  And I have a microphone somewhere around here.  And it’s a long weekend (got Monday off work).  And I’ll probably be drunk at some point… Hmm…</p>
<p>Let’s see where this goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/09/hack-is-wack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dear Anime Intro</title>
		<link>http://lifesnotsimple.com/index.php/2010/09/dear-anime-intro/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/09/dear-anime-intro/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 15:10:32 +0000</pubDate>
		<dc:creator>skrath</dc:creator>
				<category><![CDATA[Letters]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Anime]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[intro]]></category>
		<category><![CDATA[japanese]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=450</guid>
		<description><![CDATA[Dear Anime Intro,
Listen, we need to talk. This is getting pretty ridiculous. I know you mean well, but enough is enough. You need to go back on your meds. In case you didn&#8217;t know, I don&#8217;t enjoy having seizures when I watch you. Similarly, I do not enjoy listening to horrible music with horrible English [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Anime Intro,</p>
<p>Listen, we need to talk. This is getting pretty ridiculous. I know you mean well, but enough is enough. You need to go back on your meds. In case you didn&#8217;t know, I don&#8217;t enjoy having seizures when I watch you. Similarly, I do not enjoy listening to horrible music with horrible English about how life is a painful flower or something else not even remotely related to the show.</p>
<p>Seriously. Are you drunk? Is it all some big joke? Do you do this because you hate me? Do you even like animes? I don&#8217;t think you do. I think you hate them, and you won&#8217;t rest until you&#8217;ve convinced everyone else that all animes are a bunch of teenage twats running around like morons bitching about how sad everything is while they hunt vampires or some shit. I don&#8217;t know what you&#8217;re trying to tell me, really.</p>
<p><span id="more-450"></span>And for the love of Christ, shut up already! I think it&#8217;s great that you found a 22-year-old eunuch to sing for you, but guess what? He sucks. Also, his English is horrible. Not only does it not make sense, it&#8217;s a fucking Japanese show! Why is he using English? That&#8217;s not how you say that word! That&#8217;s not a phrase we use! That&#8217;s not even a complete sentence!</p>
<p>Alright, maybe you mean well. I don&#8217;t know. Maybe you were abused as a child and that&#8217;s why you don&#8217;t understand the concept of allusion or plot encapsulation. Maybe all those times you were beaten with a broken garden rake destroyed your ability to understand the difference between good music and the noise that goats make when you skin them alive. Maybe because you missed out on all those therapy sessions, you thought it would be a great idea to completely reinvent yourself every twelve episodes. It&#8217;s not your fault you have a massive personality disorder.</p>
<p>Just stop already. OK? Please? Look, you&#8217;re not the intro to Samurai Champloo, alright. You&#8217;re just not. You&#8217;re like a dangerous snake I stumbled upon in the woods, all brightly colored and hissing and trying to bite my fucking eyeball. I don&#8217;t want that. I like my eyeballs the way they are: fully functioning and not bursting apart with venom.</p>
<p>I really wish it didn&#8217;t have to be this way. Maybe one day you&#8217;ll be better and I won&#8217;t have to skip past you every time. Maybe you just need to stick with Yoko Kanno. Yeah, just do that. Just play some random music from her and show a title screen. Simple, basic letters. Tone it down, you know? But that&#8217;s not going to happen. We both know that. Because you&#8217;re a dumb slut.</p>
<p>Anyway, I&#8217;m dating your sister, the show. She&#8217;s got pacing and content. Sure, sometimes I&#8217;m just left standing in the dark, confused about why there&#8217;s blood everywhere, but it makes sense in the end, and I&#8217;m good with that.</p>
<p style="text-align: right;">Sincerely, the viewer</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/09/dear-anime-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPL &#8212; Null Safety</title>
		<link>http://lifesnotsimple.com/index.php/2010/09/ipl-null-safety/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/09/ipl-null-safety/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 17:56:08 +0000</pubDate>
		<dc:creator>wall</dc:creator>
				<category><![CDATA[IPL -- the Ideal Programming Language]]></category>
		<category><![CDATA[IPL]]></category>
		<category><![CDATA[non-humor]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=438</guid>
		<description><![CDATA[This one&#8217;s straight up from Groovy: The ?. operator. Also known as the &#8220;safe navigation&#8221; operator, its use in Groovy is as follows:

def playerName = player?.name


&#8230;although I don&#8217;t know what I think about the def keyword, so for IPL let&#8217;s just pretend playerName has already been declared and is merely being assigned:

playerName = player?.name;

Also, I [...]]]></description>
			<content:encoded><![CDATA[<p>This one&#8217;s straight up from Groovy: The <code>?.</code> operator. Also known as the &#8220;safe navigation&#8221; operator, its use in Groovy is as follows:<br />
<code><br />
def playerName = player?.name<br />
</code><br />
<span id="more-438"></span><br />
&#8230;although I don&#8217;t know what I think about the <code>def</code> keyword, so for IPL let&#8217;s just pretend playerName has already been declared and is merely being assigned:<br />
<code><br />
playerName = player?.name;<br />
</code></p>
<p>Also, I guess I&#8217;m closing my statements with semicolons out of habit, but I haven&#8217;t thought about whether or not I like that. We&#8217;ll keep it up for now.</p>
<p>If player is <code>null</code>, then the entire expression <code>player?.name</code> evaluates safely to <code>null</code> as well, which is then assigned to <code>playerName</code>. No NullPointerException is ever thrown, as long as you use <code>?.</code> and not <code>.</code>. Why is this a good thing? Because it saves us from having to write:</p>
<p><code><br />
if (player != null)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;playerName = player.name;<br />
}<br />
else<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;playerName = null;<br />
}<br />
</code></p>
<p>Of course, what if you actually wanted to set playerName to something else, like the empty string? The way this is handled in Groovy (and Java 7 seems to be <a href="http://blogs.infosupport.com/blogs/peterhe/archive/2009/03/02/Java-7-and-the-Elvis-operator.aspx">heading in this direction</a>, although the author of <a href="https://docs.google.com/Doc?docid=ddb3zt39_78frdf87dc&amp;hl=en">this paper</a> &#8220;does not specifically advocate adding these features to the Java programming language&#8221;) is to use something called the Elvis operator:<br />
<code><br />
playerName = player.name ?: "";<br />
</code></p>
<p>This appears similar to, but should not be confused with, the traditional <a href="http://java.about.com/od/t/g/ternaryoperator.htm">ternary operator</a> for simplifying branching logic. The above statement would appear as follows using the ternary operator:<br />
<code><br />
playerName = player.name != null ? player.name : "";<br />
</code></p>
<p>Which is just a little more verbose. I&#8217;m not sure if I would like to see the ternary operator in IPL, so I will defer my opinion on that for the time being.</p>
<p>One final safety operator defined in the above Java paper is the safe indexing operator <code>?[]</code>. After all, if a null instance can have its member variables attempt to be accessed, a null container can have its elements attempt to be accessed too. I would recommend using this in IPL if <code>?.</code> and <code>?:</code> are going to be adopted.</p>
<p>As mentioned in the comments <a href="http://blogs.infosupport.com/blogs/peterhe/archive/2009/03/02/Java-7-and-the-Elvis-operator.aspx">here</a>, things can get messy with long chains of dereferencing:<br />
<code><br />
final String aMember = g?.members?[0]?.name ?: "nobody";<br />
</code></p>
<p>There are several interesting proposals for how to simplify the above line of code, which looks like it was hit with one of the Riddler&#8217;s frag grenades. Well, if <code>?</code> now represents null safety, why not create a new assignment operator, <code>?=</code>, that makes the entirety of the right side implicitly null safe. Then the above line of code would become:<br />
<code><br />
final String aMember ?= g.members[0].name ?: "nobody";<br />
</code></p>
<p>I&#8217;m not sure I like the question mark symbol used for this sort of thing, but I also don&#8217;t know of what the &#8220;ideal&#8221; symbol is off the top of my head.</p>
<p>The point of all of these shorthands isn&#8217;t to encourage people to ignore null checks, it&#8217;s to minimize the typing they have to do to handle them. Also, if a null value should be considered an exception, then simply use the traditional <code>.</code> or <code>[]</code> operators.</p>
<p>As always, feedback is welcome in the comments. In fact, I will be traumatized if there is no feedback, so get to it!</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/09/ipl-null-safety/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review: Ergo Proxy</title>
		<link>http://lifesnotsimple.com/index.php/2010/08/review-ergo-proxy/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/08/review-ergo-proxy/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 12:04:44 +0000</pubDate>
		<dc:creator>ren</dc:creator>
				<category><![CDATA[Anime]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[sci-fi]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=405</guid>
		<description><![CDATA[Dai Satou must believ that the Earth is totally going to be fucked one of these days.  He is the chief script-writer of Erge Proxy, and of another show that I really enjoyed: Eureka Seven.  In both shows, the enviromental status of Earth is… not great.  Maybe that’s something of a spoiler [...]]]></description>
			<content:encoded><![CDATA[<p>Dai Satou must believ that the Earth is totally going to be fucked one of these days.  He is the chief script-writer of Erge Proxy, and of another show that I really enjoyed: Eureka Seven.  In both shows, the enviromental status of Earth is… not great.  Maybe that’s something of a spoiler for Eureka Seven?  I doubt it.</p>
<p>Unlike Eureka Seven, you learn very quickly in Ergo Proxy that the Earth is totally fucked.  Presumabably by some apocolptyic, poor decision by man-kind.  Is it worth watching the series to figure out those wrongs and how one might right them?  Let me tell you…</p>
<p><span id="more-405"></span></p>
<h2>The Focus</h2>
<p>Ergo Proxy resolves primarily around the interactions between three characters:</p>
<ol>
<li>Vincet Law, a young man trying to overcome his status as an immigrant.</li>
<li>Re-l Mayar, a young woman who is the grand-daughter of a city leader.</li>
<li>Pino, a child girl who is a robot.</li>
</ol>
<p>And then there are a number of imporant, ancillary characters.  The cast is fleshed out well enough that you can begin to care about the other characters even if they only appear once every three or four episodes.</p>
<p>And that is very crucial, because Ergo Proxy is very much a character-driven anime.  While there are some action scenes, and some cool battles, the majority of your interest in the show will depend on your ability to be interested in the main characters and their personal developments.  Many anime forego the volley of visceral action in favor of a more character-oriented show, drawing you in by tempting you with what may become of the personas involved.  For Ergo Proxy, this is somewhat of an odd choice, only because the backdrop for the show feels very fertile for an all-out action anime.  Like I said, Ergo Proxy has it’s fights—even the first episode is not without a little tussle—but it’s interesting that the action always feels like a second class citizen to the character development.  A desolate Earth where humanity struggles against extinction by barracading themselves in domed-cities, where the power hungry chosen few dictate the lives of the masses, where segregation exists between citizens and immigrants, humans and robots, this social bureau and that bureau—you could derive <em>constant</em> action from all of that.</p>
<p>Ergo Proxy does not do this.</p>
<p>The focus is primarily on the characters.  To such an extent that there is one episode consistening entirely of just dialog between the three main characters mentioned above.  <em>Nothing significant happens.</em>  It is a true credit to Ergo Proxy that…</p>
<ol>
<li>It can even get away with such an episode to begin with.</li>
<li>That it’s actually one of my favorites, because the character dynamics are so entertaining.</li>
</ol>
<h2>The Gist</h2>
<p>It’s hard to talk about the plot of Ergo Proxy without spoiling things, and I don’t intend to do so.  I think Dai Satou is a great writer, and he wrote a great tale in Ergo Proxy, one with complicated and intricate threads that make it difficult for me to dance around the plot in a general sense.  But I’ll try to tango over the first episode anyways.</p>
<p>Basically a large chunk of humanity is living within the beautiful, dome-covered metropolis of Romdeau (maybe misspelled).  It is a city where every person has their role to play in ensuring that society continues on, because outside of the dome is a shitty waste-land; how the planet got that way is never <em>exactly</em> explained, but you get enough hints to understand that it probably involved some dumb-ass scientists fucking shit up for everyone.  For the people in Romdeau, however, the outside doesn’t matter.  It may as well not even exist, because their lives are great in general.  So long as everyone follows the rules and behaves as a ‘model citizen’ (as is often chanted in the background), then life is full of rainbows and sunshine.</p>
<p>The city of Romdeau is run by the man Donovon Mayar and some nude Greek statues who can talk—seriously.  His grand-daughter, Re-l Mayar, works with her ‘autoreiv’ (i.e. robot) companion Iggy as part of a department that, among other things, deals with infected autoreivs.  Ergo Proxy begins with Re-l tracking down an autoreiv who has been infected with the ‘cogito virus’, a virus by which the autoreivs lose their subservience and grow a soul.  This brings her into contact with Vincent Law, a man working in a lower-rung department who is trying to get his shit together so that he can drop his immigrant status and become a full-fledged citizen of Romdeau; because until then, everyone can, and does, shit all over the guy.  During the first episode, Vincent goes over to the home of the Chief Security Bureau to check one of their autoreivs for the cogito virus; that autoreiv is Pino, the little girl I mentioned earlier.  While some robots in the city are laborers, some exist simply to provide companionship.  Pino falls into this latter case, because the city strictly controls natural child-birth, and so Pino is given to the family as a daughter.</p>
<p>That is how the first episode introduces the three main characters, and maybe covers the first half.  After that, shit hits the fan, and the status is elevated to <em>on</em>.</p>
<h2>Closing Thoughts</h2>
<p>I found the character designs to be very interesting, from an artistic perspective.  Things like Re-l Mayar’s signature heavy eye shadow, and the facial voids of the autoreivs give Ergo Proxy a curious face.  The show does a great job in portraying a lot emotion through facial expressions, achieved through a combination of said design and camera angles—Ergo Proxy knows how to do a great close-up shot, let me put it that way.</p>
<p>I only saw the show in Japanese, and the voice acting was great.  In particular for Pino, whose child-like curiosity and naivety really comes across in a sincere way; despite being a robot, she never speaks like one, and the voice actress did an amazing job capturing a real innocence in her voice.  The same praises can be sung for most of the actors and actresses, who display a wide variety of emotion in their performances, and thankfully are even given the chance to due so via the show’s structure.  Had Ergo Proxy been filled with more one-dimensional characters, there would be next to nothing to say of the voice acting.  Instead the show well fleshes out a small cast, and in doing so allows for some great performances.</p>
<p>There is a sound-track to the show, but to be honest I barely noticed it.  I never remember the music of Ergo Proxy being an important element, or being key to some particular revelation or suspenseful moment.  It certainly never <em>hurt</em>, but there was no moment where I ever thought to myself that a scene would have been better served by this or that music.  Although I have to say, there is something about the opening song that I <em>really</em> love, ‘Kiri’ by Monoral.  I could play that on loop for quite a while.</p>
<p>If you want a sci-fi, post-apolyptic show with fantastic characters and a plot with tantalizing mysteries, then you will enjoy Ergo Proxy.  You’ll need some patience as you wait for explanations as to what’s going on—Dai Satou seems to always do that—but you will be well-rewarded.  The show has its great moments of action here and there, and some genuinely cool fight scenes, but the camera is always on the characters and what they are thinking and feeling.  If you don’t love the main characters, you’re just not going to enjoy Ergo Proxy that much, simply said.</p>
<p>I thoroughly enjoyed Ergo Proxy and would recommend it to any anime fan.</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/08/review-ergo-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPL &#8212; The &#8220;when&#8221; Construct</title>
		<link>http://lifesnotsimple.com/index.php/2010/08/ipl-the-when-construct/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/08/ipl-the-when-construct/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 21:51:09 +0000</pubDate>
		<dc:creator>wall</dc:creator>
				<category><![CDATA[IPL -- the Ideal Programming Language]]></category>
		<category><![CDATA[IPL]]></category>
		<category><![CDATA[non-humor]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=408</guid>
		<description><![CDATA[In the last installment of IPL, I talked about moments. To recap: a moment is a unit of time during which all instructions happen together. That is, no instruction inside a moment can happen before or after any other instruction. The previous article explains the benefits, limitations, and specifics of such a system.
In this article, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lifesnotsimple.com/wp-content/uploads/2010/08/ftwhen.png"><img src="http://lifesnotsimple.com/wp-content/uploads/2010/08/ftwhen.png" alt="" title="ftwhen" width="96" height="96" class="alignleft size-full wp-image-445" /></a>In the <a href="http://lifesnotsimple.com/index.php/2010/08/ipl-moments/">last installment</a> of IPL, I talked about moments. To recap: a moment is a unit of time during which all instructions happen together. That is, no instruction inside a moment can happen before or after any other instruction. The previous article explains the benefits, limitations, and specifics of such a system.</p>
<p>In this article, I want to talk about a keyword that extends the functionality and flexibility of moments in a simple manner. It is the &#8220;<code>when</code>&#8221; keyword, and it has the following syntax:<br />
<code><br />
when <em>moment-specifier</em><br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<em>moment-safe instructions</em><br />
}<br />
</code><span id="more-408"></span><br />
Notice that &#8220;<code>when</code>&#8221; is a block construct: it is followed by a brace-enclosed list of instructions, similar to if, for, and while blocks in many other languages. I want to take this time to say that I am following conventional syntax for simplicity&#8217;s sake, but I am more interested in the semantics. Still, if you have any thoughts on the ideal syntax for anything I bring up, feel free to mention it in the comments.</p>
<p>What &#8220;<code>when</code>&#8221; does is extend an existing moment with new instructions. This is super powerful as it allows you to edit logic distantly. This is also super dangerous as it allows you to edit logic distantly.</p>
<p>The component of this construct that needs the most explaining is that strange yet powerful <em>moment-specifier</em>. A moment specifier is a means of telling the compiler which moment this <code>when</code> construct is referring to. If you recall from the last article, the syntax for a moment is this:<br />
<code><br />
moment <em>&lt;label&gt;</em> {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<em>moment-safe instructions</em><br />
}<br />
</code></p>
<p>The &#8220;label&#8221; in this syntax is optional, but it is necessary if you wish to access this moment from a <code>when</code> block somewhere else in code. The label of a moment can be used as the moment-specifier of a <code>when</code> statement.</p>
<p>Here is an example of how this would be used. Let&#8217;s say you have a first person shooter (yes, all of my examples will probably be game related), and in this shooter you want to have your enemies &#8220;wake up&#8221; when the player fires a shot. By &#8220;wake up&#8221;, I mean simply become aware of the player and start path finding toward them.</p>
<p>It might look something like this:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;moment shoot<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p><code><br />
// in enemy.ipl<br />
class Enemy<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;when Player.shoot<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;targetPlayer = the Player;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>Okay, I&#8217;ve taken some liberties and shown an IPL feature that I haven&#8217;t written about yet. For now, let&#8217;s just assume that &#8220;the Player&#8221; just works, and by works I mean it resolves to the instance of Player upon which the shoot moment is occuring. I think it would be interesting to see the definite article used in a programming language as a cleaner way of accessing singleton instances, as well as accessing instances of non-singleton classes in non-ambiguous contexts (such as inside an iterator loop). But that can wait until a future article.</p>
<p>The things we should focus on here are the shoot moment declared in player.ipl, and the when block in enemy.ipl that allows the enemy to respond to the player shooting. What this illustrates is that the way the game behaves when the player shoots is split up into separate locations. How would we accomplish this in a language without moments? There are a few ways I can think of:</p>
<p>1.) Tell the enemy to wake up from inside the player class&#8217;s <code>shoot()</code> method. This is bad as it requires the player class to be responsible for all enemies in the game.</p>
<p>2.) Check to see if the player has just shot from the enemy&#8217;s <code>update()</code> method every frame. This transfers the responsibility of enemy alertness from the player to the enemy itself, where it should be, but it has its own problems. There needs to be a variable stored somewhere called &#8220;playerJustShot&#8221; or something, probably in the player class, and this variable needs to be set to true when the player shoots and false after some period of time. &#8220;Some period of time&#8221; requires creating timer logic. You could just set it to false on the next frame of the player&#8217;s update method, but you need to make sure the order of things is correct (remember what I said last time about how painful order is to keep track of in update logic?). For example, if the player shoot occurs and sets playerJustShot to true, then the player update occurs and sets it to false, and <em>then</em> the enemies&#8217; update logic occured, then enemies would never become alert because they would never check that variable in the slice of time that it could possibly be set to true. Finally, if there are multiple players in the game (coop), then each enemy needs access to every player to check this variable.</p>
<p>3.) Use a message dispatch system. Inside the player&#8217;s <code>shoot()</code> method, call <code>messageManager.sendMessage(hShootMessage);</code>. Inside the enemy&#8217;s <code>handleMessages(Message m)</code> method, check to see if this message is received and respond accordingly. The player is not responsible for knowing <em>how</em> this message will be used, they are just responsible for broadcasting it. And the enemy is not responsible for knowing what caused this message to be sent to them, they are just responsible for reacting to it. This is a good solution in that it decouples the player from the enemy, but the syntax is bloated (<code>hShootMessage</code>, and all other messages, must be initialized at some point) and the message calling has a runtime overhead.</p>
<p>In fact, you can think of the <code>when</code> construct as a message system built into the language, one that requires less typing and provides compile-time (more optimized) message resolution. <code>when</code> allows us to fully decouple player and enemy logic from each other at <strong>type-time</strong>, but to couple them back together at <strong>compile time</strong>. This is great because it keeps the logic clean and easy to reason about for humans composing the system, yet brings things together for cache optimization and such when the game is built. I imagine that at compile time, the above moment would actually be treated as if it was a method call that looked like:<br />
<code><br />
void whenPlayerShoot(Player thePlayer, List allEnemiesInTheGame)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(thePlayer.position + thePlayer.muzzleOffset, thePlayer.heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(thePlayer.gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;for each enemy in allEnemiesInTheGame<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enemy.alert = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enemy.targetPlayer = thePlayer;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>It is easily seen that this produces the results of a message-handling system (decoupling of related events) without the overhead of having to call <code>messageManager.sendMessage()</code> or <code>messageListener.handleMessages()</code> at runtime.</p>
<p>So far so good, but I haven&#8217;t explained what it is that causes the moment <code>Player.shoot</code> to even occur. Moments are like methods in that they aren&#8217;t going to call themselves. But also, like methods, they can be called:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;void update()<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>if (inputManager.shootKeyJustPressed())</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>shoot();</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;moment <span style="color: #000000;"><b>shoot</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>or chained:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>when inputManager.shootKeyPressed</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>shoot();</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;moment <span style="color: #000000;"><b>shoot</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code></p>
<p>or chained with smaller syntax:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;moment shoot<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;} <span style="color: #000000;"><b>when inputManager.shootKeyPressed</b></span><br />
}<br />
</code></p>
<p>or used with all sorts of logical constraints:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>ammo = 100;</b></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;moment shoot<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ammo--;<br />
&nbsp;&nbsp;&nbsp;&nbsp;} when inputManager.shootKeyPressed <span style="color: #000000;"><b>&amp;&amp; ammo+</b></span> //ammo+ is the same thing as "ammo &gt; 0"<br />
}<br />
</code></p>
<p>and I mean all sorts of logical constraints:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;ammo = 100;<br />
&nbsp;&nbsp;&nbsp;&nbsp;moment shoot<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ammo--;<br />
&nbsp;&nbsp;&nbsp;&nbsp;} <span style="color: #000000;"><b>when (inputManager.shootKeyPressed || scriptedShootOccurs) &amp;&amp; (ammo+ || gameManager.cheatModeEnabled) &amp;&amp; !gameManager.paused</b></span><br />
}<br />
</code></p>
<p>which could make your moment declaration verbose, except that you can encapsulate moment-controlling logic just like any other logic:<br />
<code><br />
// in player.ipl<br />
class Player<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;ammo = 100;<br />
&nbsp;&nbsp;&nbsp;&nbsp;moment shoot<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;projectileManager.spawnProjectile(position + muzzleOffset, heading);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soundManager.playSound(gunshotSound);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ammo--;<br />
&nbsp;&nbsp;&nbsp;&nbsp;} when <span style="color: #000000;"><b>shootInput</b></span> &amp;&amp; <span style="color: #000000;"><b>canShoot()</b></span> &amp;&amp; !gameManager.paused</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>moment shootInput {} when inputManager.shootKeyPressed || scriptedShootOccurs</b></span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;"><b>bool canShoot()<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return ammo+ || gameManager.cheatModeEnabled;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</b></span><br />
}<br />
</code></p>
<p>Okay, I&#8217;m moving pretty fast. I think there are a lot of neat things you can do with moment logic and the <code>when</code> keyword that let you organize your code base however you want. And I think IDEs can be set up to do a read only display of all instructions related to a single moment at the press of a button so you can look at them side-by-side to fix the problem of scattering that moments can bring to the table. </p>
<p>Just to clarify for anyone who has not read this series in its entirety, IPL is not a real language (yet), I am just brain-storming and free writing some ideas that I&#8217;ve had over the years. As such, feel free to make suggestions to improve things (like Ren&#8217;s suggestion of not requiring the &#8220;numeric&#8221; keyword, which you will notice is lacking from the &#8220;ammo&#8221; declaration in the above examples). Really, I think there&#8217;s a lot more to be said about moments, which I might put into future articles. In the meantime, I hope this is enough to get the general idea out there simmering in peoples&#8217; brains.</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/08/ipl-the-when-construct/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>IN: Two Last Words</title>
		<link>http://lifesnotsimple.com/index.php/2010/08/in-two-last-words/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/08/in-two-last-words/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 15:32:53 +0000</pubDate>
		<dc:creator>ren</dc:creator>
				<category><![CDATA[Game Walkthrough]]></category>
		<category><![CDATA[Guides]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[touhou]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=402</guid>
		<description><![CDATA[I mentioned in a previous post that I&#8217;ve been playing Imperishable Night a lot, which has been true for probably a year now or longer.  I thought it would be fun to put up a short video showing off how to beat two of the Last Word Spells, Saigyouji Flawless Nirvana (221) and Emperor [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned in a previous post that I&#8217;ve been playing Imperishable Night a lot, which has been true for probably a year now or longer.  I thought it would be fun to put up a short video showing off how to beat two of the Last Word Spells, <em>Saigyouji Flawless Nirvana</em> (221) and <em>Emperor of the East</em> (208).  The Last Words are additional boss attacks that you unlock for various accomplishments in the game.  In the video I used the Forbidden Team for beating both of them, because currently that&#8217;s my favorite team to play.  But using them can be challenging, especially on 208.  The reason is that Marisa and Alice are both the fastest and the most powerful team in the game.  However, their huge disadvantage compared to all the other teams is that they can only fire straight-forward, with minimal spread in their attack.  So you have to be right under a boss to be hitting them, which is what makes 208 difficult with this team.</p>
<p>You&#8217;ll also see me sometimes quickly switching between Marisa and Alice.  This is not by accident.  By doing this you get the effect of having Alice&#8217;s beam stay active <em>and</em> Marisa&#8217;s bullets—the so-called ‘Malice Cannon’. It’s a very useful trick getting through the game with that team, as you can use it to beat some bosses very, very quickly.</p>
<p>Anyways, <a href="/wp-content/uploads/2010/08/touhou.avi">enjoy the 11MB video</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/08/in-two-last-words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPL &#8212; Moments</title>
		<link>http://lifesnotsimple.com/index.php/2010/08/ipl-moments/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/08/ipl-moments/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 00:46:34 +0000</pubDate>
		<dc:creator>wall</dc:creator>
				<category><![CDATA[IPL -- the Ideal Programming Language]]></category>
		<category><![CDATA[AOP]]></category>
		<category><![CDATA[IPL]]></category>
		<category><![CDATA[moments (IPL)]]></category>
		<category><![CDATA[non-humor]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=369</guid>
		<description><![CDATA[
What is a moment?
A moment is an atomic unit of time. If two things happen in the same moment, then neither thing happens before or after the other.
This is a very useful semantic tool in the day-to-day thinking of the human mind, but it is surprisingly lacking in the domain of programming.

In this context, a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lifesnotsimple.com/wp-content/uploads/2010/08/ipl_moment.png"><img src="http://lifesnotsimple.com/wp-content/uploads/2010/08/ipl_moment.png" alt="" title="ipl_moment" width="96" height="96" class="alignleft size-full wp-image-448" /></a><br />
<h3>What is a moment?</h3>
<p>A moment is an atomic unit of time. If two things happen in the same moment, then neither thing happens before or after the other.</p>
<p>This is a very useful semantic tool in the day-to-day thinking of the human mind, but it is surprisingly lacking in the domain of programming.</p>
<p><span id="more-369"></span></p>
<p>In this context, a &#8220;moment&#8221; is a set of instructions in which order does not matter. That is, in a moment:<br />
<code><br />
a = 10;<br />
b = a;<br />
</code></p>
<p>has precisely the same result as:<br />
<code><br />
b = a;<br />
a = 10;<br />
</code></p>
<p>Unlike the norm in sequential programming paradigms, that a statement comes before or after another statement in a moment is irrelevant. After the above moment (either version) is executed, the result will be that both <code>a</code> and <code>b</code> have a value of 10.</p>
<h3>The problems this will solve</h3>
<p>The problem that inspired me to start looking into this tool is the initialization phase of game logic. In complicated games with dozens of systems, it is incredibly common to find bugs that occur because one system does not get initialized until after another system that depends on it already being initialized. What this costs the programmer (and this is especially costly if you are new to the project) is search time: when adding initialization logic to the program, you must search through the existing initialization logic for the right &#8220;time&#8221; to add your logic. Even though conceptually, there is no &#8220;time&#8221; passing in the game yet &#8212; it hasn&#8217;t even started!</p>
<p>This search time grows as the code base does, as there is more to sort through. And this problem doesn&#8217;t just happen during initialization; it can happen every frame. Games generally have an update loop, where things that happen every frame get calculated. Player input will be processed, physics calculations will be applied, the characters and objects in the world will be moved around, and the game state will be rendered (among other things). If these things do not happen in the correct order, bugs will occur. For example, the camera needs to be pushed outside of static meshes, or when it comes time to render the world you will see the insides of your geometry. This means the camera&#8217;s collision resolution must happen before the render phase uses the camera position and orientation to render the scene. Another example is if the player character has something attached to them, like a weapon in their hand. If this weapon is updating its position every frame to keep it lined up with the player&#8217;s hand, then this update must happen <span style="text-decoration: underline;">after</span> the player has moved, otherwise the weapon will lag behind the player and seem to be floating in space, always one frame behind where it should be.</p>
<p>This is because in sequential logic,<br />
<code><br />
player-&gt;position += player-&gt;velocity;<br />
weapon-&gt;position = player-&gt;position + offset;<br />
...<br />
render();<br />
</code></p>
<p>is remarkabley different from<br />
<code><br />
weapon-&gt;position = player-&gt;position + offset;<br />
player-&gt;position += player-&gt;velocity;<br />
...<br />
render();<br />
</code></p>
<p>In the first code snippet, the player gets moved properly (leaving the weapon behind), then the weapon gets moved back into the player&#8217;s hand, then the game is rendered and all is well. In the second snippet, the weapon gets moved to the player&#8217;s hand first (where it should have been last frame), then the player gets moved to wherever they want to be, leaving the weapon behind, and <span style="text-decoration: underline;">then</span> the game state is rendered, with the weapon constantly trailing behind where it should be. This is trivial to spot and fix in the above example, because all the code is treated as if it is in the same place, but in a real game such update logic would be scattered in many different files, and in order to understand the order of operations you will have to trace the call tree spread through all of these files.</p>
<p>&#8220;Scattering&#8221;, a term made popular by the Aspect Oriented Programming movement, is when a programming concern gets separated into several locations among several source files. This is considered bad, as it requires programmers modifying the system to have to search in many places to make sure the logic still holds after their modification. If I may be so liberal as to consider &#8220;updating the game&#8221; as a single high level concern, then the update loop is likely the most scattered concern I consistently see in game code. Every game object needs its own update method, and every system does too. There are countless ways the order of updating can go wrong, and they aren&#8217;t always intuitive or easy to spot even when looking at the bug.</p>
<h3>The solution</h3>
<p>Imagine if, upon creating a new updateable object for your game, you didn&#8217;t have to spend the time figuring out where in the sequence of steps the call to your update method should go. What if you could just write it, and the compiler could figure out precisely when it needs to get called.</p>
<p>The paradigm I am proposing will solve the issue of human error messing up sequential logic. It does this by treating such a scenario as &#8220;update&#8221; as not a sequence of events, but as a &#8220;moment&#8221;; just like how I argue we think of it. Of course, the computer can still execute its low level instructions sequentially, this is just a paradigm to remove some of the clutter from the high level domain in which the programmer is working.</p>
<p>Formally speaking, if a &#8220;sequence&#8221; is a set of ordered instructions, then a &#8220;moment&#8221; is a set of unordered  instructions. In this context, &#8220;unordered&#8221; means that the instructions can appear in any order in the source code and still produce the same executable (and runtime behavior). Of course, order of execution is still important (for correctness and cache optimizations). The key here is to improve human productivity by giving the responsibility of ordering to the compiler.</p>
<p>How does the compiler do this? Let&#8217;s consider our previous example (the wrong version):<br />
<code><br />
weapon-&gt;position = player-&gt;position + offset;<br />
player-&gt;position += player-&gt;velocity;<br />
...<br />
render();<br />
</code></p>
<p>The first step is to tag each instruction based on what it modifers, and what it depends on.<br />
<code><br />
weapon-&gt;position = player-&gt;position + offset;</p>
<div style="text-indent: 40px;">// <strong><span style="text-decoration: underline;">modifies:</span></strong> weapon-&gt;position <strong><span style="text-decoration: underline;">depends on:</span></strong> player-&gt;position, offset</div>
<p>player-&gt;position += player-&gt;velocity;</p>
<div style="text-indent: 40px;">// <strong><span style="text-decoration: underline;">modifies:</span></strong> player-&gt;position <strong><span style="text-decoration: underline;">depends on:</span></strong> player-&gt;position<i>(previous)</i>, player-&gt;velocity</div>
<p>render();</p>
<div style="text-indent: 40px;">// <strong><span style="text-decoration: underline;">modifies:</span></strong> <em>(nothing)</em> <strong><span style="text-decoration: underline;">depends on:</span></strong> weapon-&gt;position, player-&gt;position</div>
<p></code></p>
<p>The next step is to sort the instructions such that no instruction that depends on a variable appears before an instruction that modifies that variable. In this example, the instruction that modifies <code>player-&gt;position</code> will be moved to occur before the instruction that modifies <code>weapon-position</code>. This seems like a trivial accomplishment with just a few lines of code, but the kinds of bugs that this can move to compile time can be hard to track down at runtime. Also, I see no reason why dependency analysis can&#8217;t be done from one method to another &#8212; for example, if the <code>render()</code> call above modifies <code>player-&gt;position</code>, but also depends on <code>weapon-&gt;position</code>, which itself depends on <code>player-&gt;position</code>, then we have a dependency loop. This dependency loop is not obvious to a human reading this section of code since part of it lies in the encapsulated call to render() (which may very well be in a compiled library), but the compiler can quickly identify this and point it out. In this manner, moments can take away some of the hassle of scattering.</p>
<p>As long as there are no dependency loops, and as long as no variable gets assigned twice in the same moment, then this method should work flawlessly. I believe that dependency loops (such as <code>a = b; b = a;</code>) and multiple assignments (<code>a = 5; a = 10;</code>) inside of a moment should be treated as compile time errors. Dependency loops are bad because they leave no unquestionably ideal ordering for the compiler to work with, and multiple assignments are bad because no variable can have multiple values in the same moment (what would this mean?).</p>
<p>The syntax I propose for this feature is:<br />
<code><br />
moment <i>&lt;label&gt;</i> {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<i>moment-safe instructions</i><br />
}<br />
</code></p>
<p>This consists of the <code>moment</code> keyword and a set of moment-safe (dependently-safe, and singly assigned) instructions  wrapped in a standard brace block. The label is optional. In the uses this article scrutinizes, there is no need to label a moment. However, I have some ideas with moments that I will discuss in future articles where referring to a moment from a distance point in code will occur, at which point labeling moments becomes a necessity. It can also be useful to label moments for programmer readability. </p>
<h3>Regarding AOP</h3>
<p>My experience with Aspect Oriented Programming is only academic, and limited to AspectJ. And very limited at that. I know very little about AOP, or even AspectJ. As such, I welcome an expert insight into the matter.</p>
<p>AOP attempts to solve similar problems to Moments, namely by making code easier to manage with regards to the natural difficulties that arise from scattering and tangling. From what I understand, aspects tackle the issue of scattering by allowing a programmer to add what would be a copy-paste job spread throughout the code base to a single location, and aspects also tackle the issue of tangling by allowing a programmer to separate concerns (such as logging) from the actual method call to keep the method clean. However, they do not remove the responsibility of sequential reasoning from the programmer&#8217;s already busy mind. AspectJ has three kinds of advice: before, after, and around. &#8220;Before&#8221; advice gets executed before the join point it is assigned to, while &#8220;after&#8221; advice gets executed after the join point. Neither of these escape sequential reasoning. The third type of advice is &#8220;around&#8221;, which is similar to method overriding in OOP in that it can either replace or augment the join point&#8217;s code. Even if you choose to augment the join point, you must specify <em>when</em> the original join point gets called (via the <code>proceed()</code> call). Moments, on the other hand, have no &#8220;when&#8221; to answer to &#8212; or, more accurately, moments have <span style="text-decoration: underline;">precisely one</span> &#8220;when&#8221;, for they are temporally atomic. Anything happening at the same moment neither happens before nor after anything else in that moment.</p>
<p>I believe that there is a lot to be taken from AOP though. I have some AOP-like thoughts on modifying moments from distance places in code, but that topic should be an article of its own.</p>
<h3>Summary</h3>
<p>To summarize:</p>
<p>Moments are sets of instructions where order does not need to be specified by the programmer. Moments must be dependently safe: there can be no dependency cycles among the statements. Moments must also limit assignments to one per variable per moment: a variable can not equal two or more different values at the same moment. Any violations of these rules will be caught at compile time.</p>
<p>Moments make life easier for the programmer by deferring the determination of instruction order to the compiler for a well-defined set of instructions. On top of freeing up programmer brain cycles to focus on the problem at a higher level, this can have other benefits as an IDE could be made that sorts statements in a moment based on the programmer&#8217;s desire, independent of the original order the statements were added.</p>
<p>Please note that moments are a proposed language <i>feature</i>, not a ubiquitous necessity. It is perfectly fine to have sequential logic in the code that does not fall into a moment, just like it is perfectly fine to have procedural libraries in an OOP language, or vanilla Java in AspectJ.</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/08/ipl-moments/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Foxes, Phone Books, and Drugs</title>
		<link>http://lifesnotsimple.com/index.php/2010/08/foxes-phone-books-and-drugs/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/08/foxes-phone-books-and-drugs/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:51:10 +0000</pubDate>
		<dc:creator>ren</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[Anime]]></category>
		<category><![CDATA[drugs]]></category>
		<category><![CDATA[rage]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=359</guid>
		<description><![CDATA[Goddamn I hate the pressure of having to create.  When I am trying to brain-storm ideas for Life’s Not Simple, I often end up playing Imperishable Night, a vertical-scrolling shooter which you see here.  It’s known as a ‘bullet hell’ game, for obvious reasons.  Really—can you even see where the fuck I [...]]]></description>
			<content:encoded><![CDATA[<p>Goddamn I hate the pressure of having to create.  When I am trying to brain-storm ideas for Life’s Not Simple, I often end up playing Imperishable Night, a vertical-scrolling shooter which you see here.  It’s known as a ‘bullet hell’ game, for obvious reasons.  Really—can you even see where the fuck I am in that picture?</p>
<p><img src="/wp-content/uploads/2010/08/touhou-3.png" alt="Against Kaguya Horaisan’s first Last Spell on Hard difficulty" title="" /></p>
<p>On this night I didn’t do very well at the game, so it left me frustrated.  And now I just feel like ranting about random topics.</p>
<p><span id="more-359"></span></p>
<h2>Strike Witches</h2>
<p>Lately I went on an anime streak.  Some sudden impulse within compelled me to collect as much random anime as I could, and then sit motionlessly before my screen watching the imagery go by.  Some of it was awesome, some of it mediocre, and some of it I couldn’t stand one entire episode.</p>
<p>Strike Witches falls into that last category.</p>
<p>I keep seeing that show pop up on torrent sites that I frequent, which leads me to believe that <em>someone</em> actually enjoys that show.  Strike Witches is completely fucking retarded.  Here’s what I remember from the first episode:</p>
<ol>
<li>
<p>Aliens attack Earth with seriously awesome technology.  Somehow the planet isn’t completely enslaved.</p>
</li>
<li>
<p>We develop technology to fight back against them.  (Original plot so far—don’t you agree?)</p>
</li>
<li>
<p>That technology turns out to be leg attachments that give a person the ability to fly at incredible speeds.</p>
</li>
<li>
<p>The military, after developing this cool technology, hands it over to girls who have to be somewhere between the ages of eight and fourteen.  Because who the fuck knows why.</p>
</li>
<li>
<p>Oh and some of the girls know magic.</p>
</li>
<li>
<p>And one of them has a fox’s tail, did I mention that?</p>
</li>
</ol>
<p>I simply couldn’t tolerate the furry-mecha-lolita combination that is the heart of Strike Witches.  Oh and then there was this guy here, who helped created those mechanical legs:</p>
<p><img src="/wp-content/uploads/2010/08//sw-sepia.jpg" alt="The father of the protagonist." title="" /></p>
<p>I wanted to point out this image from the first episode because I realized something important when I first saw it: any anime character you ever see in a sepia flash-back is dead.  I didn’t even watch all of the first episode, but I can tell you right now that guy is dead.  That’s just the standard.  And I never realized it until watching Strike Witches.</p>
<p>I suggest you stay away from Strike Witches at all costs.  And if you actually enjoy it, I would love to hear why, so please e-mail me and let me know how it’s even tolerable to you.</p>
<h2>The Phone Book</h2>
<p>I am tired of coming home and finding a fucking phone book left in front of my door.  I don’t know how frequently this happens, but just from where I am sitting in my living room, I can see five phone books.  They have accumulated in less than a year.</p>
<p>The phone book is ‘The Yellow Pages’, put out by AT&amp;T.  The most recent one tossed before my abode was the ‘Companion’.  In other words, a smaller, more compact phone book.  It is meant to serve as an abridged reference to the more bulky, primary phone book.  Or at least that was my interpretation.  Flipping through it gives you the impression that it’s just a collection of advertisements; maybe there aren’t any phone numbers to begin with.</p>
<p>So today a co-worker was telling me how he got a three-hundred dollar ticket for throwing a cigarette out of his car.  But the mother-fuckers at AT&amp;T can dump the Oxford English Phone Book in front of my home as often as they want, and that’s some how legal?  I view their product as <em>garbage</em>, and therefore they are littering.  If I were to turn right back around and throw the phone book in front of their offices, I would get fined for littering.  To me that’s just horse-shit.  How does AT&amp;T have the right to arbitrarily burden me with disposing of paper waste?  When I’m done with a box of pizza, I don’t go back to Papa John’s and throw the fucking box before them and demand that they dispose of it for me.  But phone books are special—you can’t litter if the object you dismiss is a phone book.</p>
<p>Just try it.  Next time you’re riding down the interstate at seventy-five miles per hour, throw a phone book out your car window.  When the police officers arrive at the scene of the accident, just tell them AT&amp;T did the same to you.  (Note that this advice is probably bad and should not be followed, but deep-down I hope you do.)</p>
<h2>Medicine</h2>
<p>Man I hate taking medicine.  First of all, I can’t swallow pills.  No matter how tiny.  I just have a hard time doing it.  It was great when I was a child because my mother knew she would have to hide the medicine inside of something to trick me into digesting it.  Which meant I would get a surprise tasty treat, like pancakes with strawberry toppings—and hydrocodine.  “Hey I feel kinda funny…”</p>
<p>I sometimes get severe pain in the left temple of my head.  I’ve been taking medicine for that pain for quite a while, but naturally my body built up a tolerance, to where I was having to take more than I really should to ease the pain.  So recently my doctor bumped me up a notch to some new drug.  He warned me it may make me feel tired, that I shouldn’t take it and drive, all that typical drivel you hear and see on the labels of pill bottles.</p>
<p>Holy shit was he not joking.</p>
<p>My temple was starting to hurt, so I took one of the pills, and some ten minutes later I was in fucking Hallucination Land.  I thought that</p>
<ol>
<li>
<p>I broke my keyboard into many pieces.</p>
</li>
<li>
<p>I went out to dinner with two friends.</p>
</li>
<li>
<p>I played Dance Dance Revolution.</p>
</li>
</ol>
<p>Absolutely <em>none</em> of those things happened.  In reality I was rolling around in my bed, flipping out.  My head certainly didn’t hurt at all, but it is a very jarring experience to genuinely believe you did something that didn’t actually happen.  I’m sure every one of you gets that little bit of doubt sometimes when you wake up, about whether that dream was real or not.  Then you smack your alarm button and by then you realize you’re in the real world and away from the shackles of your mental fantasy.  That was not the case for me.  I don’t know how much time passed, but it was enough for me to think a lot of shit took place.</p>
<p><!--more--></p>
<p>So that’s just super fun.  I’m worried I’m going to have to take the medicine one day, and then when I come to I’ll be standing above a few dead bodies in a hotel six-hundred miles away from where I live, with only a note lying nearby that says, “The Phoenix flies at dawn”, written in my own hand-writting.</p>
<p>Speaking of which—medicine, not the Phoenix—time for me to take my nightly dose and hit the hay, as they say.</p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/08/foxes-phone-books-and-drugs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Shape Comics #3</title>
		<link>http://lifesnotsimple.com/index.php/2010/08/shape-comics-3/</link>
		<comments>http://lifesnotsimple.com/index.php/2010/08/shape-comics-3/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 13:43:25 +0000</pubDate>
		<dc:creator>wall</dc:creator>
				<category><![CDATA[Shape Comics]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[soda]]></category>

		<guid isPermaLink="false">http://lifesnotsimple.com/?p=336</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://lifesnotsimple.com/wp-content/uploads/2010/08/sc_003.png"><img src="http://lifesnotsimple.com/wp-content/uploads/2010/08/sc_003.png" alt="The perils of soda withdrawal" title="sc_003" width="888" height="375" class="aligncenter size-full wp-image-339" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lifesnotsimple.com/index.php/2010/08/shape-comics-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
