문제

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