The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Games::Sudoku::CPSearch - A fast technique to solve Sudoku problems.

VERSION

Version 0.03

SYNOPSIS

    use Games::Sudoku::CPSearch;

    my $foo = Games::Sudoku::CPSearch->new($puzzle);
                $foo->solve();
                my $solution = $foo->solution();
    ...

DESCRIPTION

This module solves a Sudoku puzzle using the same constraint propagation technique/algorithm explained on Peter Norvig's website (http://norvig.com/sudoku.html), and implemented there in Python.

fullgrid Returns a hash with squares as keys and "123456789" as each value.
puzzle Returns the puzzle as an 81 character string.
set_puzzle Sets the puzzle to be solved
unitlist Returns an list of sudoku "units": rows, columns, boxes
propagate Perform the constraint propagation on the Sudoku grid.
eliminate Eliminate digit from cell
assign Assign digit to cell
new Initialize Sudoku object: the only parameter is the 81 character string representing the puzzle. The only characters allowed are [0-9\.-]
rows Return row values: A-I
cols Return column values: 1-9
squares Return list of all the squares in a Sudoku grid.
units Return list of all the units for a given square.
peers Return list of all the peers for a given square.
search Perform search for a given grid.
solve Solve the puzzle.
cross Return "cross product".
solution Return solution string.

AUTHOR

Martin-Louis Bright, <mlbright at gmail.com>

BUGS

Please report any bugs or feature requests to bug-games-sudoku-cpsearch at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Sudoku-CPSearch. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Games::Sudoku::CPSearch

You can also look for information at:

ACKNOWLEDGEMENTS

Peter Norvig, for the explanation and python code at http://www.norvig.com/sudoku.html

COPYRIGHT & LICENSE

Copyright 2008 Martin-Louis Bright, all rights reserved.

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