Exemple #1
0
        public void TestIfDeadCellGoesAlive()
        {
            var gof = new GameOfLife(4, 4);

            gof.AddLivingCell(0, 0);
            gof.AddLivingCell(2, 0);
            gof.AddLivingCell(1, 1);
            gof.Evolve();

            bool is_alive = gof.IsCellAlive(1, 0);

            Assert.That(is_alive, Is.True);
        }
Exemple #2
0
        public void TestWithExactThreeNeighbours()
        {
            var gof = new GameOfLife(4, 4);

            gof.AddLivingCell(0, 0);
            gof.AddLivingCell(0, 1);
            gof.AddLivingCell(1, 1);
            gof.AddLivingCell(1, 0);

            int count = gof.GetLivingNeighboursCount(0, 0);

            Assert.That(count, Is.EqualTo(3));
        }
Exemple #3
0
        public void TestWithExactlyThree()
        {
            var gof = new GameOfLife(8, 4);

            gof.AddLivingCell(5, 1);
            gof.AddLivingCell(5, 2);
            gof.AddLivingCell(4, 2);
            gof.Evolve();
            bool is_alive = gof.IsCellAlive(4, 1);


            Assert.That(is_alive, Is.True);
        }
Exemple #4
0
        public void TestIfMoreThanThree()
        {
            var gof = new GameOfLife(8, 4);

            gof.AddLivingCell(5, 2);
            gof.AddLivingCell(5, 3);
            gof.AddLivingCell(4, 2);
            gof.AddLivingCell(5, 1);
            gof.AddLivingCell(6, 2);
            gof.Evolve();
            bool is_alive = gof.IsCellAlive(5, 2);


            Assert.That(is_alive, Is.False);
        }
Exemple #5
0
        public void TestIfLessThanTwo()
        {
            var gof = new GameOfLife(8, 4);

            gof.AddLivingCell(5, 2);
            gof.Evolve();
            Boolean is_alive = gof.IsCellAlive(5, 2);


            Assert.IsFalse(is_alive);
        }