This module defines the Sudoku board.
initialize a new board The game board is 9 rows by 9 columns, but we will store the board in a one dimensional array - For example, element 9 will map to row 2, column 1 (keep in mind that the first element of the array is 0).
Get rows will return a ref to an array of all the rows. get_row will just return one row - valid row numbers are 1 - 9.
Get cols will return a ref to an array of all the cols. get_col will just return one row - valid col numbers are 1 - 9.
Groups are defined as a set of nine boxes group in squares, there are three rows of groups and three groups in each row. They are numbered as follows.
1 | 2 | 3 ---|---|--- 4 | 5 | 6 ---|---|--- 7 | 8 | 9
get_grps will return a ref to an array of all the groups. get_grp will just return one group which can be specified by one of the numbers above.
return a list of all the squares with values set
This method will return the three groups that the element is a member of. One row, one column and one group.
This method displays the current state of the board
This method displays the current state of the board including the possible values for each unsolved square.
this method solve the board
the first pass looks for values and reduces valid_num arrays
this pass looks for valid_num arrays which have a unique value and therefore need to have that value assigned to them
Example: Square 1 can be (1,2,3) Square 2 can be (2,3,4,6) Square 3 can be (2,3,4,5) Square 4 can be (5,6) Since square 1 is the only one with a '1', it needs to be 1
Andrew Wyllie <firstname.lastname@example.org>
Please send any bugs to the author
The Games::YASudoku moudule is free software and can be redistributed and/or modified under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 434:
You forgot a '=back' before '=head1'