There is a cant:
if(nbs == birth) preMatrix[nowI][nowJ] = 1;
if (nbs < save[0] || nbs > save[1]) preMatrix[nowI][nowJ] = 0;
If
nbs
is two - what then? Nothing. It seems to be correct, if there are two living neighbors, the cell should not change its state. However, setting the initial configuration, you are editing the
matrix
, and in the
preMatrix
, as there were zeros everywhere, they remain. And instead of copying the unit from
matrix
to
preMatrix
, you are not doing anything. Therefore, cells with two neighbors turn out to be dead in the next generation.
Anonymous