public IGridInfo CreateFromGrid(IGrid grid)
        {
            GridInfo gridInfo = new GridInfo();

            gridInfo.Size = grid.Size;
            GridSquareInfo[][] squareInfos = new GridSquareInfo[gridInfo.Size][];
            for (int i = 0; i < gridInfo.Size; i++)
            {
                squareInfos[i] = new GridSquareInfo[gridInfo.Size];
                for (int j = 0; j < gridInfo.Size; j++)
                {
                    squareInfos[i][j] = new GridSquareInfo(grid.Squares[i, j]);
                }
            }
            gridInfo.Squares = squareInfos;
            return(gridInfo);
        }
Пример #2
0
        public IGridInfo CreateFromGrid(IGrid grid)
        {
            GridSquareInfo[][] squareInfos2D = new GridSquareInfo[grid.Size][];

            for (int i = 0; i < grid.Size; i++)
            {
                GridSquareInfo[] squareInfos = new GridSquareInfo[grid.Size];
                for (int j = 0; j < grid.Size; j++)
                {
                    squareInfos[j] = new GridSquareInfo(grid.Squares[i, j]);
                }
                squareInfos2D[i] = squareInfos;
            }

            return(new GridInfo
            {
                Size = grid.Size,
                Squares = squareInfos2D
            });
        }