class Sudoku::Board
- Sudoku::Board
- Reference
- Object
Defined in:
sudoku-solver/board.crConstant Summary
-
EMPTY_FIELD =
0
-
Empty field value.
-
SIZE =
9
-
Default number of rows and columns.
Constructors
-
.new(board : Array(Array(Int32)))
Creates a new sudoku board
-
.new
Creates a new sudoku board where all fields are set to 0.
Instance Method Summary
-
#[](index : Int)
Returns the element at the given index.
-
#empty?
Returns
true
ifself
if empty,false
otherwise. -
#get_column(index : Int) : Array(Int32)
Returns the column at the given index.
-
#get_region(coords : Tuple(Int32, Int32)) : Array(Int32)
Returns the 3x3 region that contains the given coords.
-
#to_a : Array(Array(Int32))
Returns an
Array
with all the rows in the sudoku board.
Constructor Detail
Instance Method Detail
def get_region(coords : Tuple(Int32, Int32)) : Array(Int32)
#
Returns the 3x3 region that contains the given coords.