示例#1
0
        public void Advance()
        {
            LifeMap nextGenLifeMap = new LifeMap(_dimension.X,_dimension.Y);

            for (int x = 0; x < _dimension.X; x++)
            {
                for (int y = 0; y < _dimension.Y; y++)
                {
                    Cell cell = Cell.CreateCell(LifeMap[x,y],x,y);
                    nextGenLifeMap[x, y] = cell.IsLive(GetNumberOfLiveNeighbors(cell));
                }
            }

            LifeMap = nextGenLifeMap;
        }
示例#2
0
        public World(Dimension dimension)
        {
            if (dimension == null)
            {
                this._dimension = new Dimension(0, 0);
            }
            else
            {
                this._dimension = dimension;
            }

            LifeMap = new LifeMap(_dimension);
        }