Skip to content

ThuyNT13/GameOfLife

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Beta-tested WickedlySmart's projects so I got to have fun with algorithms and data structures in the Game of Life (not the Hasbro board game). When mathematician John Horton Conway introduced his game, a whole new field of mathematical research was born, cellular automata.

The Game of Life consists of a two-dimensional grid of cells, each of whose state is either live (on) or dead (off). As a zero-player game, the evolution of the game progresses dependent upon the state of the neighbors of a particular cell. The rules that dictate whether or not a cell lives or dies are as follows:

      1. Birth: if the current cell is dead and the count is 3 neighbors, it is switched on to live.

      2. Survival: if the current cell is live and the count is 2 or 3 neighbors, the state is left unchanged.

      3. Death: if the current cell is live and the neighbor count is less than 2 (underpopulation) or greater than 3 (overpopulation), it is switched off to dead.

      ** Neighbors are any cells that are horizontally, vertically or diagonally adjacent to a particular cell.

To start the game, the board needs to be seeded with initial patterns for the program to have something to work with. This is the first generation of the game. The challenge is to find intial patterns that will generate life indefinitely, or at least for as many generations as possible. This is the original Sim game to test your ability to find the key to the survival of the fittest.

Ten consecutive live cells in a row (horizontally) or in a column (vertically) produces a momentary explosion of life. The glider crawls along a diagonal path across the grid. And then there's the Glider Gun.

Next Steps

  1. D3.js!

  2. consider adding color to further "stages of life".

  3. add buttons to select algorithmic patterns

  4. button to slowly step-through generations

  5. find a way to add patterns to board