Games-Sudoku-PatternSolver
view release on metacpan or search on metacpan
lib/Games/Sudoku/PatternSolver.pod view on Meta::CPAN
=encoding UTF-8
=head1 NAME
Games::Sudoku::PatternSolver - Solve and generate Sudoku 9x9 puzzles.
=head1 DESCRIPTION
A Sudoku solver and generator. It works by application of the pattern overlay method (POM) in a backtracking process.
B<Note:> I<For this module the term 'pattern' refers to a 9x9 matrix, holding the final 9 positions of any single symbol.>
=head1 SYNOPSIS
use Games::Sudoku::PatternSolver qw( solve );
$result = solve( '.2.4.6.8....2......9......1..4......51.....9.....4.5.335..6....9...823.5..1.....8' );
print_grid( $result->{solutions}[0] );
lib/Games/Sudoku/PatternSolver/Generator.pm view on Meta::CPAN
... inspect and either reject or do something with $puzzle
print $puzzle->{strPuzzle};
}
=head2 get_grid_builder()
$grid_builder = get_grid_builder();
$solution_string = &$grid_builder( <shuffle_symbols> );
The iterator returned from get_grid_builder() can produce fully filled sudoku grids at a fairly high rate.
Like the solver, it also uses plain overlay of random patterns (POM) and no biased methods. (As the Latin Squares would.)
The grids are spread absolutely randomly across the Sudoku space.
=head1 EXPORTS
The module optionally exports get_sudoku_builder(), get_grid_builder() and provides the import tag ':all'.
=head1 SCRIPTS
=head2 sudogen
( run in 1.314 second using v1.01-cache-2.11-cpan-49f99fa48dc )