コード例 #1
0
ファイル: CsvBenchmarker.cs プロジェクト: MorganR/SudokuSpice
        public bool SudokuSpiceConstraints(PuzzleSampleCollection sampleCollection)
        {
            var solver = ConstraintBased.StandardPuzzles.CreateSolver();
            var puzzle = Puzzle.CopyFrom(sampleCollection.Random().NullableJaggedMatrix);

            return(solver.TrySolve(puzzle));
        }
コード例 #2
0
ファイル: CsvBenchmarker.cs プロジェクト: MorganR/SudokuSpice
        public bool SudokuSpice(PuzzleSampleCollection sampleCollection)
        {
            var puzzle = PuzzleWithPossibleValues.CopyFrom(sampleCollection.Random().NullableJaggedMatrix);
            var solver = RuleBased.StandardPuzzles.CreateSolver();

            return(solver.TrySolve(puzzle));
        }
コード例 #3
0
        public bool SudokuSpice(PuzzleSampleCollection sampleCollection)
        {
            var puzzle = new Puzzle(sampleCollection.Random().NullableMatrix);
            var solver = new PuzzleSolver(puzzle);

            solver.Solve();
            return(puzzle.NumEmptySquares == 0);
        }
コード例 #4
0
        public bool SudokuSpiceConstraints(PuzzleSampleCollection sampleCollection)
        {
            var solver = new PuzzleSolver <Puzzle>(
                new List <IConstraint> {
                new RowUniquenessConstraint(),
                new ColumnUniquenessConstraint(),
                new BoxUniquenessConstraint()
            });
            var puzzle = new Puzzle(sampleCollection.Random().NullableMatrix);

            solver.Solve(puzzle);
            return(puzzle.NumEmptySquares == 0);
        }
コード例 #5
0
ファイル: CsvBenchmarker.cs プロジェクト: MorganR/SudokuSpice
        public bool SudokuSharp(PuzzleSampleCollection sampleCollection)
        {
            PuzzleSample sample = sampleCollection.Random();
            var          board  = new SudokuSharp.Board();

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 9; col++)
                {
                    if (sample.NullableMatrix[row, col].HasValue)
                    {
                        board.PutCell(new SudokuSharp.Location(col, row), sample.NullableMatrix[row, col].Value);
                    }
                }
            }

            board = board.Fill.Sequential();

            return(board.IsSolved);
        }
コード例 #6
0
ファイル: CsvBenchmarker.cs プロジェクト: MorganR/SudokuSpice
 public bool SudokuSolverLite(PuzzleSampleCollection sampleCollection) =>
 // Must clone the input, since this method solves the puzzle in-place.
 SudokuSolver.SudokuSolver.Solve((int[, ])sampleCollection.Random().Matrix.Clone());