Skip to content

A Sudoku solver that models a Sudoku board as a constraint program and then solves it using Choco Solver.

License

Notifications You must be signed in to change notification settings

sraaphorst/sudoku-cp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (https://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: The generic implementation of an arbitrary Sudoku board.

  • GenSudokuCP: 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: 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: 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: Tests for SudokuBoard, which provide examples as to how to use the functionality of SudokuBoard.

  • TestSudokuCP: Tests for SudokuCP, which show how to invoke the constraint programming solving algorithm on a board.

About

A Sudoku solver that models a Sudoku board as a constraint program and then solves it using Choco Solver.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages