Exemplo n.º 1
0
        public bool SudokuSpiceDynamicSingle(PuzzleSample puzzle)
        {
            var p             = new PuzzleWithPossibleValues(puzzle.NullableJaggedMatrix);
            var standardRules = new StandardRules();
            var ruleKeeper    = new DynamicRuleKeeper(
                new IRule[] { standardRules });
            var heuristic = new StandardHeuristic(
                standardRules, standardRules, standardRules);
            var solver = new RuleBased.PuzzleSolver <PuzzleWithPossibleValues>(ruleKeeper, heuristic);
            var result = solver.Solve(p, randomizeGuesses: true);

            return(result.NumEmptySquares == 0);
        }
Exemplo n.º 2
0
        public bool SudokuSpiceDynamicMultiple(PuzzleSample puzzle)
        {
            var p          = new PuzzleWithPossibleValues(puzzle.NullableJaggedMatrix);
            var rowRule    = new RowUniquenessRule();
            var columnRule = new ColumnUniquenessRule();
            var boxRule    = new BoxUniquenessRule();
            var ruleKeeper = new DynamicRuleKeeper(
                new IRule[] { rowRule, columnRule, boxRule });
            var heuristic = new StandardHeuristic(
                rowRule, columnRule, boxRule);
            var solver = new RuleBased.PuzzleSolver <PuzzleWithPossibleValues>(ruleKeeper, heuristic);
            var result = solver.Solve(p, randomizeGuesses: true);

            return(result.NumEmptySquares == 0);
        }