Page 1 of 1

Posted: April 13th, 2016, 9:52 am
Hi,

I plan to make program-code for the "game of life".
To thoroughly understand the principle I took some graph-paper and drew a starting-pattern (the Pentomino).
Now, I have some questions :

Suppose a dead Cell (call this Cell A) pops into life because of 3 live neighbours. Chances are that, as a result, another live cell (call this B) will die because it suddenly has more than three living neighbours.

Is it common practice to FIRST show Cell A and then in the next step eliminate B or do should this all be done in some background-activity and show cell A and B together?.

My plan was to scan the grid, see which cell pop to live and which ones will die. Then scan the grid again and do the same and-so-on....

### Re: Question about the rules

Posted: April 13th, 2016, 11:07 am
merijn0301 wrote:Is it common practice to FIRST show Cell A and then in the next step eliminate B or do should this all be done in some background-activity and show cell A and B together?.

My plan was to scan the grid, see which cell pop to live and which ones will die. Then scan the grid again and do the same and-so-on....
Yes, that's how it works. All birth and death updates happen simultaneously in each generation.

In other words, a cell that's newly ON or OFF at time T won't affect neighbor counts at time T, but it will affect counts at time T+1. A common way of programming this is to copy the Life grid back and forth between two arrays, checking each cell to see if it should change in that step.

There are other algorithms that are usually much faster -- e.g., keeping a list of ON cells and their OFF neighbors, and only checking the OFF cell list for births, and the ON cell list for deaths, in each step. There's a lot of empty space in most Life grids, and there's really no point in processing it unless there are live cells right next to it.

### Re: Question about the rules

Posted: April 13th, 2016, 2:09 pm
Thank's,