Exemple #1
0
 private StandardRuleKeeper(
     StandardRuleKeeper existing, IReadOnlyBoxPuzzle puzzle, PossibleValues possibleValues)
 {
     _puzzle            = puzzle;
     _possibleValues    = possibleValues;
     _unsetRowValues    = existing._unsetRowValues.AsSpan().ToArray();
     _unsetColumnValues = existing._unsetColumnValues.AsSpan().ToArray();
     _unsetBoxValues    = existing._unsetBoxValues.AsSpan().ToArray();
 }
 private StandardRuleKeeper(
     StandardRuleKeeper existing, IReadOnlyPuzzleWithMutablePossibleValues?puzzle) : this()
 {
     _boxSize           = existing._boxSize;
     _unsetRowValues    = existing._unsetRowValues?.AsSpan().ToArray();
     _unsetColumnValues = existing._unsetColumnValues?.AsSpan().ToArray();
     _unsetBoxValues    = existing._unsetBoxValues?.AsSpan().ToArray();
     _puzzle            = puzzle;
 }
        /// <summary>Creates an efficient solver for solving standard Sudoku puzzles.</summary>
        public static PuzzleSolver <PuzzleWithPossibleValues> CreateSolver()
        {
            var ruleKeeper = new StandardRuleKeeper();

            return(new PuzzleSolver <PuzzleWithPossibleValues>(
                       ruleKeeper,
                       new StandardHeuristic(
                           ruleKeeper,
                           ruleKeeper,
                           ruleKeeper)));
        }