NAME

Games::Sudoku::PatternSolver::Patterns - for internal use in Games::Sudoku::PatternSolver only

DESCRIPTION

This sub module encompasses procedures that require a certain knowledge of the specific grid size and layout (currently only the standard 9x9).

The solve method does not know of the grid. For its backtracking algorithm it doesn't apply constraint rules to any individual field, but only uses bit vectors of length 81 and tries to combine them in order to arrive at a solution.

This sub module Games::Sudoku::PatternSolver::Patterns

* reads the 46656 different patterns from a binary file, converts them into Bit::Vector objects, which it returns in 2 different data structures: As an array, as well as a hash which holds them ordered in sets by a common field they share. (If the binary file is missing, it will offer to create it from scratch; this lasts around 1 minute.)

* provides an array with 81 hashes representing the fields, initialized with some properties that help to maintain status (value, candidate lists, area covered, ...)

* provides the field indices in sets of groups (rows, columns and boxes). These are needed by the cheat mode, essentially in methods hidden_singles() and naked_singles(), which have to know which fields they must apply the rules to.

AUTHOR

Steffen Heinrich, Jan. 2023

COPYRIGHT

The following copyright notice applies to all the files provided in this distribution, including binary files, unless explicitly noted otherwise.

Copyright 2023 Steffen Heinrich

SEE ALSO

https://www.sudokuwiki.org/Pattern_Overlay, https://sites.math.washington.edu/~morrow/mcm/team2280.pdf

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.