Esempio n. 1
0
        /// <summary>Initializes all row regions.</summary>
        private void InitializeRowRegions(int size2)
        {
            for (int row = 0; row < size2; row++)
            {
                var region = new SudokuRegion(SudokuRegionType.Row);
                Regions.Add(region);

                for (int width = 0; width < size2; width++)
                {
                    region.Add(Grid[row, width]);
                }
            }
        }
Esempio n. 2
0
        /// <summary>Initializes all column regions.</summary>
        private void InitializeColumnRegions(int size2)
        {
            for (var column = 0; column < size2; column++)
            {
                var region = new SudokuRegion(SudokuRegionType.Column);
                Regions.Add(region);

                for (var height = 0; height < size2; height++)
                {
                    region.Add(Grid[height, column]);
                }
            }
        }
Esempio n. 3
0
        /// <summary>Initializes all sub square regions.</summary>
        private void InitializeSubSquareRegions(int size)
        {
            for (var xSub = 0; xSub < size; xSub++)
            {
                for (var ySub = 0; ySub < size; ySub++)
                {
                    var region = new SudokuRegion(SudokuRegionType.Block);
                    Regions.Add(region);

                    for (var x = 0; x < size; x++)
                    {
                        for (var y = 0; y < size; y++)
                        {
                            region.Add(Grid[xSub * size + x, ySub * size + y]);
                        }
                    }
                }
            }
        }