<?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>Raelifin.com &#187; Code</title>
	<atom:link href="http://raelifin.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://raelifin.com</link>
	<description>Deus ex Machina</description>
	<lastBuildDate>Sun, 04 Jul 2010 01:45:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Autocell 2</title>
		<link>http://raelifin.com/code/autocell-2/</link>
		<comments>http://raelifin.com/code/autocell-2/#comments</comments>
		<pubDate>Sat, 29 May 2010 16:42:22 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Autocell]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=378</guid>
		<description><![CDATA[I&#8217;ve updated Autocell to version 2. In addition to cleaning up the code, adding better error handling, and (I hope) improving the interface slightly, I&#8217;ve made the following changes to the rules: You can now set cells to be drawn as images. Defining the image a cell should use is as simple as making a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://raelifin.com/files/autocell/autocell2/">I&#8217;ve updated Autocell to version 2</a>. In addition to cleaning up the code, adding better error handling, and (I hope) improving the interface slightly, I&#8217;ve made the following changes to the rules:</p>
<ul>
<li>You can now set cells to be drawn as images. Defining the image a cell should use is as simple as making a rule of &#8220;draw &lt;CELLTYPE&gt; &lt;URL&gt;&#8221; (See Langton&#8217;s Ant for example.)</li>
<li>The directions northeast, northwest, etc. have been added, as have fareast, farnorth, etc. The &#8220;far____&#8221; directions refer to cells two steps away.</li>
<li>The special noun &#8220;neighbors&#8221; now includes the NULL cells at the border.</li>
<li>New verbs &#8220;cellAt&#8221; and &#8220;neighborsOf&#8221; have been added. They both take a 2-by-1 array ([x,y]) of the cell in question as their right-parameter. The &#8220;cellAt&#8221; verb returns the type of the cell in question, while &#8220;neighborsOf&#8221; returns the set of neighbors.</li>
<li>A new two-parameter verb &#8220;+&#8221; has been added. Right now it only operates on the 2-by-1 coordinate arrays discussed above. (Example: [1,-10] + [23,7] = [24,-3])</li>
<li>In the same vein, a new special noun called &#8220;thisPos&#8221; has been added. It is the coordinates of the cell being evaluated.</li>
</ul>
<p>That&#8217;s all!</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/autocell-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning Python</title>
		<link>http://raelifin.com/code/learning-python/</link>
		<comments>http://raelifin.com/code/learning-python/#comments</comments>
		<pubDate>Wed, 26 May 2010 18:10:36 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[text-based]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=375</guid>
		<description><![CDATA[It&#8217;s not that interesting, but I made a little one-player text-based RPG in python (3.1.2) this morning/last night. I&#8217;m happy with it, just because it&#8217;s the largest thing I&#8217;ve ever done in python. The whole thing is based off of this blog post. You can get the source code here: http://raelifin.com/files/code/rcrpg.py It&#8217;s all public domain, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not that interesting, but I made a little one-player text-based RPG in python (3.1.2) this morning/last night. I&#8217;m happy with it, just because it&#8217;s the largest thing I&#8217;ve ever done in python. The whole thing is <a href="http://web.archive.org/web/20080212201605/http://shortcircuit.us/muddy-kinda-like-a-mud-but-single-player/">based off of this blog post</a>. You can get the source code here: <a href="http://raelifin.com/files/code/rcrpg.py">http://raelifin.com/files/code/rcrpg.py</a><br />
It&#8217;s all public domain, but I like credit (yada, yada).</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/learning-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mini-Project: Autocell</title>
		<link>http://raelifin.com/code/mini-project-autocell/</link>
		<comments>http://raelifin.com/code/mini-project-autocell/#comments</comments>
		<pubDate>Thu, 20 May 2010 06:12:27 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Autocell]]></category>
		<category><![CDATA[cellular automata]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rapid-prototype]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=356</guid>
		<description><![CDATA[My latest quick project was to write a basic scripting language for building cellular automata. The framework is built on javascript, and I made a nice little interface to go with it. As long as you&#8217;re using a browser that isn&#8217;t terrible, you can check it out here. All the code on that page except [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0 0 10px 10px; float: right;" src="http://raelifin.com/files/screenshots/autocell_screenshot.png"/>My latest quick project was to write a basic scripting language for building <a href="http://en.wikipedia.org/wiki/Cellular_automata">cellular automata</a>. The framework is built on javascript, and I made a nice little interface to go with it. As long as you&#8217;re using a browser that isn&#8217;t terrible, you can <a href="http://raelifin.com/files/autocell1.html">check it out here</a>. All the code on that page except the utility functions is public domain, but please give credit where credit is due. If you end up examining the source, I apologize for the mess; I was trying to fit everything in one file, and not use jQuery or other libraries.</p>
<p><span id="more-356"></span></p>
<p>For those interested in writing your own automata, here is a quick guide to the syntax:<br />
An automaton is composed of rules. Each rule is designated by a new line. Double slash (//) or pound (#) designate a commented line.<br />
Each rule looks something like <strong>BLACK->WHITE: 1 = 2</strong><br />
BLACK is the type of cell that the rule applies to, WHITE is the type of cell that it will become. After the colon is a statement that must resolve to a single value, or &#8220;noun&#8221;.<br />
Nouns can be strings, numbers, true/false, JSON arrays, &#8220;neighbors&#8221;, or any of the cardinal directions (lower-case). The noun &#8220;neighbors&#8221; is a special noun which is a JSON array with values equal to the types of the surrounding tiles (in eight directions). The special nouns &#8220;west&#8221;, &#8220;north&#8221;, &#8220;south&#8221; and &#8220;east&#8221; are equal to the type in that direction, or &#8220;NULL&#8221; if at the edge.<br />
Nouns can be acted upon by the following &#8220;verbs&#8221;:
<ul>
<li><strong>=</strong>, <strong>></strong>, <strong><</strong> &#8212; Basic comparison operators. They behave like their counterparts in javascript (except for =, which is comparison, not assignment). &#8212; example: &#8220;1 > 2 = false&#8221; (returns true)</li>
<li><strong>or</strong>, <strong>and</strong> &#8212; Low-priority logic operators. These behave like || and &#038;&#038; in most languages. Low-priority means they are evaluated after other verbs. &#8212; example: &#8220;true and false or true&#8221; (returns true)</li>
<li><strong>not</strong> &#8212; Inverts the boolean value to the right. If the value to the right is non-boolean, it is cast to a boolean just like ! in javascript. &#8212; example: &#8220;not true&#8221; (returns false)</li>
<li><strong>contains</strong>, <strong>isIn</strong> &#8212; Check if a value is contained in an array. The two verbs are identical except in the order of their parameters (&#8220;value isIn array&#8221;, or &#8220;array contains value&#8221;). &#8212; example: &#8220;[1,2,3] contains 0&#8243; (returns false)</li>
<li><strong>count</strong> &#8212; Changes the noun on the right from an array to an integer. &#8212; example: &#8220;count [0,1,2]&#8221; (returns 3)</li>
<li><strong>ofType</strong> &#8212; Filters an array on the left to only contain the value on the right. &#8212; example: &#8220;[0,0,0,1,2,3] ofType 0&#8243; (returns [0,0,0])</li>
<li><strong>echo</strong> &#8212; Makes a popup containing the value on the right. Does not change the data. This verb isn&#8217;t very useful, and can flood your browser with popups if you aren&#8217;t careful.</li>
</ul>
<p>Verbs are evaluated from left-to-right, but you can use parentheses to change the order of operations. More examples can be found by loading the prebuilt automata.</p>
<p>I know the interface is a bit hard to use, but if you make anything (even if it&#8217;s pretty trivial) please leave a comment! You can export boards as well, so feel free to share interesting formations in <a href="http://en.wikipedia.org/wiki/Conway's_Game_of_Life">Conway&#8217;s Game of Life</a>, <a href="http://en.wikipedia.org/wiki/Wireworld">Wireworld</a>, or others.</p>
<p>On a related note, this talk by Wolfram is not to be missed:<br />
<object width="446" height="326"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talks/dynamic/StephenWolfram_2010-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/StephenWolfram-2010.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=843&#038;introDuration=15330&#038;adDuration=4000&#038;postAdDuration=830&#038;adKeys=talk=stephen_wolfram_computing_a_theory_of_everything;year=2010;theme=tales_of_invention;theme=bold_predictions_stern_warnings;theme=what_s_next_in_tech;theme=new_on_ted_com;theme=a_taste_of_ted2010;theme=unconventional_explanations;theme=art_unusual;theme=inspired_by_nature;event=TED2010;&#038;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="446" height="326" allowFullScreen="true" allowScriptAccess="always" flashvars="vu=http://video.ted.com/talks/dynamic/StephenWolfram_2010-medium.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/StephenWolfram-2010.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=843&#038;introDuration=15330&#038;adDuration=4000&#038;postAdDuration=830&#038;adKeys=talk=stephen_wolfram_computing_a_theory_of_everything;year=2010;theme=tales_of_invention;theme=bold_predictions_stern_warnings;theme=what_s_next_in_tech;theme=new_on_ted_com;theme=a_taste_of_ted2010;theme=unconventional_explanations;theme=art_unusual;theme=inspired_by_nature;event=TED2010;"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/mini-project-autocell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mini-Project: Think Like a &#8220;Good Old AI&#8221; Researcher</title>
		<link>http://raelifin.com/thoughts/mini-project-think-like-gofai-researcher/</link>
		<comments>http://raelifin.com/thoughts/mini-project-think-like-gofai-researcher/#comments</comments>
		<pubDate>Wed, 12 May 2010 05:17:49 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[associative database]]></category>
		<category><![CDATA[GOFAI]]></category>
		<category><![CDATA[knowledge]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ontology]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[world-building]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=313</guid>
		<description><![CDATA[Those who&#8217;ve known me for many years will know that I love to create fictional worlds. They represent the epitome of complicated systems, with all of the messiness and detail of the real world combined with the flexibility required to satisfy my creative desires. Because of the immensity of world-building, at a certain point it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://phaedoras.raelifin.com/?q=describe+S%C3%A1r%C3%ADb%C3%A1"><img style="border: thick solid black; float: right; margin: 0 0 10px 10px; width: 250px;" src="http://raelifin.com/files/screenshots/family-tree.png" alt="Example Family Tree" /></a>Those who&#8217;ve known me for many years will know that I love to <a href="http://thecbg.org/news.php">create fictional worlds</a>. They represent the epitome of complicated systems, with all of the messiness and detail of the real world combined with the flexibility required to satisfy my creative desires. Because of the immensity of world-building, at a certain point it is absolutely necessary for the creator to maintain a solid body of notes on the various people, places, things, etc. in the setting. Worlds are nonlinear by nature, so it is very common to use a wiki to write things down, and it was in re-reading my own wiki-notes that I got an idea for another way to do things.</p>
<p><span id="more-313"></span></p>
<p>Specifically, I began to notice how few links my notes contained, and the difficulty I might have in changing small details (like names) across many pages. Wouldn&#8217;t it be nice, I thought, if I were able to tell my computer about my world, and have the computer organize and maintain my notes in a way that let me quickly and easily extract and change the underlying facts. Essentially, I was thinking about automating the world-building process by reducing a world into a data and making code to manipulate and present that data.</p>
<p>Because I had heard good things about <a href="http://en.wikipedia.org/wiki/Associative_model_of_data">associative databases</a>, I built one to handle the facts of the world and began entering items like<br />
<code style="margin-left: 20px;">Kogámos is_child_of Sáríbá</code><br />
(Yes, I know that&#8217;s a lot of accents). Associative databases (with exceptions, I&#8217;m sure) represent data <a href="http://en.wikipedia.org/wiki/Ontology">ontologically</a> (that is, as a collection of factual claims about entities), and in this way resemble the data structures of <a href="http://en.wikipedia.org/wiki/GOFAI">Good Old-Fashioned AI</a>*. Now, before I started this project I was very skeptical about logic-based <a href="http://en.wikipedia.org/wiki/Strong_AI">AGI</a>, but I knew that in some domains, (such as <a href="http://en.wikipedia.org/wiki/Expert_System">Expert Systems</a>) logic based <em>narrow</em> AI had become successful, so I set about exploring whether this was one such domain.</p>
<p style="color: #444">* &#8211; Really, this structure is common to all logic-based AI, even fuzzy-logic, modern approaches like <a href="http://sites.google.com/site/narswang/home">NARS</a>. Much of the criticism that follows can be applied to any sort of artificial reasoning system.</p>
<p>Before I go on, however, I&#8217;d like to share a documentary about the semantic web. It&#8217;s related, and I&#8217;ll be talking about it, but it&#8217;s 15 minutes and you could probably skip it if you&#8217;re familiar with the concept.</p>
<p style="text-align: center"><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=11529540&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=11529540&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p>With the possible exception of being able to make meta-facts (that is, facts about facts), the eventual structure of the semantic web closely resembles that of an associative database. In fact, I&#8217;m sure that facebook has a piece of data saying<br />
<code style="margin-left: 20px;">Max_Harms is_child_of Tracy_Harms</code><br />
or something to that effect, right now. And like my project, the semantic web seeks to represent data about an entire world, not just a highly-restricted domain.</p>
<p>My project has some big advantages, though. The biggest is probably that all the information given might as well be coming from God. If the world-creator says that rivers run uphill, that&#8217;s just the way it works. Thus there is no need to model confidence in facts entered. Secondly, the system doesn&#8217;t actually have to act; it simply has to store and present the data in an intelligent way.</p>
<p>One of the early things I noticed in my exploration is just how fun it is to see the computer answer questions. Logic-based AI is very attractive because it takes hardly any work before you can ask it things like &#8220;Who is the child of Sáríbá?&#8221; and it will give you the right answer. I ended up spending lots of time asking questions that I already knew the answer to,  just because it was fun whenever the computer was right.</p>
<blockquote><p>One of the biggest hurdles in the transition from a Reductionist to a Holistic stance is that the Reductionist stance works so well for simple problems, and thus is very seductive to beginners.<span style="float: right">- <a href="http://monicasmind.com/">Monica Anderson</a></span></p></blockquote>
<p>The problem here is that answering simple questions based on simple rules from entered facts doesn&#8217;t mean squat. It&#8217;s about as useful as writing the information in a text file and using <a href="http://en.wikipedia.org/wiki/Regular_expression">regex</a>.</p>
<p>It gets worse than that, though. As mentioned before, worlds are messy and complicated. If the problem was as simple as generating a family tree, or making Venn diagrams, we&#8217;d be okay. But how do you represent something as nuanced as &#8220;Sally likes to spend time downtown, except on the weekend, when she finds it too crowded&#8221;? Such things are simple for us to remember because they tie into our experiences. To illustrate what I mean, imagine the similar phrase &#8220;Queue is angry about rowing in Vah, except when floating, when torque is standard.&#8221; This statement has no connection with our common experience, and because we do not understand it, we cannot store it easily. This is the same problem as that confronting the semantic web. We can pour in data until we die, and the system still wouldn&#8217;t &#8220;get it&#8221;.</p>
<blockquote><p>If a programmer attempts to describe the world to a Logic based AI, for instance by creating ontologies, he’ll never finish the task. The world is too rich. The Cyc project – the largest and most famous AI project ever undertaken – has been trying to describe the world using predicate calculus for decades; it is the poster project for Reductionist approaches to AI. But Cyc will never approach anything worthy of the term “Intelligence”. It has been told many things and can recite many definitions but Understands nothing. This is the difference between “Instructionist” top down education and “Constructionist” bottom up learning – a distinction poorly understood even in human education.<span style="float: right">- <a href="http://monicasmind.com/?p=188">Monica Anderson</a></span></p></blockquote>
<p>Even in a task as basic as storing and retrieving information we still need the computer to understand what it&#8217;s doing beyond tasks of relative simplicity. This is because knowing about the world falls into a large class of problems that are fundamentally impossible without General Intelligence**. Other problems in this category include using natural language, navigating complex environments, and behaving in socially acceptable ways. As hard as we may try, until Strong AI is solved, a chatbot will always be a <a href="http://www.cleverbot.com/">mimicking machine</a>, a database will always fail in complex domains, and humans will be forced adapt to robots (instead of robots adapting to humans).</p>
<p style="color: #444">** &#8211; It may be possible for a vast enough intelligence to make a system so complex that it&#8217;d be able to handle one of these domains. I don&#8217;t think even large numbers of humans would be smart enough to make one, though.</p>
<p>Even with my increased dislike of logical systems, I&#8217;m quite happy with what I was able to make in the few days I spent building my database. You can <a href="http://phaedoras.raelifin.com/">check out the results</a> yourself, or even <a href="http://phaedoras.raelifin.com/input.html">add and delete facts</a>. The database will be restored to a backup state twice a day (not sure what timezone my server is in), so don&#8217;t worry about making a mess.</p>
<p>Search commands:
<ul>
<li>&#8220;<a href="http://phaedoras.raelifin.com/?q=describe+Ix">describe X</a>&#8221; = get all facts relating to X</li>
<li>&#8220;<a href="http://phaedoras.raelifin.com/?q=list+Ix+is+%3F">list X is ?</a>&#8221; = get all items that X is</li>
<li>&#8220;<a href="http://phaedoras.raelifin.com/?q=list+Ix+is_child_of+%3F">list X is_child_of ?</a>&#8221; = get the parents of X</li>
<li>&#8220;<a href="http://phaedoras.raelifin.com/?q=list+%3F+is|has+om%C3%A1ku">list ? is|has X</a>&#8221; = get everything that is or has X</li>
<li>&#8220;<a href="http://phaedoras.raelifin.com/?q=list+%3F+imports+*+%3F+is+geographical_area">list ? imports * ? is geographical_area</a>&#8221; = gets geographical areas that import anything</li>
<li>&#8220;<a href="http://phaedoras.raelifin.com/?q=infer">infer</a>&#8221; = list suggestions for facts, based on correlations</li>
</ul>
<p><a href="http://raelifin.com/files/code/WorldDatabase.zip">Source code is here</a>. Everything I wrote (files in the root directory) is public domain. Attribution is appreciated.</p>
<p>(P.S. I&#8217;m a big supporter of the semantic web, and doubly so for open data. The criticisms expressed in this post are against the idea that it is possible to intelligently know lots about the world using ontological representations. Links are data, and that data is important, even if that data isn&#8217;t knowledge in itself.)</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/thoughts/mini-project-think-like-gofai-researcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First GoiD Task</title>
		<link>http://raelifin.com/code/first-goid-task/</link>
		<comments>http://raelifin.com/code/first-goid-task/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 20:40:52 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[GoiD]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=304</guid>
		<description><![CDATA[In case anyone&#8217;s wondering what I&#8217;m up to, my first task on the Game of Intelligent Design was published today. If you&#8217;re familiar with javascript and like the the idea of programming virtual robots, go play!]]></description>
			<content:encoded><![CDATA[<p><img style="float: right; margin: 10px;" src="http://raelifin.com/files/screenshots/GoiDMaze.png" alt="GoiD Maze Screenshot" />In case anyone&#8217;s wondering what I&#8217;m up to, my first task on the <a href="http://gameofid.com/">Game of Intelligent Design</a> was published today. If you&#8217;re familiar with javascript and like the the idea of programming virtual robots, <a href="http://gameofid.com/play/maze">go play</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/first-goid-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Genetic Programming in 24 Hours</title>
		<link>http://raelifin.com/code/genetic-programming-in-24-hours/</link>
		<comments>http://raelifin.com/code/genetic-programming-in-24-hours/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 01:45:00 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Genetic Programming]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=190</guid>
		<description><![CDATA[I don&#8217;t know why I named it &#8220;Tide Pool&#8221;; there aren&#8217;t any tides. Oddly enough though, the creatures learn to move as if there were. Yesterday I decided to play with some genetic programming. Though I found a neat GP resource, I decided to work from scratch and build a simulated tide-pool with algae/plants and [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know why I named it &#8220;Tide Pool&#8221;; there aren&#8217;t any tides. Oddly enough though, the creatures learn to move as if there were.</p>
<p><a href="http://raelifin.com/files/tidepool.png"><img style="float: right; margin: 0px 0px 10px 10px; width: 300px;" src="http://raelifin.com/files/tidepool.png" alt="Tide Pool screenshot" /></a>Yesterday I decided to play with some genetic programming. Though I found <a href="http://jgap.sourceforge.net/">a neat GP resource</a>, I decided to work from scratch and build a simulated tide-pool with algae/plants and animals of indeterminate form. Truth be told, I&#8217;m not even sure what I did really &#8220;counts&#8221; as genetic programming because the only evolved feature is the behavior for the animals. Regardless, I wrote the thing in a single day and got some neat emergent behavior and a screen-saver-wannabe. Green dots are &#8220;plants&#8221; and yellow/white/red/black are &#8220;animals&#8221;.</p>
<p><span id="more-190"></span></p>
<p><a href="http://raelifin.com/files/TidePool.zip">The code and runnable Jar are here.</a> Everything is public domain, though I humbly request you don&#8217;t try to pass the work off as your own. The pulsing brightness is supposed to be day &#038; night. The source code is really sloppy, so keep in mind that this was a quick, shoot-from-the-hip sort of project and please have forgiveness.</p>
<p>Controls:<br />
Minus/Underline = Slower<br />
Plus/Equals = Faster</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/genetic-programming-in-24-hours/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gravitation</title>
		<link>http://raelifin.com/code/gravitation/</link>
		<comments>http://raelifin.com/code/gravitation/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 22:04:11 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[gravity]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[kepler]]></category>
		<category><![CDATA[newton]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[simulation]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=161</guid>
		<description><![CDATA[One weekend, about a month ago, I threw together a quick simulation of the solar system because I was studying gravitation in school. Since I have some time now I went back and polished it to allow user interaction and remove various glitches. It&#8217;s still quite crude, but I&#8217;m done dealing with it, so I [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right; margin: 0px 0px 5px 5px;" href="http://raelifin.com/files/sol.png"><img src="http://raelifin.com/files/sol.png" alt="Sol" height="200" /></a>One weekend, about a month ago, I threw together a quick simulation of the solar system because I was studying gravitation in school. Since I have some time now I went back and polished it to allow user interaction and remove various glitches. It&#8217;s still quite crude, but I&#8217;m done dealing with it, so I figured that I&#8217;d throw it up here. One of the coolest things it does (IMO) is show the paths of the planets from a non-heliocentric viewpoint. </p>
<p><span id="more-161"></span></p>
<p>Everything (code and images) is public domain. Credit is nice, but not necessary. <a href="http://raelifin.com/files/kepler.zip">Download code (and runnable jar) here.</a> Created using <a href="http://slick.cokeandcode.com/">Slick</a> (Build #266) with <a href="http://lwjgl.org/">LWJGL</a> (2.0b1).</p>
<p><a href="http://raelifin.com/files/kepler.png"><img style="margin-bottom: 0px" src="http://raelifin.com/files/kepler.png" alt="Geocentric Perspective" title="Geocentric" width="300" height="186"/></a><br />
A Geocentric View of the Universe.</p>
<p><a href="http://raelifin.com/files/kepler2.png"><img style="margin-bottom: 0px" src="http://raelifin.com/files/kepler2.png" alt="Geocentric Perspective 2" title="Geocentric2" width="300" height="186"/></a><br />
Another Geocentric Perspective.</p>
<p><a href="http://raelifin.com/files/jupiter.png"><img style="margin-bottom: 0px" src="http://raelifin.com/files/jupiter.png" alt="Jupiter Perspective" title="Jupiter" width="300" height="186"/></a><br />
View from Jupiter.</p>
<p>Oh, and I almost forgot! One of the other neat things I did with the simulation was &#8220;experimentally&#8221; measure the speeds of the planets (except Neptune). I looked up average orbital distances and the mass of the sun on Wikipedia and then tweaked the initial velocity of each planet until the orbit looked roughly circular. I did this mostly out of laziness, but I was shocked at how close I had gotten to the real values.</p>
<table>
<tr>
<th></th>
<th>Estimated Speed <small>(km/s)</small></th>
<th>Observed Speed (Average) <small>(km/s)</small></th>
</tr>
<tr>
<th>Mercury</th>
<td>48</td>
<td>47.87</td>
</tr>
<tr>
<th>Venus</th>
<td>34.5</td>
<td>35.02</td>
</tr>
<tr>
<th>Earth</th>
<td>29.5</td>
<td>29.783</td>
</tr>
<tr>
<th>Moon</th>
<td>30.5</td>
<td>30.805<br/><small>= 29.783 (earth) + 1.022 (relative speed of luna)</small></td>
</tr>
<tr>
<th>Mars</th>
<td>24</td>
<td>24.077</td>
</tr>
<tr>
<th>Jupiter</th>
<td>13</td>
<td>13.07</td>
</tr>
<tr>
<th>Saturn</th>
<td>9.5</td>
<td>9.69</td>
</tr>
<tr>
<th>Uranus</th>
<td>6.8</td>
<td>6.81</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/gravitation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Playing with Physics</title>
		<link>http://raelifin.com/code/wall-ball-physics/</link>
		<comments>http://raelifin.com/code/wall-ball-physics/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 22:18:22 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=147</guid>
		<description><![CDATA[This weekend, as a side project, I did some modeling of physics concepts I&#8217;ve been studying in class. Specifically, conservation of momentum of a system, how the motion of particles can be summed into macroscopic bodies, how forces move through solids in waves, and how quantity of matter (mass) has an impact on acceleration. This [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://raelifin.com/files/ballwall.png"><img src="http://raelifin.com/files/ballwall.png" alt="Graph of a ball hitting a wall" style="float: right; height: 350px; margin-left: 10px; margin-bottom: 5px"/></a>This weekend, as a side project, I did some modeling of physics concepts I&#8217;ve been studying in class. Specifically, conservation of momentum of a system, how the motion of particles can be summed into macroscopic bodies, how forces move through solids in waves, and how quantity of matter (mass) has an impact on acceleration. This is just me playing around, but I thought some people might enjoy seeing what I&#8217;m up to.</p>
<p>I&#8217;m releasing all the code into the public domain <a href="http://raelifin.com/files/ballwall.html">here</a>. Everything is HTML5/javascript (view source to get it), and you&#8217;ll need a decent browser (not IE!) for it to work. There&#8217;s no user interface, so if you want to change variables or play with it yourself you&#8217;ll have to edit the source.</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/wall-ball-physics/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Prescience</title>
		<link>http://raelifin.com/code/prescience/</link>
		<comments>http://raelifin.com/code/prescience/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 18:34:36 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[crowdsourcing]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[Prescience]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Wisdom of Crowds]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=120</guid>
		<description><![CDATA[I&#8217;ve been interested in the future for a long while, now. Most of this interest goes into my passion for reading about science and technology, but after reading James Surowiecki&#8217;s Wisdom of Crowds I thought to myself: &#8220;How well could a crowd predict the future?&#8221; In my free time I set up a website which [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been interested in the future for a long while, now. Most of this interest goes into my passion for reading about science and technology, but after reading James Surowiecki&#8217;s <a href="http://en.wikipedia.org/wiki/Wisdom_of_Crowds">Wisdom of Crowds</a> I thought to myself: &#8220;How well could a crowd predict the future?&#8221;</p>
<p>In my free time I set up a website which would let me play with that very question. It would serve as a set of polls, taking input from visitors on when they expected future technologies to arise. The whole thing is hardly scientific, but I think it&#8217;s interesting and fun.</p>
<p><img src="http://prescience.raelifin.com/images/predict_example.png" alt="[Prescience Preview]"></p>
<p>Prescience was born, and after roughly a month in development, I&#8217;ve checked nearly everything on my feature list. My task now is to try and find as many people as possible who would be interested in the website, as the premise is based on large numbers of participants. Please, <a href="http://prescience.raelifin.com/">check it out</a> and tell me what you think in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/prescience/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zombie Corp.</title>
		<link>http://raelifin.com/code/zombie-corp/</link>
		<comments>http://raelifin.com/code/zombie-corp/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 15:51:18 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rapid-prototype]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=8</guid>
		<description><![CDATA[During my first year of college I showed up one Friday for my C++ class only to find that it was canceled. Not wanting to simply go home quite yet, I talked one of the other teachers into letting me sit in and participate in one of the upper level game-development classes. We were broken [...]]]></description>
			<content:encoded><![CDATA[<p>During my first year of college I showed up one Friday for my C++ class only to find that it was canceled. Not wanting to simply go home quite yet, I talked one of the other teachers into letting me sit in and participate in one of the upper level game-development classes. We were broken into teams and instructed to design a game to work on for the rest of the quarter. I, of course, didn&#8217;t have to code anything, being in the class just for that day, but I jumped in anyway.</p>
<p>Most of the class was thinking of making an obscenely huge strategy game akin to Risk meets Monopoly, which just so happens to be the sort of design which I despise. Having spent many long years learning the hard way to design as small as possible, I helped my team brainstorm a small, grid-based, strategy game based on resource management and simple unit-movement. My hope was that the project would be basic enough that it could be running with an initial rule-set within the week and that the remainder of the term could be devoted to polishing the interface/graphics and working on the rules. (I was only vaguely aware of it at the time, but this sort of thinking would expand into rapid-prototyping, playtest-heavy, and iterative design philosophies in my own work.)</p>
<p><span id="more-8"></span></p>
<p>We decided on a zombie theme, with the twist that the zombies were actually corporate pawns, and the necromancers were CEOs. It&#8217;s kinda vanilla, but it was a 1-hour design within a group of relative strangers. We presented our designs for the class and they decided to work on Risk-Monopoly. That weekend, in about 8 hours*, I built a working alpha for the game:</p>
<p>EDIT: If the images aren&#8217;t working, you may need to <a href="http://raelifin.com/code/zombie-corp/">view this post by itself</a>.<br />
<applet code="master.CoreApplet.class" archive="http://raelifin.com/files/corperateZombies.jar" width="575" height="575"></applet><br />
<blockquote><strong>Rules:</strong><br />
The player on the left (pink/green) goes first. And then blue player takes a turn, and so on.<br />
To move an army, drag them to an adjacent square. (They move like kings in chess.)<br />
Armies are composed of undead: zombies, lawyers, or both.</p>
<p>Each space is commercial, residential or corporate (Starbucks, house or building). At the beginning of each turn, you get cash to buy lawyers with and new interns to turn into zombies. The goal of the game it to capture your opponent&#8217;s skyscraper. The income is as follows:<br />
Corporate Space: +$5,000 &#038; +5 interns / turn<br />
Commercial Space +$2,000 / turn<br />
Residential Space +2 interns / turn</p>
<p>Each turn you get one action (upper-right), in addition to moving each unit. Select a board space then chose:<br />
PROMOTE: Turn all interns into zombies at the selected space.<br />
HIRE: Hire lawyers for $5,000 each at the selected space.<br />
DEVELOP: Selected commercial or residential space now produces 2N+2, where N = current production. (Units are single interns or thousands of dollars.) Each space can only be developed twice.</p>
<p>If you move into a space that has an enemy army, you deal damage to them, killing a number of units. If you defeat all units in a space, you capture it. An army with both lawyers and zombies loses its zombies first. Lawyers deal roughly 5x<br />
more damage to zombies (I forget the actual multiplier).</p></blockquote>
<p>It&#8217;s really a very boring game, but the idea is that it&#8217;s playable and (mostly) bug free. Additional rules and features can easily be added onto the skeleton in an attempt to make it more engaging. At the end of the week you&#8217;ll have a game, though, and you&#8217;ll have a good impression of roughly how fun it is. This last part is vital, I think, to good game design.<br />
<strong>Rapid-prototyping lets me play a game with very little time investment. This lets me determine whether it is worth making.</strong></p>
<p><small>* This amount of time is actually quite excessive for such a simple game. At the time I wasn&#8217;t using <a href="http://slick.cokeandcode.com/">Slick</a>, and I didn&#8217;t have much experience with applets.</p>
<p>Disclaimer: I do not own any of the graphics used in the game, but I feel that they are <a href="http://en.wikipedia.org/wiki/Fair_use">used fairly</a>. Unlike most of my work, this game is not open source, and I ask that you do not redistribute it without permission. Its sole intent is to showcase what I did one weekend, and maybe talk a little about game-programming. <img src='http://raelifin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </small></p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/zombie-corp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
