public void AnyDeadCellWithExactlyThreeLiveNeighboursBecomesALiveCellAsIfByReproduction() { var grid = new Grid(new Cell(0, 0), new Cell(1, 0), new Cell(2, 0)); grid = grid.CreateNextGeneration(); Assert.True(grid.IsAlive(new Cell(1, 1))); }
public void AnyLiveCellWithTwoLiveNeighboursLivesOnToTheNextGeneration() { var grid = new Grid(new Cell(1, 1), new Cell(0, 1), new Cell(2, 1)); grid.CreateNextGeneration(); Assert.True(grid.IsAlive(new Cell(1, 1))); }
public void AnyLiveCellWithFewerThanTwoLiveNeighboursDiesAsIfCausedByUnderPopulation() { var grid = new Grid(new Cell(1, 1), new Cell(0, 1)); grid = grid.CreateNextGeneration(); Assert.False(grid.IsAlive(new Cell(1, 1))); }
public void AnyLiveCellWithMoreThanThreeLiveNeighboursDiesAsIfByOvercrowding() { var grid = new Grid(new Cell(0, 0), new Cell(1, 0), new Cell(2, 0), new Cell(0, 1), new Cell(1, 1)); grid = grid.CreateNextGeneration(); Assert.False(grid.IsAlive(new Cell(1, 1))); }
public void Update(GameTime gameTime) { updateTimer += gameTime.ElapsedGameTime; if (updateTimer.TotalMilliseconds > 1000f / Game1.UPS) { updateTimer = TimeSpan.Zero; _grid.CreateNextGeneration(); _grid.TileCell.CopyGrid(lastGeneration, _grid.Scales); //for (int i = 0; i < _grid.Scales.X; i++){ // for (int j = 0; j < _grid.Scales.Y; j++){ // lastGeneration[i, j] = _grid.TileCell[i, j]; // } //} } }