From 8016412f184aa275e69d449d3b6369877c00e0ae Mon Sep 17 00:00:00 2001 From: Riley Shaw Date: Sat, 23 Aug 2014 16:16:26 -0700 Subject: [PATCH] Update 2014-08-23T23:16:26.007Z --- index.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 3c4dc5b..20d8eb8 100644 --- a/index.html +++ b/index.html @@ -65,7 +65,9 @@ ex1.populate([['secondCreature', 10], ['simplePlant', 90]]);

Examples

Conway's Game of Life ?

-
terra.creatureFactory.register({
+    
var gameOfLife = new Terrarium(25, 25);
+
+terra.creatureFactory.register({
   type: 'GoL',
   colorFn: function () { return this.alive ? this.color + ',1' : '0,0,0,0'; },
   wait: function () {},
@@ -79,10 +81,15 @@ ex1.populate([['secondCreature', 10], ['simplePlant', 90]]);
} }, function () { this.alive = Math.random() < 0.5; -});
+}); + +gameOfLife.populate([['GoL', 100]]); +gameOfLife.animate();

Cyclic Cellular Automaton ?

-
terra.creatureFactory.register({
+    
var cyclic = new Terrarium(25, 25);
+
+terra.creatureFactory.register({
   type: 'cyclic',
   colors: ['255,0,0,1', '255,96,0,1', '255,191,0,1', '223,255,0,1', '128,255,0,1', '32,255,0,1', '0,255,64,1', '0,255,159,1', '0,255,255,1', '0,159,255,1', '0,64,255,1', '32,0,255,1', '127,0,255,1', '223,0,255,1', '255,0,191,1', '255,0,96,1'],
   colorFn: function () { return this.colors[this.state];},
@@ -97,7 +104,10 @@ ex1.populate([['secondCreature', 10], ['simplePlant', 90]]);
} }, function () { this.state = Math.floor(Math.random() * 16); -});
+}); + +cyclic.populate([['cyclic', 100]]); +cyclic.animate();

If you come up with a cool example, let me know! I'll add it to this list and credit you.