Exemplo n.º 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();
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        /// <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)));
        }