Пример #1
0
 public void StepTest2()
 {
     bool[,] cells = {{false ,false ,false ,false ,false ,false ,false } ,
                      {false ,false ,false ,false ,false ,false ,false } ,
                      {false ,false ,false ,true ,true ,true ,false } ,
                      {false ,false ,true ,false ,false ,false ,true } ,
                      {false ,false ,true ,false ,false ,false ,true } ,
                      {false ,false ,true ,false ,false ,false ,true } ,
                      {false ,false ,false ,true ,true ,true ,false }
                     };
     Grid target = new Grid(cells);
     target.Step();
 }
Пример #2
0
        public void StepTest()
        {
            bool[,] cells = {{true, true, true, false, false, true},
                            {true, true, true, false, false, true},
                            {true, true, true, false, false, true}};

            Grid target = new Grid(cells);
            target.Step();

            //Top Row vals
            Assert.AreEqual(false, target.GetCell(0, 0));
            Assert.AreEqual(false, target.GetCell(1, 0));
            Assert.AreEqual(true, target.GetCell(2, 0));

            //Bottom Row vals
            Assert.AreEqual(false, target.GetCell(0, 4));
            Assert.AreEqual(false, target.GetCell(1, 4));
            Assert.AreEqual(true, target.GetCell(2, 4));

            //Left col
            Assert.AreEqual(false, target.GetCell(1, 0));
            Assert.AreEqual(true, target.GetCell(2, 0));
            Assert.AreEqual(false, target.GetCell(3, 0));
            Assert.AreEqual(false, target.GetCell(4, 0));

            //Right col
            Assert.AreEqual(false, target.GetCell(7, 0));
            Assert.AreEqual(false, target.GetCell(7, 1));
            Assert.AreEqual(true, target.GetCell(7, 2));

            Assert.AreEqual(true, target.GetCell(4, 2), "Reproduction failed");
            Assert.AreEqual(false, target.GetCell(6, 1), "Death by undercrowding failed");
            Assert.AreEqual(false, target.GetCell(5, 1), "Stay dead failed");
            Assert.AreEqual(true, target.GetCell(5, 2), "Reproduction failed");
            Assert.AreEqual(true, target.GetCell(6, 2), "Keep alive failed");
        }