public GameOfLife() { IEnumerable <Cell> pattern = new RlePattern(Patterns.AlternateWichStrecher1); pattern = PatternUtils.OriginToCenter(pattern); _field = new HashSet <Cell>(pattern); _runner = new LifeRunner(_field); }
public void TooLittleOrTooManyNeighbours_ShouldNotReproduce( Cell cell, IEnumerable <Cell> neighbours) { var cells = new HashSet <Cell>(neighbours); var runner = new LifeRunner(cells); runner.RunCycle(); Assert.DoesNotContain(cell, cells); }
public void EnoughNeighbours_ShouldReproduce( Cell cell, IEnumerable <Cell> neighbours) { var cells = new HashSet <Cell>(neighbours); var runner = new LifeRunner(cells); runner.RunCycle(); Assert.Contains(cell, cells); }
public void SingleCell_ShouldNotSurvive() { var cell = new Cell(); var cells = new HashSet <Cell> { cell }; var runner = new LifeRunner(cells); runner.RunCycle(); Assert.DoesNotContain(cell, cells); }