<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: For-Loop Defeats Copy/Paste</title>
	<atom:link href="http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/</link>
	<description>The art, science and business of independent game development</description>
	<lastBuildDate>Sun, 25 Jul 2010 17:51:13 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: urbansquall</title>
		<link>http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/comment-page-1/#comment-2428</link>
		<dc:creator>urbansquall</dc:creator>
		<pubDate>Sun, 26 Apr 2009 07:12:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.gamepoetry.com/blog/?p=543#comment-2428</guid>
		<description>&lt;p&gt;Very true. :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Very true. <img src='http://www.gamepoetry.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: mpowers</title>
		<link>http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/comment-page-1/#comment-2425</link>
		<dc:creator>mpowers</dc:creator>
		<pubDate>Sun, 26 Apr 2009 05:34:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.gamepoetry.com/blog/?p=543#comment-2425</guid>
		<description>&lt;p&gt;Instead of 
var neighbors : Array = [
    map.getTile( m_currentX - 1, m_currentY ),
    map.getTile( m_currentX + 1, m_currentY ),
    map.getTile( m_currentX, m_currentY + 1),
    map.getTile( m_currentX, m_currentY - 1 ) ];&lt;/p&gt;

&lt;p&gt;you&#039;re may be even better off with
var neighborCoords : Array = [ {x:-1, y:0}, {x:1, y:0}, {x:0, y:-1}, {x:0, y:1} ];&lt;/p&gt;

&lt;p&gt;for( var n : int = 0; n &lt; neighbors.length; n++ )
{
    var coord: Object = neighborCoords[n];
    var neighbor : Tile =  map.getTile( m_currentX + coord.x, m_currentY + coord.y );&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;You repeat yourself even less, this way.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Instead of 
var neighbors : Array = [
    map.getTile( m_currentX - 1, m_currentY ),
    map.getTile( m_currentX + 1, m_currentY ),
    map.getTile( m_currentX, m_currentY + 1),
    map.getTile( m_currentX, m_currentY - 1 ) ];</p>

<p>you&#8217;re may be even better off with
var neighborCoords : Array = [ {x:-1, y:0}, {x:1, y:0}, {x:0, y:-1}, {x:0, y:1} ];</p>

<p>for( var n : int = 0; n &lt; neighbors.length; n++ )
{
    var coord: Object = neighborCoords[n];
    var neighbor : Tile =  map.getTile( m_currentX + coord.x, m_currentY + coord.y );</p>

<p>&#8230;</p>

<p>You repeat yourself even less, this way.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: urbansquall</title>
		<link>http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/comment-page-1/#comment-2362</link>
		<dc:creator>urbansquall</dc:creator>
		<pubDate>Fri, 24 Apr 2009 14:53:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.gamepoetry.com/blog/?p=543#comment-2362</guid>
		<description>&lt;p&gt;@Colby: Haha.. :)&lt;/p&gt;

&lt;p&gt;@Snurre: I used &#039;n&#039; because colliding indexes are more trouble then they are worth. :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Colby: Haha.. <img src='http://www.gamepoetry.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>@Snurre: I used &#8216;n&#8217; because colliding indexes are more trouble then they are worth. <img src='http://www.gamepoetry.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Snurre</title>
		<link>http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/comment-page-1/#comment-2361</link>
		<dc:creator>Snurre</dc:creator>
		<pubDate>Fri, 24 Apr 2009 14:34:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.gamepoetry.com/blog/?p=543#comment-2361</guid>
		<description>&lt;p&gt;You&#039;re absolutely right. I wonder why you use &#039;n&#039; instead of &#039;i&#039; as the index, but i guess that because of the neighbors?&lt;/p&gt;

&lt;p&gt;Be sure to see this post http://blog.vortixgames.com/factory for more info on patterns.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You&#8217;re absolutely right. I wonder why you use &#8216;n&#8217; instead of &#8216;i&#8217; as the index, but i guess that because of the neighbors?</p>

<p>Be sure to see this post <a href="http://blog.vortixgames.com/factory" rel="nofollow">http://blog.vortixgames.com/factory</a> for more info on patterns.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Colbycheeze</title>
		<link>http://www.gamepoetry.com/blog/2009/04/23/for-loop-defeats-copy-paste/comment-page-1/#comment-2347</link>
		<dc:creator>Colbycheeze</dc:creator>
		<pubDate>Fri, 24 Apr 2009 06:25:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.gamepoetry.com/blog/?p=543#comment-2347</guid>
		<description>&lt;p&gt;I have a feeling you were thinking of me when you wrote this :D&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have a feeling you were thinking of me when you wrote this <img src='http://www.gamepoetry.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.221 seconds -->
