You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Robin Thoni 2400112ca3 added DhNextCellChooser пре 7 година
.idea/.idea.uqac-ia-sudoku-csp added stats пре 7 година
sample added samples; added MRV strategy пре 7 година
uqac-ia-sudoku-csp added DhNextCellChooser пре 7 година
.gitignore init пре 7 година
AUTHORS README пре 7 година
README.md added DhNextCellChooser пре 7 година
uqac-ia-sudoku-csp.sln init пре 7 година

README.md

CSP Sudoku Solver

This is a sudoku solver using Constraint Satisfaction Problem pattern.

Build

  • Command line

    cd uqac-ia-aspirobot
    dotnet restore
    dotnet build
    dotnet run
    
  • Visual Studio
    Run VS, open solution, wait for package restore, click run (F5)

  • Rider
    Run Rider, open solution, wait for package restore, click run (Shift + F10)

Configuration

The program allows 4 optional arguments:

  • Generator type: The generator to use to create/load the sudoku. Possible values:
    • ’-’ (default): Read from std input
    • ‘0’: Empty sudoku
    • filename: load from the specified file
  • Next cell chooser: The way to select next cell to fill. Possible values:
    • ‘mrv-dh’: Use the Minimum remaining values strategy then Degree heuristic strategy if multiple cells match
    • ‘mrv’ (default): Use the Minimum remaining values strategy
    • ‘dh’: Use the Degree heuristic strategy
    • ‘basic’: Select the first blank value, from up to down and left to right
  • Next number chooser: The way to select next number to the next to test in the cell. Possible values:
    • ‘lcv’ (default): Use Least constraining value strategy
    • ‘basic’: Select numbers in ascending order
  • Empty characters: The characters that should be considered as empty cell. Default value: ‘0 .’

Code

This solver is coded in .NET Core (C#) using interfaces to abstract implementation.
Interfaces are in Interfaces/*.cs
Constraints are in Solver/Constraints/*.cs
Sudoku loaders/generators are in Solver/Generators/*.cs
Strategies for choosing next value are in Solver/NextValueChoosers/*.cs
Backtracking search algrithm is in Solver/BacktrackSearch.cs