public void GetMultipleDeadCellsThatShouldBecomeAliveWhenTheyHaveThreeLiveNeighbours() { var rules = new LiveEvolutionRules(); var grid = new Grid(5, 5); grid.AddCell(new Cell(1, 1)); grid.AddCell(new Cell(1, 2)); grid.AddCell(new Cell(2, 1)); grid.AddCell(new Cell(2, 0)); var neighboursOfAliveCell = new List <IEnumerable <Cell> > { grid.GetDeadNeighboursOfLivingCell(new Cell(1, 1)), grid.GetDeadNeighboursOfLivingCell(new Cell(1, 2)), grid.GetDeadNeighboursOfLivingCell(new Cell(2, 0)), grid.GetDeadNeighboursOfLivingCell(new Cell(2, 1)) }; var expectedLiveCells = new List <Cell> { new Cell(1, 0), new Cell(2, 2) }; var cellsThatShouldLive = rules.GetDeadCellsThatShouldLive(neighboursOfAliveCell); expectedLiveCells.Should().BeEquivalentTo(cellsThatShouldLive); Assert.Equal(2, cellsThatShouldLive.Count); }
public EvolutionRulesTests() { _liveEvolutionRules = new LiveEvolutionRules(); }
public GameOfLife() { _deadEvolutionRules = new DeadEvolutionRules(); _liveEvolutionRules = new LiveEvolutionRules(); }