public void ClearingGridShouldDecimateAllCells() { _grid = new Grid(new [,] { { true, false, true, false, true }, { false, true, false, true, false } }); _grid.Clear(); for(var x = 0; x < _grid.Cells.GetLength(0); x++) for (var y = 0; y < _grid.Cells.GetLength(1); y++) Assert.That(_grid.Cells[x,y], Is.False); }
public void CellsWithThreeNeighborsStayAliveIfAliveOrComeAliveIfDead() { var testGrid = new Grid(new[,] { {true, false, false}, {false, true, false}, {false, true, true } }); _expected = new Grid(new[,] { {false, false, false}, {true, true, true}, {false, true, true} }); Assert.AreEqual(_expected.Cells, _game.Play(testGrid).Cells); }
public void CellsWithFourOrMoreNeighborsDie() { var testGrid = new Grid(new[,] { {false, false, false}, {true, true, true}, {false, true, true} }); _expected = new Grid(new[,] { {false, true, false}, {true, false, true}, {true, false, true} }); Assert.AreEqual(_expected.Cells, _game.Play(testGrid).Cells); }
public void CellsWithFewerThanTwoNeighboursAreDecimated() { var testGrid = new Grid(new [,] { {false, false, false}, {false, true, false}, {false, false, true } }); _expected = new Grid(new [,] { {false, false, false}, {false, false, false}, {false, false, false} }); Assert.AreEqual(_expected.Cells, _game.Play(testGrid).Cells); }
public void TwoByTwoGridShouldInitializeToTwoByTwo() { var grid = new Grid(new bool[2, 2]); Assert.That(grid.Cells.GetLength(0), Is.EqualTo(2)); Assert.That(grid.Cells.GetLength(1), Is.EqualTo(2)); }
public void SetUp() { _grid = new Grid(new bool[100,100]); }
public void CellsWithTwoNeighboursThatAreAliveStayAlive() { var testGrid = new Grid(new[,] { {true, false, false}, {false, true, false}, {false, false, true } }); _expected = new Grid(new[,] { {false, false, false}, {false, true, false}, {false, false, false} }); Assert.AreEqual(_expected.Cells, _game.Play(testGrid).Cells); }