public bool SudokuSpiceConstraints(PuzzleSampleCollection sampleCollection)
        {
            var solver = ConstraintBased.StandardPuzzles.CreateSolver();
            var puzzle = Puzzle.CopyFrom(sampleCollection.Random().NullableJaggedMatrix);

            return(solver.TrySolve(puzzle));
        }
        public bool SudokuSpice(PuzzleSampleCollection sampleCollection)
        {
            var puzzle = PuzzleWithPossibleValues.CopyFrom(sampleCollection.Random().NullableJaggedMatrix);
            var solver = RuleBased.StandardPuzzles.CreateSolver();

            return(solver.TrySolve(puzzle));
        }
Exemple #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);
        }
Exemple #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);
        }
        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);
        }
 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());