public void KillACellOverpop()
        {
            SetUp();
            test.IsAlive();
            gameMaster.AddCells(test);

            //x > 3 alive neigbors kill a cell
            GameCell alive = new GameCell(0, 0);

            alive.IsAlive();
            neighbors.Add(alive);
            alive = new GameCell(0, 0);
            alive.IsAlive();
            neighbors.Add(alive);
            alive = new GameCell(0, 0);
            alive.IsAlive();
            neighbors.Add(alive);
            alive = new GameCell(0, 0);
            alive.IsAlive();
            neighbors.Add(alive);

            test.Neighbors = neighbors;
            gameMaster.AddCells(test);

            gameMaster.GameOfLife();

            Assert.AreEqual(false, test.Alive);
        }
        public void KillACellUnderPop()
        {
            SetUp();
            test.IsAlive();
            gameMaster.AddCells(test);

            //x < 2 alive neigbors kill a cell
            neighbors.Add(new GameCell(0, 0));
            neighbors.Add(new GameCell(0, 0));
            neighbors.Add(new GameCell(0, 0));
            neighbors.Add(new GameCell(0, 0));

            test.Neighbors = neighbors;
            gameMaster.AddCells(test);

            gameMaster.GameOfLife();

            Assert.AreEqual(false, test.Alive);
        }
Exemplo n.º 3
0
 private void SpawnSelected(SpawnTemplate spawn)
 {
     if (spawn != null)
     {
         foreach (GameCell spawnCell in spawn.LivingCells)
         {
             GameCell found = GameMaster.FindByRowAndCol(spawnCell.Row, spawnCell.Col);
             found.IsAlive();
         }
     }
 }
        public void KeepAlive()
        {
            SetUp();
            test.IsAlive();
            gameMaster.AddCells(test);

            // 2 - 3 alive neigbors keep cell alive
            GameCell alive = new GameCell(0, 0);

            alive.IsAlive();
            neighbors.Add(alive);
            alive = new GameCell(0, 0);
            alive.IsAlive();
            neighbors.Add(alive);

            test.Neighbors = neighbors;

            gameMaster.GameOfLife();
            Assert.AreEqual(true, test.Alive);
        }
        public void ReviveACell()
        {
            SetUp();
            test.IsDead();
            gameMaster.AddCells(test);

            //3 alive neighbors bring a dead cell to live
            GameCell alive = new GameCell(0, 0);

            alive.IsAlive();
            neighbors.Add(alive);
            alive = new GameCell(0, 0);
            alive.IsAlive();
            neighbors.Add(alive);
            alive = new GameCell(0, 0);
            alive.IsAlive();
            neighbors.Add(alive);

            test.Neighbors = neighbors;

            gameMaster.GameOfLife();

            Assert.AreEqual(true, test.Alive);
        }