This software defines the Sudoku board.
Several methods are provided for accessing rows, columns, and groups of the board. The get_rows/get_row functions return an array of all rows or a specific row, respectively. Similarly, the get_cols/get_col functions return an array of all columns or a specific column, based on the valid range of 1 to 9. The get_grps/get_grp functions retrieve either all groups or a specific group, specified by one of the numbered group squares printed in the ASCII diagram of the game board.
Other utility functions provided by the module include get_values, which returns a list of all squares with set values; get_element_membership, which identifies the row, column, and group of which a specified square is a member; and show_board and show_board_detail, which display the current state of the game board with varying levels of detail.
A key feature of the module is the run_board method, which solves the Sudoku puzzle by applying the two-pass algorithm of pass_one and pass_two. Pass_one reduces the range of valid numbers for each unsolved square, while pass_two identifies squares with unique valid numbers and accordingly assigns the appropriate value. For example, if square 1 can only be 1, 2 or 3, while squares 2 and 3 both include 2 and 3 in their valid number lists, then square 1 must be assigned the value of 1.
Overall, Games::YASudoku::Board is a versatile and useful tool for playing Sudoku, offering various methods and functions for accessing and manipulating game board elements, as well as efficient algorithms for solving the puzzle.
Version 0.01: N/A