The Game of Life

Generations: 2



Rules


  • Any live cell with fewer then two live neighbours dies - Under-Pop.
  • Any live cell with two or three live neighbours live on the next generation - Perfect-Pop.
  • Any live cell with 4+ neighbours dies - Over-Pop.
  • Any Dead cell with exactly 3 neighbours becomes alive - Reproduction
  • All cells outside the visable Grid are considered dead.


Algorithm


Each interation the program will make a new blank grid then will check the neighbours in a 3x3 area around for live cells. It then gets the count of live neighbours if under populated the cell dies if perfect populated cell lives if over populated cell dies, if dead and the conditions are just right then become alive. This cell is then saved to the new grid. After all cells have been checked save the new grid as the current grid.