예제 #1
0
        public void CellsWithTwoOrThreeliveNeighbors()
        {
            // Any live cell with two or three live neighbours lives
            StateOfCell CurrentCellState   = StateOfCell.Alive;
            int         NumOfLiveNeighbors = 3;

            StateOfCell output = Conway.GetNewCellState(CurrentCellState, NumOfLiveNeighbors);

            Assert.AreEqual(StateOfCell.Alive, output);
        }
예제 #2
0
        public void CellsWithMoreThanThreeLiveNeighbors()
        {
            // Any live cell with more than three live neighbours dies
            StateOfCell CurrentCellState   = StateOfCell.Alive;
            int         NumOfLiveNeighbors = 4;

            StateOfCell output = Conway.GetNewCellState(CurrentCellState, NumOfLiveNeighbors);

            Assert.AreEqual(StateOfCell.Dead, output);
        }
예제 #3
0
        public void CellsWithLessThanTwoLiveNeighb()
        {
            // Any live cell with fewer than two live neighbours dies
            StateOfCell CurrentCellState   = StateOfCell.Alive;
            int         NumOfLiveNeighbors = 1;

            StateOfCell output = Conway.GetNewCellState(CurrentCellState, NumOfLiveNeighbors);

            Assert.AreEqual(StateOfCell.Dead, output);
        }
예제 #4
0
        public void DeadCellsWithExaltyThreeLiveNeighbors()
        {
            // Any dead cell with exactly three live neighbours becomes a live cell

            StateOfCell CurrentCellState   = StateOfCell.Dead;
            int         NumOfLiveNeighbors = 3;

            StateOfCell output = Conway.GetNewCellState(CurrentCellState, NumOfLiveNeighbors);

            Assert.AreEqual(StateOfCell.Alive, output);
        }