Example #1
0
        public void TwoOrThreeNeighboursAlive()
        {
            Library.Board board = new Library.Board();
            board.SetAlive(4, 4);
            board.SetAlive(4, 5);
            board.SetAlive(5, 4);

            board.NextState();

            Assert.AreEqual(true, board.IsAlive(4, 4));
            Assert.AreEqual(true, board.IsAlive(4, 5));
            Assert.AreEqual(true, board.IsAlive(5, 4));
        }
Example #2
0
        public void LessThanTwoNeighboursDie()
        {
            Library.Board board = new Library.Board();
            board.SetAlive(1, 0);
            board.SetAlive(1, 1);
            board.SetAlive(13, 13);

            board.NextState();

            Assert.AreEqual(false, board.IsAlive(1, 0));
            Assert.AreEqual(false, board.IsAlive(1, 1));
            Assert.AreEqual(false, board.IsAlive(13, 13));
        }
Example #3
0
        public void ExactlyThreeNeighboursDeadCell()
        {
            Library.Board board = new Library.Board();
            board.SetAlive(2, 3);
            board.SetAlive(2, 1);
            board.SetAlive(3, 2);
            board.SetAlive(1, 2);

            board.SetAlive(5, 6);
            board.SetAlive(5, 5);
            board.SetAlive(6, 5);

            board.NextState();

            Assert.AreEqual(false, board.IsAlive(2, 2));
            Assert.AreEqual(true, board.IsAlive(6, 6));
        }
Example #4
0
        public void MoreThanThreeNeighbours()
        {
            Library.Board board = new Library.Board();
            board.SetAlive(2, 2);
            board.SetAlive(2, 3);
            board.SetAlive(2, 1);
            board.SetAlive(3, 2);
            board.SetAlive(1, 2);
            board.NextState();

            Assert.AreEqual(false, board.IsAlive(2, 2));
        }