示例#1
0
        public void ManualInitializeCells()
        {
            _cells          = new CellOfLife[_size, _size];
            _nextGeneration = new bool[_size, _size];

            for (int row = 0; row < _size; row++)
            {
                for (int column = 0; column < _size; column++)
                {
                    _cells[row, column] = new CellOfLife();
                }
            }
        }
示例#2
0
        public void AutoInitializeCells()
        {
            _cells          = new CellOfLife[_size, _size];
            _nextGeneration = new bool[_size, _size];
            Random rn = new Random();

            for (int row = 0; row < _size; row++)
            {
                for (int column = 0; column < _size; column++)
                {
                    _cells[row, column] = new CellOfLife();
                    if (rn.NextDouble() <= 0.3)
                    {
                        _cells[row, column].IsAlive = true;
                    }
                }
            }
        }