https://github.com/sraaphorst/sudoku-cp
A Sudoku solver that models a Sudoku board as a constraint program and then solves it using Choco Solver.
https://github.com/sraaphorst/sudoku-cp
choco-solver constraint-programming constraint-satisfaction-problem java java-10 sudoku sudoku-solver
Last synced: 8 months ago
JSON representation
A Sudoku solver that models a Sudoku board as a constraint program and then solves it using Choco Solver.
- Host: GitHub
- URL: https://github.com/sraaphorst/sudoku-cp
- Owner: sraaphorst
- License: other
- Created: 2018-11-01T16:58:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-30T13:27:04.000Z (over 6 years ago)
- Last Synced: 2025-02-23T21:44:47.238Z (about 1 year ago)
- Topics: choco-solver, constraint-programming, constraint-satisfaction-problem, java, java-10, sudoku, sudoku-solver
- Language: Java
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sudoku Constraint Programming with Choco-Solver
**Status:** Complete, verson 1.0.0.
This is an implementation, in Java 10, of a Sudoku solver using constraint programming.
The intention of this project was to play around with constraint programming using
Choco-Solver (http://www.choco-solver.org).
The program supports fully generic Sudoku boards (i.e. `n^2 x n^2` boards over `n^2`
arbitrary symbols), but has an easy-to-use implementation of the standard `9x9`
Sudoku board over the digits `1` through `9`.
The main classes as are follows:
* [`GenSudokuBoard`](src/main/java/com/vorpal/sudoku/GenSudokuBoard.java): The generic
implementation of an arbitrary Sudoku board.
* [`GenSudokuCP`](src/main/java/com/vorpal/sudoku/GenSudokuCP.java): The solver,
which takes a `GenSudokuBoard`, creates a constraint program from it, and then
determines if there is a unique solution and, if so, what that solution is.
* [`SudokuBoard`](src/main/java/com/vorpal/sudoku/SudokuBoard.java): Represents a
standard `9x9` Sudoku board: it is a subclass of `GenSudokuBoard` but handles most
of the details so that the interface is simple to use.
* [`SudokuCP`](src/main/java/com/vorpal/sudoku/SudokuCP.java): The solver for
`SudokuBoard`, and a subclass of `GenSudokuCP`.
Examples of how to use these classes can be found in the test cases, which are
designed specifically for `SudokuBoard` and `SudokuCP`:
* [`TestSudokuBoard`](src/test/java/com/vorpal/sudoku/TestSudokuBoard.java):
Tests for `SudokuBoard`, which provide examples as to how to use the functionality
of `SudokuBoard`.
* [`TestSudokuCP`](src/test/java/com/vorpal/sudoku/TestSudokuCP.java):
Tests for `SudokuCP`, which show how to invoke the constraint programming solving
algorithm on a board.