Пример #1
0
        public void Alter_CellStateUnchanged_CellStateNotAltered()
        {
            var gameOfLife = new GameOfLife(4, 2);

            gameOfLife.Board = BoardA;
            int x = 1, y = 1;
            var currentCellValue = gameOfLife.Board[x, y];
            var numberOfLiveNeighbours = gameOfLife.GetLivingNeighbourCellCount(x, y);

            gameOfLife.AlterCellStateAccordingToSimulationRules(x, y, currentCellValue, numberOfLiveNeighbours);
            Assert.AreEqual(1, BoardA[x, y]);
        }
Пример #2
0
        public void Alter_CellStateChangedToDead_AlterCellStateToDead()
        {
            var gameOfLife = new GameOfLife(4, 2);

            gameOfLife.Board = BoardB;
            int x = 2, y = 1;
            var currentCellValue = gameOfLife.Board[x, y];
            var numberOfLiveNeighbours = gameOfLife.GetLivingNeighbourCellCount(x, y);

            gameOfLife.AlterCellStateAccordingToSimulationRules(x, y, currentCellValue, numberOfLiveNeighbours);
            Assert.AreEqual(0, BoardB[x, y]);
        }