class Sudoku::Board

Defined in:

sudoku-solver/board.cr

Constant Summary

EMPTY_FIELD = 0

Empty field value.

SIZE = 9

Default number of rows and columns.

Constructors

Instance Method Summary

Constructor Detail

def self.new(board : Array(Array(Int32))) #

Creates a new sudoku board


[View source]
def self.new #

Creates a new sudoku board where all fields are set to 0.


[View source]

Instance Method Detail

def [](index : Int) #

Returns the element at the given index.


[View source]
def empty? #

Returns true if self if empty, false otherwise.


[View source]
def get_column(index : Int) : Array(Int32) #

Returns the column at the given index.


[View source]
def get_region(coords : Tuple(Int32, Int32)) : Array(Int32) #

Returns the 3x3 region that contains the given coords.


[View source]
def to_a : Array(Array(Int32)) #

Returns an Array with all the rows in the sudoku board.


[View source]