Search code examples
javascriptcanvasconways-game-of-life

Conways Game of Life how to interpret rules


I am working on a side project, Conway's Game of life in canvas and Javascript. Technically everything is going smoothly but I have a problem about one of the rules.

One rule states that "Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.".

Currently I keep track of all living and dead cells, so these are only cells that have been drawn onto the grid previously. But I am unsure if the rule stated above also applies on a cell that is not draw yet.

So when is a cell considered "dead" or is a cell that has not been alive previously also considered dead?


Solution

  • Yes, cells in Game of Life may only be 'alive' or 'dead'. If they have never been alive, they are dead.