<?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; programming</title>
	<atom:link href="http://raelifin.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://raelifin.com</link>
	<description>Deus ex Machina</description>
	<lastBuildDate>Thu, 26 Apr 2012 22:59:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>First Flash Project</title>
		<link>http://raelifin.com/code/first-flash-project/</link>
		<comments>http://raelifin.com/code/first-flash-project/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 22:58:25 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=1181</guid>
		<description><![CDATA[Once upon a time Adobe Flash was locked down. To make anything in flash you had to either buy or steal Adobe&#8217;s software to do anything with it. Nowadays though it seems that has changed. Using nothing but free software from FlashDevelop and GreenSock. I was able to build this chess software in about eight [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time Adobe Flash was locked down. To make anything in flash you had to either buy or steal Adobe&#8217;s software to do anything with it. Nowadays though it seems that has changed. Using nothing but free software from <a href="http://www.flashdevelop.org/">FlashDevelop</a> and <a href="http://www.greensock.com/tweenlite/">GreenSock</a>. I was able to build this chess software in about eight hours (knowing nothing about ActionScript at the start):</p>
<p><iframe src="http://raelifin.com/files/ChessInFlash/bin/" width="450" height="450"></iframe></p>
<p>The source code is public domain (except for GreenSock&#8217;s stuff, which is Copyright, and you&#8217;ll have to download from them), and can be downloaded here: <a href="http://raelifin.com/files/ChessInFlash/ChessInFlashSource.zip">http://raelifin.com/files/ChessInFlash/ChessInFlashSource.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/first-flash-project/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tic-Tac-Oh What&#8217;s The Point&#8230;</title>
		<link>http://raelifin.com/thoughts/tic-tac-oh-whats-the-point/</link>
		<comments>http://raelifin.com/thoughts/tic-tac-oh-whats-the-point/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 14:54:16 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rationality]]></category>
		<category><![CDATA[Tic-Tac-Toe]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=777</guid>
		<description><![CDATA[I&#8217;m right now working on building a reasoning agent. Given a model of the environment and a set of goals, it will attempt to take the best action. As a basic test, I have a model of a game of Tic-Tac-Toe for it to play against itself. For a long time my agent was picking [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m right now working on building a reasoning agent. Given a model of the environment and a set of goals, it will attempt to take the best action. As a basic test, I have a model of a game of Tic-Tac-Toe for it to play against itself. For a long time my agent was picking TERRIBLE moves, and I spent at least five hours trying to figure out why. As it turns out, the goal function I gave it subtly punished moves that didn&#8217;t result in immediate victory. In theory this would cause it to favor shorter, more decisive games, but I had simultaneously chosen a punishment for defeat that wasn&#8217;t much higher. The result is that on a board like:</p>
<p><span id="more-777"></span></p>
<p><code>_ _ _<br />
_ X _<br />
O X _</code></p>
<p>The &#8220;O&#8221; player would pick randomly, because the &#8220;thought&#8221; of blocking X, and playing a drawn-out game was equally terrible as that of a quick death. Essentially, I had made an AI that really hated playing, and so would <a href="http://en.wikipedia.org/wiki/Marvin_the_Paranoid_Android">commit suicide</a>.</p>
<p>Okay. Easily enough fixed. Never mind the half a day spent looking for bugs&#8230; Just keep coding&#8230;</p>
<p>I dropped the continual punishment/error factor and jacked up the punishment for lost games (keeping the old continual punishment factor for tie games). So now my AI played out to tie games (good)&#8230; with completely pathetic moves!</p>
<p>Here&#8217;s an example:<br />
<table>
<tr>
<td>_ _ _<br />
_ _ _<br />
_ _ _</td>
</tr>
<tr>
<td>_ X _<br />
_ _ _<br />
_ _ _</td>
</tr>
<tr>
<td>O X _<br />
_ _ _<br />
_ _ _</td>
</tr>
<tr>
<td>O X _<br />
_ _ _<br />
_ _ X</td>
</tr>
<tr>
<td>O X _<br />
_ _ _<br />
_ O X</td>
</tr>
<tr>
<td>O X _<br />
X _ _<br />
_ O X</td>
</tr>
<tr>
<td>O X _<br />
X O _<br />
_ O X</td>
</tr>
<tr>
<td>O X X<br />
X O _<br />
_ O X</td>
</tr>
<tr>
<td>O X X<br />
X O O<br />
_ O X</td>
</tr>
<tr>
<td>O X X<br />
X O O<br />
X O X</td>
</tr>
</table>
<p>Now, what&#8217;s really fascinating is that it&#8217;s not playing <em>randomly</em>. If there&#8217;s ever a situation where one agent could win, the other blocks it. Even in complex situations where one agent can set up a sure victory in the future (a fork), the other blocks it. In other words, it&#8217;s defense is impeccable, but it has essentially no offense.</p>
<p>Thankfully I had stared at the code enough, and the past bug was fresh enough for me, that I didn&#8217;t need to debug for hours to find this one. The problem is I told each agent that the other one was perfectly rational. A perfectly rational agent makes no mistakes, and in Tic-Tac-Toe this means the best outcome you can hope for is a tie. Both agents knew this, and so every action (that didn&#8217;t lead to certain defeat) was equally <strong>futile</strong>. I had convinced my AI that the very game of Tic-Tac-Toe was pointless, so it stopped &#8220;trying&#8221; to win!</p>
<p>I tweaked the AI so that it thinks its opponent is only <em>probably</em> rational, but perhaps a little spontaneous. Now it plays aggressively. ^_^</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/thoughts/tic-tac-oh-whats-the-point/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>Cool New Stuff in May</title>
		<link>http://raelifin.com/cool-stuff/cool-new-stuff-may-2009/</link>
		<comments>http://raelifin.com/cool-stuff/cool-new-stuff-may-2009/#comments</comments>
		<pubDate>Sun, 24 May 2009 05:30:32 +0000</pubDate>
		<dc:creator>Raelifin</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[cybernetics]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[telepathy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://raelifin.com/?p=60</guid>
		<description><![CDATA[This post is more or less a random dump of the cool things I&#8217;ve seen lately. Web Data: * Huge number of volunteers for genome database Telepathy: * &#8220;Force Trainer&#8221; toy provides MRI for kids. * Implant wires motor cortex to computer. &#8220;Green&#8221; tech: * &#8220;Mission One&#8221; electric motorcycle goes 150mph, with a 150-mile range [...]]]></description>
			<content:encoded><![CDATA[<p>This post is more or less a random dump of the cool things I&#8217;ve seen lately.</p>
<p><strong>Web Data:</strong><br />
<embed src="http://blip.tv/play/gshVtNIUhrwN" type="application/x-shockwave-flash" width="320" height="242" allowscriptaccess="always" allowfullscreen="true"></embed><br/><br />
* <a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&#038;taxonomyName=storage&#038;articleId=9133167&#038;taxonomyId=19&#038;intsrc=kc_top">Huge number of volunteers for genome database</a></p>
<p><span id="more-60"></span></p>
<p><strong>Telepathy:</strong><br />
* <a href="http://www.washingtonpost.com/wp-dyn/content/article/2009/04/22/AR2009042204036.html?hpid=topnews/">&#8220;Force Trainer&#8221; toy provides MRI for kids.</a><br />
* <a href="http://singularityhub.com/2009/05/20/braingate-frees-trapped-minds/">Implant wires motor cortex to computer.</a><br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/5FBCWmtLTCc&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/5FBCWmtLTCc&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>&#8220;Green&#8221; tech:<br />
 * <a href="http://www.ridemission.com/">&#8220;Mission One&#8221; electric motorcycle goes 150mph, with a 150-mile range and an optimum charge time of 2 hours.</a></p>
<p>I&#8217;ve been thinking about the <a href="http://www.wired.com/culture/culturereviews/magazine/17-06/st_essay">future of currency</a> this evening, and oh! I made a quick little <a href="http://raelifin.com/files/Fibonacci.zip">simulation of the Fibonacci sequence</a> the other day.</p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/cool-stuff/cool-new-stuff-may-2009/feed/</wfw:commentRss>
		<slash:comments>0</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. :)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://raelifin.com/code/zombie-corp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

