Exemplo n.º 1
0
        public static void SearchColumnForSingleCandidates(this Grid grid)
        {
            for (int col = 0; col < grid.GridSize; col++)
            {
                for (int value = 1; value <= grid.GridSize; value++)
                {
                    // that value already exists in the col
                    if (Array.Exists(grid.GetColumn(col), element => element == value))
                    {
                        continue;
                    }

                    int result = grid.CheckColForValueInOptions(col, value);
                    if (result != -1)
                    {
                        grid.SolveCell(result, col, value);
                        grid.UpdateNeighbours(result, col);
                    }
                }
            }
        }