sudoku_solver_generator 1.0.0+1 sudoku_solver_generator: ^1.0.0+1 copied to clipboard
A library to generate and/or solve Sudoku puzzles.
Dart-sudoku_solver_generator #
A Dart library to generate and/or solve Sudoku puzzles.
Changelog #
Usage #
dependencies:
sudoku_solver_generator: ^1.0.0
A Sudoku Solver usage example:
import 'package:sudoku_solver_generator/sudoku_solver_generator.dart';
main() {
var sudoku = <List<int?>>[
[2, 1, 7, 4, 3, 5, 9, null, 8],
[5, 8, 9, 0, 6, 2, 4, 3, null],
[3, 4, 6, 0, 7, 9, 2, 5, 1],
[1, 6, 2, 3, 0, 0, 5, 4, 0],
[9, 0, 5, 2, 0, 4, 7, 8, 6],
[4, 7, 8, 5, 9, 6, 1, 0, 0],
[8, 0, 3, 0, 4, 1, 6, 7, 2],
[0, 9, 4, 7, 2, 3, 8, 1, 5],
[7, 2, 1, 0, 5, 0, 0, 0, 4],
];
var sudokuSolved = SudokuSolver.solve(sudoku);
SudokuUtilities.printSudoku(sudokuSolved);
}
A Sudoku Generator usage example:
import 'package:sudoku_solver_generator/sudoku_solver_generator.dart';
main() {
var sudokuGenerator = SudokuGenerator(54);
SudokuUtilities.printSudoku(sudokuGenerator.newSudoku);
print('');
SudokuUtilities.printSudoku(sudokuGenerator.newSudokuSolved);
}
Sudoku game based on this package: Flutter-Sudoku #
Features #
-
Generate Sudoku puzzles with your specified number of empty squares or clues.
-
Solve Sudoku puzzles of any difficulty instantly.
-
Check if the Sudoku puzzle (unsolved or solved) is valid in terms of game rules.
-
Check if the Sudoku puzzle has been solved properly.
-
Convert the Data Structure of the Sudoku puzzle from 2D List to 1D List and vice-versa.
-
Print Sudoku puzzles to the console in an easy-to-read manner.
-
Well documented client code.
Note #
-
Known Issue: Sudoku Generator may generate puzzles with more than 1 solution. More likely when there are more empty squares.
-
Referred Algorithms:
-
Sudoku Generation Algorithm in Java
-
Sudoku Generation and Solving Algorithm in Python
-
Sudoku Validation in Python
-
-
If you face any issue or have suggestions then feel free to open an issue on GitHub.