{"id":163,"date":"2009-01-21T00:00:10","date_gmt":"2009-01-21T07:00:10","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=565"},"modified":"2009-01-21T00:00:10","modified_gmt":"2009-01-21T07:00:10","slug":"quasimondos-game-of-life","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=163","title":{"rendered":"Game of Life Snippets"},"content":{"rendered":"<p><a href=\"http:\/\/www.quasimondo.com\/examples\/game_of_life\/srcview\/\" target=\"blank\">SNIPPET ONE<\/a><\/p>\n<p><a href=\"http:\/\/www.25lines.com\/forum\/viewtopic.php?f=3&#038;t=3\" target=\"blank\">SNIPPET TWO<\/a><\/p>\n<p>I was very impressed when I saw <a href=\"http:\/\/www.quasimondo.com\/archives\/000680.php\" target=\"blank\">Mario Klingemann&#8217;s game of line in 3 lines of code blog post<\/a> late last year. I&#8217;ve been meaning to post about it for awhile &#8211; finally got around to it.<\/p>\n<p><a href=\"http:\/\/www.quasimondo.com\/\" target=\"blank\">Mario Klingemann<\/a> is the developer of <a href=\"http:\/\/aviary.com\/blog\/peacock\" target=\"blank\">Peacock<\/a>&#8230; an excellent node based image generator written in ActionScript.<\/p>\n<p>BitmapData.paletteMap() is very powerful. I haven&#8217;t done much with it, but I have some ideas floating around.<\/p>\n<p>For those of you that are game of live savvy&#8230; try other rule sets from the lexicon&#8230; my personal favorite has always been coral (45678\/3). <a href=\"http:\/\/psoup.math.wisc.edu\/mcell\/rullex_life.html\" target=\"blank\">Here&#8217;s a link to some more<\/a>.<\/p>\n<p>Another short game of life recently appeared on on the <a href=\"http:\/\/www.25lines.com\/\" target=\"blank\">25lines.com<\/a> forums&#8230;. <a href=\"http:\/\/www.25lines.com\/forum\/viewtopic.php?f=3&#038;t=3\" target=\"blank\">here<\/a>&#8230; the forum post features a nice explanation for using a ConvolutionFilter and Threshold to create The Game of Life. The technique is so small and impressive looking that I figured I&#8217;d post it as is right here:<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\naddChild(new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, false, 0)))&#x5B;&quot;bitmapData&quot;].noise(int(Math.random()*int.MAX_VALUE),0,255,7,true);\r\naddEventListener(Event.ENTER_FRAME, function (e) {\r\n   getChildAt(0)&#x5B;&quot;bitmapData&quot;].applyFilter(getChildAt(0)&#x5B;&quot;bitmapData&quot;], getChildAt(0)&#x5B;&quot;bitmapData&quot;].rect, new Point(), new ConvolutionFilter(3, 3, &#x5B;3,3,3,3,2,3,3,3,3],255,0,true,false,0,1));\r\n   getChildAt(0)&#x5B;&quot;bitmapData&quot;].threshold(getChildAt(0)&#x5B;&quot;bitmapData&quot;], getChildAt(0)&#x5B;&quot;bitmapData&quot;].rect, new Point(), &quot;==&quot;, 8, 0xFFFFFFFF, 0xFC);\r\n   getChildAt(0)&#x5B;&quot;bitmapData&quot;].threshold(getChildAt(0)&#x5B;&quot;bitmapData&quot;], getChildAt(0)&#x5B;&quot;bitmapData&quot;].rect, new Point(), &quot;!=&quot;, 0xFFFFFFFF, 0x00000000)})\r\n<\/pre>\n<p><i>The above code is by Daniil Tutubalin 25lines.com forums.<\/i><\/p>\n<p>UPDATE:<\/p>\n<p>Since writing this post the 25lines.com forum thread has grown to include a 4 line version and some additional discussion about this topic&#8230; <a href=\"http:\/\/www.25lines.com\/forum\/viewtopic.php?f=3&#038;t=3\">be sure to check it out<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SNIPPET ONE SNIPPET TWO I was very impressed when I saw Mario Klingemann&#8217;s game of line in 3 lines of code blog post late last year. I&#8217;ve been meaning to post about it for awhile &#8211; finally got around to it. Mario Klingemann is the developer of Peacock&#8230; an excellent node based image generator written [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,94,25],"tags":[3,4],"class_list":["post-163","post","type-post","status-publish","format-standard","hentry","category-bitmapdata","category-misc","category-pixel-manipulation","tag-actionscript","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=163"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/163\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}