<?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>Nathaniel Johnston &#187; Python</title>
	<atom:link href="http://www.njohnston.ca/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.njohnston.ca</link>
	<description>A blog of recreational math and quantum information theory</description>
	<lastBuildDate>Wed, 16 May 2012 14:46:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The Maximal Lifespan of Patterns in Conway&#039;s Game of Life</title>
		<link>http://www.njohnston.ca/2009/07/the-maximal-lifespan-of-patterns-in-conways-game-of-life/</link>
		<comments>http://www.njohnston.ca/2009/07/the-maximal-lifespan-of-patterns-in-conways-game-of-life/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 12:00:10 +0000</pubDate>
		<dc:creator>Nathaniel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Conway's Game of Life]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nathanieljohnston.com/?p=542</guid>
		<description><![CDATA[In a couple of recent posts, I argued that random patterns in Conway&#8217;s Game of Life tend, on average, to live longest when they have an initial density of 37.5% cells being alive. In this post, rather than looking at the distribution of the average lifespan for various initial densities, I will fix the density [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.nathanieljohnston.com/index.php/2009/06/longest-lived-soup-density-in-conways-game-of-life/">couple</a> of <a href="http://www.nathanieljohnston.com/index.php/2009/07/longevity-in-conways-game-of-life-revisited/">recent posts</a>, I argued that random patterns in Conway&#8217;s Game of Life tend, on average, to live longest when they have an initial density of 37.5% cells being alive. In this post, rather than looking at the distribution of the average lifespan for various initial densities, I will fix the density at 37.5% and look at the distribution of lifespans that results, and use that to estimate what the maximal lifespan of any small pattern is (as in my previous posts, I will use 20&#215;20 starting patterns). As before, I will explore both the case when we simulate Life on a torus and when we simulate it on an infinite plane.</p>
<h3>Lifespan Distribution on a Torus</h3>
<p>After simulating 175000 random patterns on a 20&#215;20 torus, the distribution of the lifespans was as follows:</p>
<p style="text-align: left;"><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph11.png"><img class="size-full wp-image-543 aligncenter" title="Lifespan Frequency Histogram on a Torus" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph11.png" alt="Lifespan Frequency Histogram on a Torus" width="504" height="353" /></a>The bins in the graph have a width of 10, and the peak occurs in the lifespan 91 &#8211; 100 bin. Some other interesting stats include:</p>
<ul>
<li>Maximum observed lifespan: 2092</li>
<li>Minimum observed lifespan: 14</li>
<li>Average lifespan: 210</li>
<li>Median lifespan: 164</li>
<li>Standard deviation of lifespan: 159.3</li>
</ul>
<p>In order to try to estimate the longest lifespan of any pattern on a 20&#215;20 torus, I will assume that if the lifespan is above 100, then it follows an exponential distribution, which appears to be a reasonable assumption given the above histogram. Indeed, this leads to the following histogram, which has the exponential of best fit overlaid in black. The equation of the exponential is y = 9088.7(0.938)<sup>x</sup>, and the R<sup>2</sup> value is 0.997 (that&#8217;s one heck of a good fit).</p>
<p style="text-align: left;"><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph21.png"><img class="size-full wp-image-544 aligncenter" title="Lifespan Frequency Trend on a Torus" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph21.png" alt="Lifespan Frequency Trend on a Torus" width="505" height="353" /></a>Now that we have our exponential of best fit, we can get an estimate of the maximal lifespan in this scenario by assuming that the lifespan of the 2<sup>20*20</sup> different patterns are independent of each other (this may not be a particularly good assumption, as two patterns, for example, will have the same lifespan if they are translations of each other &#8212; nonetheless it seems that the number of reductions that can be made by symmetry arguments like that is tiny compared to the total number of such patterns, so let&#8217;s roll with it). We then set</p>
<p style="text-align: left; "><img class="aligncenter size-full wp-image-545" title="Torus equation" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/eq.gif" alt="Torus equation" width="174" height="19" /></p>
<p style="text-align: left;">and solve for x to get a maximal lifespan of x = 4474. This seems believable and not particularly shocking to me given the statistics that I listed earlier.</p>
<h3>Lifespan Distribution on a Plane</h3>
<p style="text-align: left;">Typically, Life enthusiasts are more interested in results on the infinite plane than on a torus, as it leads to behaviour that is much more chaotic and unpredictable. For example, even though we just saw that the longest-lived 20&#215;20 pattern on a torus likely lives for less than 4500 generations, <a href="http://www.conwaylife.com/wiki/index.php?title=Lidka">there is a known 9&#215;15 pattern</a> that lives on the plane for over 29000 generations. We will now proceed analogously to the torus discussion above to see how much better we can reasonably expect to do. We begin with the distribution of the lifespan based on 60000 initial 20&#215;20 patterns:</p>
<p style="text-align: center;"><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph3.png"><img class="aligncenter size-full wp-image-548" title="Lifespan Frequency Histogram on a Plane" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph3.png" alt="Lifespan Frequency Histogram on a Plane" width="500" height="355" /></a></p>
<p style="text-align: left;">The bins in the graph have a width of 50, and the peak occurs in the lifespan 151 &#8211; 200 bin. The other basic stats are listed below, and as we would expect, the average lifespan and the standard deviation of lifespans are both much greater on the plane than they are on the torus.</p>
<ul>
<li>Maximum observed lifespan: 13612</li>
<li>Minimum observed lifespan: 15</li>
<li>Average lifespan: 678</li>
<li>Median lifespan: 368</li>
<li>Standard deviation of lifespan: 885.6</li>
</ul>
<p>The main difference with the analysis in this situation is that instead of assuming the lifespan itself follows an exponential distribution, I will assume that some power of the lifespan follows an exponential distribution; the reason for this is that the R<sup>2</sup> is quite low if we try to fit an exponential to the distribution of the lifespans itself. Fitting an exponential to lifespan<sup>0.75</sup> seems to give the maximum R<sup>2</sup> value (0.9857), so this is what I will use. The following histogram shows the curve of best fit, which has the equation y = 1854.6(0.957)<sup>x</sup>, where this time x = lifespan<sup>0.75</sup>.</p>
<p style="text-align: center;"><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph41.png"><img class="size-full wp-image-551 aligncenter" title="Lifespan Frequency Trend on a Plane" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph41.png" alt="Lifespan Frequency Trend on a Plane" width="514" height="351" /></a></p>
<p style="text-align: center;">
<p style="text-align: left;">Finally, we follow our method from before and set</p>
<p style="text-align: left;"><img class="aligncenter size-full wp-image-552" title="Lifespan on a Plane Equation" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/eq2.gif" alt="Lifespan on a Plane Equation" width="190" height="23" /></p>
<p style="text-align: left;">and solve for x to get a maximal lifespan of x = 120795. Of course, this number should be taken with a grain of salt, because that pattern I mentioned earlier that has a lifespan of over 29000 generations was found <a href="http://www.geocities.com/conwaylife/">during a simulation</a> of a whopping 12 billion 20&#215;20 patterns, while our equation of best fit tells us that after 12 billion patterns, we would expect only to see a pattern with lifespan 6206 (when really it should only take about 400 patterns to see such a lifespan). Similarly, in the <a href="http://www.conwaylife.com/soup/methuselahs.asp?rule=B3/S23">longest-lived patterns</a> found by the Online Life-Like CA Soup Search, a pattern has been found with lifespan 24389. According to our formula, we should have to look at roughly 9 million billion billion billion soups before finding such a pattern, but only 40 million soups have actually been searched.</p>
<p style="text-align: left;">This all seems to suggest that the longest-lived pattern in a 20&#215;20 box may in fact live considerably <em>longer</em> than 120000 generations, which goes to show just how in the dark we are when it comes to some of these simple questions &#8212; since the search space is so unimaginably huge, we likely will never know for sure what the true upper limit is.</p>
<p style="text-align: left;"><strong>Downloads:</strong></p>
<ul>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/Torus-Lifespans.zip"></a><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/Lifespan-Distribution.zip">Lifespan raw data and graphs</a> [.zip of an Excel spreadsheet — 2.91MB]</li>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/Lifespan-Recorders.zip">Lifespan recorder scripts</a> [.zip of two Golly Python scripts]</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.njohnston.ca/2009/07/the-maximal-lifespan-of-patterns-in-conways-game-of-life/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Longevity in Conway&#039;s Game of Life Revisited</title>
		<link>http://www.njohnston.ca/2009/07/longevity-in-conways-game-of-life-revisited/</link>
		<comments>http://www.njohnston.ca/2009/07/longevity-in-conways-game-of-life-revisited/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 12:00:20 +0000</pubDate>
		<dc:creator>Nathaniel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Conway's Game of Life]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nathanieljohnston.com/?p=493</guid>
		<description><![CDATA[A couple of weeks ago, I posted some intuition that suggested that, in Conway&#8217;s Game of Life, the longest-lived patterns should on average be those with density right around 37.5%. To test this hypothesis, I wrote a simple Golly Python script that generated random 20&#215;20 patterns of varying densities and checked how long it took [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago, I <a href="http://www.nathanieljohnston.com/index.php/2009/06/longest-lived-soup-density-in-conways-game-of-life/">posted</a> some intuition that suggested that, in <a href="http://www.conwaylife.com/wiki/index.php?title=Conway's_Game_of_Life">Conway&#8217;s Game of Life</a>, the longest-lived patterns should on average be those with density right around 37.5%. To test this hypothesis, I wrote a simple <a href="http://golly.sourceforge.net/">Golly</a> Python script that generated random 20&#215;20 patterns of varying densities and checked how long it took for them to stabilize. One noticeable problem cropped up, however: patterns with density around 90% tended to live for an extremely long time due to edge effects that caused the pattern to explode out of the original 20&#215;20 box initially, even though they would almost entirely die off <em>within</em> the box.</p>
<p>The solution to the given problem is to emulate the Game of Life not on an infinite planar grid, but rather on a toroidal grid; that is, we fix our 20&#215;20 universe and treat the top row as if it borders the bottom row and the left row as if it borders the right row. Running the simulation in this set-up results in data that matches our intuition more closely:</p>
<p><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph1.png"><img class="aligncenter size-full wp-image-496" title="Lifespan on a Torus" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph1.png" alt="Lifespan on a Torus" width="560" height="384" /></a>The results are based on 13592 random patterns of each density 1%, 2%, 3%, &#8230;, 99%. As with the previous graph, we notice that the lifespan plateaus in the 25% &#8211; 50% range, providing evidence that our intuition for a maximum at 37.5% is probably well-founded. Also, <a href="http://www.nathanieljohnston.com/index.php/2009/06/longest-lived-soup-density-in-conways-game-of-life/#comment-465">at the request of Elithrion</a> in the comments on the previous post, I have included the median plot for the lifespans this time as well, though the median seems to behave pretty similarly to the average (it&#8217;s just more or less uniformly 25% smaller). As we would expect, the average lifespan in the toroidal universe set-up is much lower than the average lifespan in the infinite planar grid set-up, because expanding patterns have nowhere to go. The longest-lived pattern that was found on the torus had a lifespan of 2169 (and an initial density of 30%), whereas the longest-lived pattern that was found on the infinite plane (over significantly fewer trials, I might add) was 14042.</p>
<p>While I&#8217;m presenting results, how about we take a look at the final population of patterns of various starting densities?</p>
<p><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph2.png"><img class="aligncenter size-full wp-image-497" title="Torus final population" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/graph2.png" alt="Torus final population" width="554" height="387" /></a>The behaviour is almost identical to that of the average/median lifespan. The one cool thing is that, in addition to the plateau centred at ~37.5%, here we see that the median final population peaks with a value of 13 at an initial density of 38%. Nevermind the fact that this is almost certainly a statistical anomaly &#8212; it helps support my original hypothesis, and if the popular news media has taught me anything, it&#8217;s that randomly picking out things like that and claiming that they are significant is always mathematically sound.</p>
<p><strong>Downloads:</strong></p>
<ul>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/Torus-Lifespans.zip">Lifespan and final population raw data</a> [.zip of an Excel spreadsheet — 2.99MB]</li>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/torus_lifespan_script.zip"></a><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/torus_lifespan_script1.zip">Torus lifespan script</a> [.zip of a Golly Python script]</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.njohnston.ca/2009/07/longevity-in-conways-game-of-life-revisited/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Online Life-Like CA Soup Search</title>
		<link>http://www.njohnston.ca/2009/07/the-online-life-like-ca-soup-search/</link>
		<comments>http://www.njohnston.ca/2009/07/the-online-life-like-ca-soup-search/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 18:42:24 +0000</pubDate>
		<dc:creator>Nathaniel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cellular automata]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Conway's Game of Life]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nathanieljohnston.com/?p=465</guid>
		<description><![CDATA[Today I&#8217;m &#8220;officially&#8221; announcing the Online Life-Like CA Soup Search, though some of the folks over at the ConwayLife.com forums have been helping me test it out for a couple of weeks now. As I mentioned in this post, one way to learn about the general behaviour of Conway&#8217;s Game of Life (or any other [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;m &#8220;officially&#8221; announcing the <a href="http://www.conwaylife.com/soup/">Online Life-Like CA Soup Search</a>, though some of the folks over at the <a href="http://www.conwaylife.com/forums/">ConwayLife.com forums</a> have been helping me test it out for a couple of weeks now.</p>
<p>As I mentioned in <a href="http://www.nathanieljohnston.com/index.php/2009/06/longest-lived-soup-density-in-conways-game-of-life/">this post</a>, one way to learn about the general behaviour of Conway&#8217;s Game of Life (or any other <a href="http://www.conwaylife.com/wiki/index.php?title=Life-like_cellular_automata#Life-like_cellular_automata">Life-like cellular automaton</a>) is to generate random patterns and see what stable patterns they typically evolve into (if any). If you&#8217;ve played around with Conway&#8217;s Game of Life, then you more than likely are very familiar with <a href="http://www.conwaylife.com/wiki/index.php?title=Block">blocks</a>, <a href="http://www.conwaylife.com/wiki/index.php?title=Blinker">blinkers</a>, <a href="http://www.conwaylife.com/wiki/index.php?title=Beehive">beehives</a>, <a href="http://www.conwaylife.com/wiki/index.php?title=Loaf">loaves</a>, and maybe even <a href="http://www.conwaylife.com/wiki/index.php?title=Pulsar">pulsars</a>, simply as a result of drawing random gibberish on the grid and letting it evolve. This is exactly the idea behind the Online Life-Like CA Soup Search, just on a larger scale &#8212; what if we had lots of people&#8217;s computers drawing random gibberish on Life grids, letting them evolve, and storing the resulting patterns in a communal database?</p>
<p>This method of collecting patterns in Life is known as a census, and to my knowledge it has been carried out on a relatively large scale twice in the past; once by Achim Flammenkamp (results <a href="http://wwwhomes.uni-bielefeld.de/achim/freq_top_life.html">here</a>), and once by Andrej Okrasinski (results linked in the first paragraph <a href="http://www.geocities.com/conwaylife/">here</a>). As we would expect, the block is by far the most common still life, and the blinker is by far the most common oscillator. If we scroll down a bit, we see that the pulsar is the fourth most common oscillator (which is reasonably surprising, given its size). Scrolling much past that, we get into the interesting stuff &#8212; objects that no reasonable person has ever seen from drawing random stuff and seeing what it evolves into, simply because they occur so infrequently.</p>
<p>So why bother doing another census if two rather large-scale censuses (censi?) have already been carried out? My reasons are threefold:</p>
<ol>
<li>There has never (to my knowledge) been a census of any other Life-like cellular automata conducted. The Online Life-Like CA Soup Search is completely general in that it can conduct a census of any Life-like rule (assuming that rule is stable, of course). Censuses have already been started for five other rules, including <a href="http://www.conwaylife.com/soup/census.asp?rule=B36/S125&amp;sl=1&amp;os=1&amp;ss=1">2&#215;2</a>, <a href="http://www.conwaylife.com/soup/census.asp?rule=B3678/S34678&amp;sl=1&amp;os=1&amp;ss=1">Day &amp; Night</a>, <a href="http://www.conwaylife.com/soup/census.asp?rule=B36/S23&amp;sl=1&amp;os=1&amp;ss=1">HighLife</a>, and <a href="http://www.conwaylife.com/soup/census.asp?rule=B368/S245&amp;sl=1&amp;os=1&amp;ss=1">Move</a>. Because some of these other rules have been studied relatively little, this is an easy way of discovering new yet fundamental patterns in them. For example, it didn&#8217;t take long for the soup search script to uncover a c/8 line puffer in the 2&#215;2 (B36/S125) rule; the very first known pattern that exhibits infinite growth in 2&#215;2!
<p><div id="attachment_471" class="wp-caption aligncenter" style="width: 92px"><a href="http://www.conwaylife.com/?p=2x2linepuffer"><img class="size-full wp-image-471" title="2x2 Line Puffer" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/glider.gif" alt="Line puffer in 2x2" width="82" height="98" /></a><p class="wp-caption-text">Line puffer in 2x2</p></div></li>
<li>Previous soup searches were limited in that they only looked for very specific types of objects &#8212; usually still lifes and oscillators (though Achim Flammenkamp did a search for spaceships and puffers that can be viewed <a href="http://wwwhomes.uni-bielefeld.de/achim/moving.html">here</a>). The Online Life-Like CA Soup Search searches for still lifes, oscillators, spaceships and puffers all at once, and even gets pseudo objects (such as the <a href="http://www.conwaylife.com/wiki/index.php?title=Bi-block">bi-block</a>) as well.</li>
<li>Multiple users can run the script and contribute to the results simultaneously. Rather than just having one person run a script that they themself wrote, the Online Life-Like CA Soup Search works by having users download a script and that script uploads results to the central database. This obviously provides a huge speed-up, and allows the census to continuously improve and expand.</li>
</ol>
<p>So what are you waiting for? Visit the <a href="http://www.conwaylife.com/soup/">Online Life-Like CA Soup Search</a>, download the script, and put your computer&#8217;s CPU cycles to good use!</p>
<div id="attachment_469" class="wp-caption aligncenter" style="width: 571px"><a href="http://www.conwaylife.com/soup/census.asp?rule=B3/S23&amp;sl=1&amp;os=1&amp;ss=1"><img class="size-full wp-image-469  " title="Conway's Game of Life Census" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/cens.png" alt="Census results in Conway's Game of Life" width="561" height="407" /></a><p class="wp-caption-text">Census results in Conway&#39;s Game of Life</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.njohnston.ca/2009/07/the-online-life-like-ca-soup-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Longest-Lived Soup Density in Conway&#039;s Game of Life</title>
		<link>http://www.njohnston.ca/2009/06/longest-lived-soup-density-in-conways-game-of-life/</link>
		<comments>http://www.njohnston.ca/2009/06/longest-lived-soup-density-in-conways-game-of-life/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 04:00:40 +0000</pubDate>
		<dc:creator>Nathaniel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Conway's Game of Life]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.nathanieljohnston.com/?p=418</guid>
		<description><![CDATA[In Conway&#8217;s Game of Life, a simple way to learn about the general dynamics of the game are to study what happens to soup – patterns made up of a random assortment of ON and OFF cells. Two particularly interesting questions that we can ask are &#8220;What types of stable patterns arise most frequently from soup?&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.conwaylife.com/wiki/index.php?title=Conway's_Game_of_Life">Conway&#8217;s Game of Life</a>, a simple way to learn about the general dynamics of the game are to study what happens to <a href="http://www.conwaylife.com/wiki/index.php?title=Soup">soup</a> – patterns made up of a random assortment of ON and OFF cells. Two particularly interesting questions that we can ask are <em>&#8220;What types of stable patterns arise most frequently from soup?&#8221;</em> and <em>&#8220;How long does soup generally last before stabilizing?&#8221; </em> I will focus on the latter question for today&#8217;s post, as the former has become the bud of a more ambitious project that I will announce in the near future.</p>
<p>The question of how long soup generally lasts before stabilizing is quite vague, because there are two important considerations that we have not specified:</p>
<ol>
<li>How dense should the soup be? Clearly soup with ON density of 5% will survive only a fraction as long as soup with ON density of 50%.</li>
<li>How large of a region of soup should we let evolve? Smaller regions will stabilize much more quickly than large regions, and infinite regions will likely never stabilize(?), not to mention we can&#8217;t effectively simulate an infinite field of random cells.</li>
</ol>
<p>For #2, I will choose the region to be of size 20×20. This decision is pretty arbitrary, but part of the reason I chose such a small size is as a desire to make this script kill two birds with one stone; any particularly long-lived patterns of this size that are discovered can likely be considered <a href="http://www.conwaylife.com/wiki/index.php?title=Methuselah">methuselahs</a>, while larger patterns can not.</p>
<p>For #1, we might naively expect that patterns will live longest if they have density 37.5%, since cells are born if and only if they have exactly three ON neighbours (out of a possible eight = 37.5%). To test this theory, I created a <a href="http://golly.sourceforge.net/">Golly</a> script that creates regions of varying density and checks how long it takes for them to stabilize. The following graph shows the average lifespan of 20×20 patterns with densities ranging from 1% to 99%, based on 5000 generated patterns for each percentage point.</p>
<p style="text-align: center;"><img class="size-full wp-image-429 aligncenter" title="Average Lifespan vs. Density" src="http://njohns01home.webfactional.com/wp-content/uploads/2009/06/Lifespan.png" alt="Average lifespan after 5000 trials" width="592" height="422" /></p>
<p>Indeed, it looks like the longest-lived density estimate of 37.5% isn&#8217;t too far off. The true maximum in this set-up might actually be slightly higher, but that is most likely caused by the same thing that is causing the hump centered at 90%: edge effects. Roughly speaking, because we are simulating a finite region of soup on an infinite grid (as opposed to on a toroidal universe), patterns of higher density will tend to expand out very quickly in their first few generations, giving them longer lifespans in general than they would have on a toroidal universe. Alas, Golly doesn&#8217;t support toroidal universes, so the toroidal lifespan results will have to wait for another day.</p>
<p><strong><span style="color: #800000;">Update [July 8, 2009]:</span></strong> I have attached to the end of this post the Python script used to generate these results.</p>
<p><strong><span style="color: #800000;">Update [July 11, 2009]:</span></strong> See <a href="http://www.nathanieljohnston.com/index.php/2009/07/the-online-life-like-ca-soup-search/">this post</a>, which deals with the &#8220;more ambitious project&#8221; that I mentioned.</p>
<p><strong><span style="color: #800000;">Update [July 19, 2009]:</span></strong> See <a href="http://www.nathanieljohnston.com/index.php/2009/07/longevity-in-conways-game-of-life-revisited/">this post</a>, which deals with soup longevity on a torus.</p>
<p><strong>Downloads:</strong></p>
<ul>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/06/Methuselah-14042.zip">Methuselah 14042</a> &#8211; A methuselah with lifespan 14042 found during the search [.zip of an RLE file]</li>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/07/methuselah_density.zip">Methuselah Search Script</a> [.zip of a Golly Python script]</li>
<li><a href="http://njohns01home.webfactional.com/wp-content/uploads/2009/06/Soup-densities.xls">Soup Density Data</a> [Excel spreadsheet — 26.0kB]</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.njohnston.ca/2009/06/longest-lived-soup-density-in-conways-game-of-life/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

