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?

有帮助吗?

解决方案

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

其他提示

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

By that terminology, yes, any cell that is not alive is dead. There are only two states for the cells, dead or alive.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top