public void get_neighbours_for_cell_with_one_neighbour_returns_1() { var world = new World(); world.AddLiveCell(new Position(0, 0)); world.AddLiveCell(new Position(1, 1)); Assert.Equal(1, world.GetLiveNeighbours(new Position(0, 0))); }
public void tick_world_returns_new_world_with_cells_after_applying_rules() { var world = new World(); world.AddLiveCell(new Position(0, 0)); World worldAftertick = world.Tick(); Assert.True(worldAftertick.IsCellDead(new Position(0, 0))); }
public World Tick() { var newWorld = new World(); foreach (Cell cell in GetRemainingLiveCellsAfterTick().Concat(GetNewLiveCellsAfterTick())) { newWorld.AddLiveCell(cell.Position); } return newWorld; }