flash on 2009-3-24
package {
import flash.display.*;
import flash.events.Event;
import flash.filters.ConvolutionFilter;
import flash.geom.Point;
public class lifegame extends Sprite
{
public function lifegame()
{
addChild(new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, false, 0)))["bitmapData"].noise(int(Math.random()*int.MAX_VALUE),0,255,7,true);
addEventListener(Event.ENTER_FRAME, function (e:Event):void {
getChildAt(0)["bitmapData"].applyFilter(getChildAt(0)["bitmapData"], getChildAt(0)["bitmapData"].rect, new Point(), new ConvolutionFilter(3, 3, [3,3,3,3,2,3,3,3,3],255,0,true,false,0,1));
getChildAt(0)["bitmapData"].threshold(getChildAt(0)["bitmapData"], getChildAt(0)["bitmapData"].rect, new Point(), "==",8, 0xFFFFFFFF, 0xFC);
getChildAt(0)["bitmapData"].threshold(getChildAt(0)["bitmapData"], getChildAt(0)["bitmapData"].rect, new Point(), "!=",0xFFFFFFFF, 0);
})
}
}
}