You need to use another grid (2 dimensional array) to calculate the next generation of cells. With only one grid, the next generation is calculated from a mixture of the current generation and the next generation.
The answer i gave ex-Mortis considers that you were aware of what christop said and calculates the output with the mixture he said