Saturday, January 24, 2009

 

Game of Life in JavaScript

Today I implemented my old (1994) "fast enough" algorithm of Game of Life in JavaScript (see source code here - life.js) and now LIFE table can be "embedded" directly to HTML:


0000001211
0000002353
0000002231
0000001232
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000



Usually programs of LIFE operate two 2-dimensional arrays of booleans calculating neighbours for every cell in every generation by walking through nearest 8 cells for each cell on map and modifying second array according to LIFE rules (alive cell will live if it has 2 or 3 alive neighbours, dead cell will be alive again if it has exactly 3 alive neighbours, otherwise cell must be dead) as a buffer to copy it to primary array later at the end of calculation for each generation. My algorithm uses precalculated number of neighbours for each cell walking through nearest 8 cell ONLY if something changed inside cell (transition from dead to alive or from alive to dead) to decrease or increase number of neighbours in 8 nearest cells respectively.

Labels: ,


Tuesday, April 15, 2008

 

"Game of Life" evolution network

Some time ago I registered domain LifeGE.net. Main idea of LifeGE.net was creating place to discuss some techniques for automatic design of some Conway's Game of Life patterns for implementation of real computer over Game of Life. I plan to use genetic algorithms for search of that patterns and also I need help of Internet people and their CPU cycles ;)
P.S. You can read about cellular automata "Conways's Game of Life" on Wikipedia.

Labels: , ,


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]