28
May
Game Of Life
Today I've tried for the first time to implement a version of the Game of Life in JavaScript. For those of you who don't know: the Game of Life is not actually a game, but it's a simple demonstration of 'evolution' . It exists of a two-dimensional grid where each cell defines a creature or organism. A cell is either alive or dead (on or off).

The Rules

So how does it work? It's actually quite simple. The game begins by selecting a couple of cells and hitting start (or step if you only want to see one generation). After that a couple of rules are checked:
  • Any living cell with less than two living neighbours dies (feeling lonely and heart-broken)

  • Any living cell with either two or three neighbours stays alive(feeling fine and socially happy)
  • Any living cell with more than three neighbours dies out of over-population
  • Every dead cell with exactly three neighbours comes to live


That's all! After trying this out a few times below, you will see that those couple of rules can generate very interesting 'populations'.
'Play' the Game of Life below:



Now this is only a 11x11 board, imagine the populations possible on bigger grids! Check out Game of Life which will load a bigger version of the game and gives you the control to change the grid size and rules!

For more information on The Game of Life, see Wikipedia.

Edit @ 30-05-2007: Click here to go to the Game of Life animated GIF generator.



No Comments

Be the first to leave a comment for this article ;)


Leave a comment
Name*
E-mail
Website
Title*
Comment*
Notify me when somebody else comments on this article