{"author_name":"willh","cat":"LD #24","comments":[{"author_name":"willh","time":"August 26, 2012 11:56 am","epoch":1346000160,"text":"Not sure why my pictures are all squashed.","spam":"N"}],"epoch":1346000100,"likes":0,"metadata":{"p_key":"52456","p_author":"willh","p_authorkey":"16463","p_urlkey":"88157","p_title":"Plugging it all together","p_cat":"LD #24","p_event":"LD24","p_time":"1346000100","p_likes":"0","p_comments":"1","p_status":"UPD5","us_key":"16463","us_name":"willh","us_username":"willh","event_start":"1345766400","event_key":"12","event_name":"LD24"},"text":"<p>It&#8217;s not often you get to write code as ugly as this (unless you&#8217;re me that is, in which case it&#8217;s very often):<\/p>\n <p><code><br \/>\n for(GeneBlock block : this.geneBlocksInPlay){<br \/>\n if(block != currentBlock){<\/p>\n <p>                List neighbouringBlocks = new ArrayList();<\/p>\n <p>                int[][] tiles = block.getTiles();<br \/>\n for(int t = 0; t &lt; tiles.length; t ++){<\/p>\n <p>                    int locX = block.getX() + tiles[t][0];<br \/>\n int locY = block.getY() + tiles[t][1];<\/p>\n <p>                    for(int x = -1; x &lt;= 1; x ++){<br \/>\n for(int y = -1; y &lt;= 1; y ++){<br \/>\n if(!(x == 0 &amp;&amp; y == 0)){<br \/>\n int realX = Math.min(this.geneBlocksWidth,Math.max(0,locX + x));<br \/>\n int realY = Math.min(this.geneBlocksHeight,Math.max(0,locY + y));<\/p>\n <p>                                GeneBlock neighbourBlock = this.geneBlocks[realX][realY];<\/p>\n <p>                                if(neighbourBlock != block){<br \/>\n neighbouringBlocks.add(neighbourBlock);<br \/>\n }<br \/>\n }<br \/>\n }<br \/>\n }<br \/>\n }<\/p>\n <p>                block.registerNeighbours(neighbouringBlocks);<br \/>\n }<br \/>\n }<br \/>\n <\/code><\/p>\n <p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/08\/26\/plugging-it-all-together-2\/itlives\/\" rel=\"attachment wp-att-171560\"><img class=\"aligncenter size-full wp-image-171560\" src=\"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/itlives.png\" alt=\"\" srcset=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/itlives-300x183.png 300w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/itlives-550x336.png 550w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/itlives.png 1679w\" sizes=\"(max-width: 1679px) 100vw, 1679px\" \/><\/a><\/p>","time":"August 26th, 2012 11:55 am","title":"Plugging it all together"}