GameOfLife SimulateNextGeneration Method Delta Engine Documentation
Runs a tick in the game word, apply the Game of Life rule to each cell in the grid View code on GitHub

Namespace: GameOfLife
Assembly: GameOfLife (in GameOfLife.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public void SimulateNextGeneration()
Remarks

Tests: GameOfLife.Tests.GameOfLifeTests
Examples

5 unit tests call GameOfLife.GameOfLife.SimulateNextGeneration
[Test, CloseAfterFirstFrame]
public void RunningSimulationIncrementsGenerationByOne()
{
    Assert.AreEqual(0, gameOfLife.Generation);
    gameOfLife.SimulateNextGeneration();
    Assert.AreEqual(1, gameOfLife.Generation);
}
[Test, CloseAfterFirstFrame]
public void ResetGameState()
{
    ReviveAllCells();
    gameOfLife.SimulateNextGeneration();
    gameOfLife.ResetGameState();
    Assert.AreEqual(0, gameOfLife.Population);
    Assert.AreEqual(0, gameOfLife.Generation);
}
[Test, CloseAfterFirstFrame]
public void LiveCellWithMoreThanThreeLiveNeighborsDies()
{
    InitializeGameOfLife(new Size(3));
    ReviveAllCells();
    gameOfLife.SimulateNextGeneration();
    Assert.IsFalse(gameOfLife.IsCellAlive(1, 1));
}
See Also