コード例 #1
0
ファイル: Program.cs プロジェクト: feedfood/GameOfLife
        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
ファイル: Program.cs プロジェクト: feedfood/GameOfLife
        public World(Dimension dimension)
        {
            if (dimension == null)
            {
                this._dimension = new Dimension(0, 0);
            }
            else
            {
                this._dimension = dimension;
            }

            LifeMap = new LifeMap(_dimension);
        }