Beispiel #1
0
 public void GetGridWithDiagonalNeighbourAliveofMiddleCellDead()
 {
     grid = GridHelper.GetGridWithDiagonalNeighbourAliveofMiddleCellDead();
     INeighbourRuleFactory neighbourRuleFactory = new NeighbourRuleFactory();
     IRuleFactory ruleFactory = new RuleFactory();
     GameOfLife Gol = new GameOfLife(grid, ruleFactory, neighbourRuleFactory);
     Gol.Evolve();
     Assert.AreEqual(false, grid[0, 0].IsAlive);
     Gol.Evolve();
     Assert.AreEqual(false, grid[0, 2].IsAlive);
     Gol.Evolve();
     Assert.AreEqual(Gol.GenerationNumber, 4);
 }
Beispiel #2
0
 public void CheckEvoluation()
 {
     INeighbourRuleFactory neighbourRuleFactory = new NeighbourRuleFactory();
        IRuleFactory ruleFactory = new RuleFactory();
        GameOfLife Gol = new GameOfLife(grid, ruleFactory, neighbourRuleFactory);
        Gol.Evolve();
        Assert.AreEqual(2, Gol.GenerationNumber);
 }
Beispiel #3
0
 public void GetGridWithNeighbourAliveOfMiddelCell()
 {
     grid = GridHelper.GetGridWithDiagonalNeighbourAliveofMiddleCellDead();
     INeighbourRuleFactory neighbourRuleFactory = new NeighbourRuleFactory();
     IRuleFactory ruleFactory = new RuleFactory();
     GameOfLife Gol = new GameOfLife(grid, ruleFactory, neighbourRuleFactory);
     Gol.Evolve();
     Cell cell = grid[0, 2];
     Assert.AreEqual(false, cell.IsAlive);
 }
Beispiel #4
0
 public void GridWithTopLeftAlive()
 {
     grid = GridHelper.GetGridWithTopLeftAlive();
     INeighbourRuleFactory neighbourRuleFactory = new NeighbourRuleFactory();
     IRuleFactory ruleFactory = new RuleFactory();
     GameOfLife Gol = new GameOfLife(grid, ruleFactory, neighbourRuleFactory);
     Gol.Evolve();
     Assert.AreEqual(false, grid[0, 0].IsAlive);
 }