My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://ashokbasnet.com.np
and update your bookmarks.

Tuesday, August 7, 2012

jQuery implementation of Game of life!

One of the earliest experiments at simulating life in technology was a simple mathematical game created by John H. Conway, first published and popularized during the early 1970's in issues of Scientific American. He called it "The Game of Life."
The concept of the Game of Life is very simple. The game takes place over the cells in an array, like squares on a chessboard. Each cell can have an organism living inside it or not living inside it; or each cell itself can be alive or dead. Whatever frame of thought is used, each cell is described to be "on" or "off." At the beginning of the game, a certain number of cells are filled.

 

Methodology

Then the game begins. Every clock-tick, a new generation of cells is created. A set of rules is applied to each cell in the array to determine what will happen to the cell in this next generation. The rules are as follows:
  • If a cell is off and has three neighbors around it which are on, then the cell becomes on.
  • If a cell is on and has one or less neighbors around it which are on, the cell dies of loneliness (it becomes off).
  • If a cell is on and has more than three neighbors around it which are on, the cell dies of overcrowding.
Gameplay strategy
The game of life is a zero player game devised by mathematician John Horton Conway and explained by Scott E Page on the Coursera website in one of the videos on model thinking. The game is a grid of cells and each cell has a 'on' and a 'off' state or in other words, an 'alive' or 'dead' state. It has simple rules that can create complex patterns over time. If a cell is alive, then it can continue to 'live' only if it has exactly 2 or 3 neighboring cells alive, else it dies or goes 'off'. A dead cell can come alive only if it has exactly 3 neighboring cells alive. Over time, this creates intricate patterns and even animations! Certain patterns create 'blinkers' or even spawn into many more cells and spread across the grid.
Some screenshots
1. Initial State   initial state
    2.  Growth of Celloutpu
Other interesting patterns can be developed too.
Here is the link for the JQuery Implementation.







2 comments :

  1. This is useful blog, contains rich content about Create a Number Plate.All kinds of show plates and numberplates is excelled, we make sure the work according to your demand and choice and timely delivery is ensured.

    ReplyDelete
  2. you have a nice blog there. Mine is http://www.techonicals.com. Let me know if u r interested in exchanging a backlink with my site. Let me know by commenting on my blog

    ReplyDelete