<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Cellular Automata</title>
	<atom:link href="http://programmingpraxis.com/2009/05/15/cellular-automata/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingpraxis.com/2009/05/15/cellular-automata/</link>
	<description>A collection of etudes, updated weekly, for the education and enjoyment of the savvy programmer</description>
	<lastBuildDate>Sat, 11 Feb 2012 09:48:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Rule 30 RNG &#171; Programming Praxis</title>
		<link>http://programmingpraxis.com/2009/05/15/cellular-automata/#comment-2950</link>
		<dc:creator><![CDATA[Rule 30 RNG &#171; Programming Praxis]]></dc:creator>
		<pubDate>Fri, 29 Apr 2011 09:04:55 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.wordpress.com/?p=573#comment-2950</guid>
		<description><![CDATA[[...] generator that is used in the Standard Prelude. We also looked at cellular automata in a previous exercise. In today&#8217;s exercise we combine random number generators and cellular automata by looking at [...]]]></description>
		<content:encoded><![CDATA[<p>[...] generator that is used in the Standard Prelude. We also looked at cellular automata in a previous exercise. In today&#8217;s exercise we combine random number generators and cellular automata by looking at [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ardnew</title>
		<link>http://programmingpraxis.com/2009/05/15/cellular-automata/#comment-1312</link>
		<dc:creator><![CDATA[ardnew]]></dc:creator>
		<pubDate>Tue, 08 Jun 2010 22:53:44 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.wordpress.com/?p=573#comment-1312</guid>
		<description><![CDATA[Anyway, here&#039;s my crappy solution: &lt;a href=&quot;http://pastebin.com/pGyYeYzd&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;]]></description>
		<content:encoded><![CDATA[<p>Anyway, here&#8217;s my crappy solution: <a href="http://pastebin.com/pGyYeYzd" rel="nofollow">link</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ardnew</title>
		<link>http://programmingpraxis.com/2009/05/15/cellular-automata/#comment-1311</link>
		<dc:creator><![CDATA[ardnew]]></dc:creator>
		<pubDate>Tue, 08 Jun 2010 21:50:51 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.wordpress.com/?p=573#comment-1311</guid>
		<description><![CDATA[Nevermind, I was misreading the text :)]]></description>
		<content:encoded><![CDATA[<p>Nevermind, I was misreading the text :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ardnew</title>
		<link>http://programmingpraxis.com/2009/05/15/cellular-automata/#comment-1310</link>
		<dc:creator><![CDATA[ardnew]]></dc:creator>
		<pubDate>Tue, 08 Jun 2010 21:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.wordpress.com/?p=573#comment-1310</guid>
		<description><![CDATA[There may be a little bit of confusion with the example rule 158 generations you provide. There are 13 lines listed there, not 12.]]></description>
		<content:encoded><![CDATA[<p>There may be a little bit of confusion with the example rule 158 generations you provide. There are 13 lines listed there, not 12.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remco Niemeijer</title>
		<link>http://programmingpraxis.com/2009/05/15/cellular-automata/#comment-108</link>
		<dc:creator><![CDATA[Remco Niemeijer]]></dc:creator>
		<pubDate>Fri, 15 May 2009 17:56:26 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.wordpress.com/?p=573#comment-108</guid>
		<description><![CDATA[My Haskell solution (see http://bonsaicode.wordpress.com/2009/05/15/programming-praxis-cellular-automata/ for a version with comments):

[sourcecode lang=&#039;css&#039;]
import Data.Bits
import Data.List

successor :: Int -&gt; [Bool] -&gt; Bool
successor r bs = testBit r . sum $
                 zipWith (shiftL . fromEnum) (reverse bs) [0..]

nextRow :: Int -&gt; [Bool] -&gt; [Bool]
nextRow r cs = map (successor r) . take (length cs) . transpose .
               take 3 . iterate (drop 1) $ [head cs] ++ cs ++ [last cs]

displayRow :: [Bool] -&gt; String
displayRow = intersperse &#039; &#039; . map (\b -&gt; if b then &#039;X&#039; else &#039; &#039;)

cells :: Int -&gt; Int -&gt; [String]
cells r h = map displayRow . take (h + 1) . iterate (nextRow r) $
            replicate h False ++ [True] ++ replicate h False

main :: IO ()
main = mapM_ putStrLn $ cells 82 15
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>My Haskell solution (see <a href="http://bonsaicode.wordpress.com/2009/05/15/programming-praxis-cellular-automata/" rel="nofollow">http://bonsaicode.wordpress.com/2009/05/15/programming-praxis-cellular-automata/</a> for a version with comments):</p>
<pre class="brush: css;">
import Data.Bits
import Data.List

successor :: Int -&gt; [Bool] -&gt; Bool
successor r bs = testBit r . sum $
                 zipWith (shiftL . fromEnum) (reverse bs) [0..]

nextRow :: Int -&gt; [Bool] -&gt; [Bool]
nextRow r cs = map (successor r) . take (length cs) . transpose .
               take 3 . iterate (drop 1) $ [head cs] ++ cs ++ [last cs]

displayRow :: [Bool] -&gt; String
displayRow = intersperse ' ' . map (\b -&gt; if b then 'X' else ' ')

cells :: Int -&gt; Int -&gt; [String]
cells r h = map displayRow . take (h + 1) . iterate (nextRow r) $
            replicate h False ++ [True] ++ replicate h False

main :: IO ()
main = mapM_ putStrLn $ cells 82 15
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Programming Praxis &#8211; Cellular Automata &#171; Bonsai Code</title>
		<link>http://programmingpraxis.com/2009/05/15/cellular-automata/#comment-107</link>
		<dc:creator><![CDATA[Programming Praxis &#8211; Cellular Automata &#171; Bonsai Code]]></dc:creator>
		<pubDate>Fri, 15 May 2009 17:56:06 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.wordpress.com/?p=573#comment-107</guid>
		<description><![CDATA[[...] Praxis &#8211; Cellular&#160;Automata By Remco Niemeijer  Today’s Programming Praxis problem is about cellular automata. Let&#8217;s dive [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Praxis &#8211; Cellular&nbsp;Automata By Remco Niemeijer  Today’s Programming Praxis problem is about cellular automata. Let&#8217;s dive [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

