Added:
Sudoku::canonicalized
. Maps all sudokus of an equivalence class to the same sudoku and counts automorphisms. Limited to uniquely solvable sudokus.Sudoku::shuffled
: Perform random symmetry transformations to get a different but equivalent sudoku.- Generation of symmetrical sudokus. The desired symmetry can be chosen via the
Symmetry
enum.Sudoku::generate_with_symmetry
Sudoku::generate_with_symmetry_from
- Generate sudokus with a user-chosen RNG:
generate_solved_with_rng
generate_with_symmetry_and_rng_from
- New strategies:
- XyWing
- XyzWing
- Mutant Swordfish
- Mutant Jellyfish
Changed:
- Raise minimum supported Rust version to 1.56
- Rename many of
Sudoku
's methodssolve_unique
->solution
solve_one
->some_solution
count_at_most
->solutions_count_up_to
solve_at_most
->solutions_up_to
solve_at_most_buffer
->solutions_up_to_buffer
generate_filled
->generate_solved
generate_unique
->generate
generate_unique_from
->generate_from
- Improved errors for
Sudoku
methods. Errors now implementstd::error::Error
and none of them returnResult<T, ()>
anymore. Movedparse_errors
module toerrors
.
- Raise minimum Rust version to 1.28
- Add
StrategySolver
for solving sudokus using human strategies as well as various helper types, including a set of position types. For a start, 6 kinds of strategies are available which separate into a total of 12 strategies. - Switch default sudoku print format to the line format
- Add
SudokuBlock
wrapper to print a grid representation created bydisplay_block()
onSudoku
- Remove
Sudoku::solve
. Usesolve_one
,solve_unique
orsolve_at_most
. - Rename
(Pub)Entry
->InvalidEntry
LineFormatParseError
->LineParseError
BlockFormatParseError
->BlockParseError
- Add
solve_at_most_buffer
, primarily for C FFI
- Improve upon jczsolve and raise performance by ~15-20%
- Allow semicolons and commas (';', ',') as comment delimiters in line sudokus
- Raise minimum Rust version to 1.26
- Add
generate_unique_from(sudoku)
- Add
shuffle()
which transforms a sudoku into a random equivalent sudoku. - Add
n_clues()
for the number of filled cells
- Optional
serde
support - Implemented the JCZsolve algorithm which is to date and to the best knowledge of the author the fastest sudoku solver in existence.
- Added
unchecked_indexing
feature While testing hasn't shown any incorrect indexing, bounds checks are activated by default to guarantee memory safety in case of a bug. This lowers the speed by 2-12% and can be deactivated by the aforementioned feature - Added two new functions
count_at_most(limit)
andis_uniquely_solvable()
which run slightly faster than their equivalents that return the solved grid.
- Add functions for generation of random sudokus:
generate_filled()
andgenerate_unique()
for random solved and unsolved but uniquely solvable sudokus respectively. - Implement
Hash
,PartialOrd
,Ord
forSudoku
andSudokuLine
.
- Changed parser functions for
Sudoku
- Added
from_str_line()
for parsing sudokus in line format. Also addedto_str_line()
for a printable representation of the same. - Split
from_str()
intofrom_str_block()
andfrom_str_block_permissive()
. As the names suggest, the latter is much more forgiving than the former but will also fail in strange ways on malformed data.
- Added
- Added
from_bytes()
,from_bytes_slice()
,into_bytes()
toSudoku
for construction and deconstruction for byte arrays and slices. Errors will be revisited. - Added new module
parser_errors
- Bugfix:
sudoku.is_solved()
incorrectly returned true whensudoku
was not solved, but solvable through naked single tactics alone
- Build on stable rust again
- Switch algorithm to that of the Jsolve sudoku solver (with some minor changes), increasing speed more than 10x.
- Fixed a logic bug that led to returning multiple invalid solutions for some sudokus.
- Implemented new and faster solver based on exact cover matrix capable of solving sudokus of all difficulties quickly (on the order of milliseconds or less on a modern desktop)