示例#1
0
        private bool ApplyRule(int x, int y)
        {
            var isAlive         = _board.IsAlive(x, y);
            var neighboursCount = _board.CountNeighbours(x, y);

            return(isAlive ? neighboursCount > 1 && neighboursCount < 4 : neighboursCount == 3);
        }
示例#2
0
        public void CountCellNeighbours()
        {
            Board b = new Board();

            b.AddCell(2, 2);
            b.AddCell(3, 2);

            Assert.AreEqual(2, b.CountNeighbours(3, 3));
        }