public void World_no_neighbor_around_1x1_then_dead() { World world = new World(new Dimension(3, 3)); LiveCell[] cells = new LiveCell[1] { new LiveCell(1, 1) }; world.SetLiveCells(cells); world.Advance(); cells = world.GetLiveCells(); Assert.AreEqual(0,cells.Length); }
public void World_put1x2_no_advance_return1x2() { World world = new World(new Dimension(3,3)); LiveCell[] cells = new LiveCell[1] { new LiveCell(1, 2) }; world.SetLiveCells(cells); cells = world.GetLiveCells(); Assert.AreEqual(1, cells.Length); Assert.AreEqual(cells[0].X, 1); Assert.AreEqual(cells[0].Y, 2); }
private bool HasCell(World world, int x, int y) { int count = (from cell in world.GetLiveCells() where cell.X == x && cell.Y == y select cell).Count(); return count >= 1 ; }