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); }
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); }
private static IGameOfLife GetGameOfLifeController(Game grid) { // Create the neighbourhood rule INeighbourRuleFactory neighbourRuleFactory = new NeighbourRuleFactory(); // Create the rule IRuleFactory ruleFactory = new RuleFactory(); IGameOfLife gameofLifeobject = new GameOfLife(grid, ruleFactory, neighbourRuleFactory); return gameofLifeobject; }
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); }
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); }