Games::YASudoku::Board

Defines the Sudoku board
Download

Games::YASudoku::Board Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Andrew Wyllie
  • Publisher web site:
  • http://search.cpan.org/~wyllie/

Games::YASudoku::Board Tags


Games::YASudoku::Board Description

Defines the Sudoku board Games::YASudoku::Board is a Perl module that defines the Sudoku board.METHODS_init 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/get_row 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/get_col 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.get_grps/get_grp 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.get_values return a list of all the squares with values setget_element_membership This method will return the three groups that the element is a member of. One row, one column and one group.show_board This method displays the current state of the boardshow_board_detail This method displays the current state of the board including the possible values for each unsolved square.run_board this method solve the boardpass_one the first pass looks for values and reduces valid_num arrayspass_two 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 Requirements: · Perl


Games::YASudoku::Board Related Software