Esempio n. 1
0
        private int CheckNeighbors(int i, int j)
        {
            int lengthLowerBound = i > 0 ? i - 1 : 0;
            int lengthUpperBound = i < (board.getBoardLength() - 1) ? i + 1 : i;
            int heightLowerBound = j > 0 ? j - 1 : 0;
            int heightUpperBound = j < (board.getBoardHeight() - 1) ? j + 1 : j;

            int liveNeighborCount = GetNeighborCount(lengthLowerBound, lengthUpperBound, heightLowerBound, heightUpperBound);

            liveNeighborCount -= board.getCellValue(i, j);

            return(DetermineStatus(i, j, liveNeighborCount));
        }