[][src]Trait sudokul::board::Board

pub trait Board {
    fn column(&self, col: usize) -> [u8; 9];
fn entry(&self, row: usize, col: usize) -> u8;
fn row(&self, row: usize) -> [u8; 9];
fn set_entry(&mut self, row: usize, col: usize, value: u8);
fn square(&self, sq: usize) -> [u8; 9]; }

Board is a trait which contains the active state of a sudoku board. Entries in the board can be listed by column, row, or square, and can also be obtained by specifying a row/column point. All of these indexes should be 0-indexed, meaning that the lowest row/ column/square is 0 (zero) and the highest is 8 (eight).

Entries may be inserted individually via the set_entry method, or in bulk by row, column, or square via the appropriate methods.

The performance of each operation on the board depends on the implementation. Some implementations may prioritize low memory usage at the expense of faster insertions or retrievals, while others may do the opposite of that. Refer to each individual implementation for more information on the trade-offs and benchmarks.

Required methods

fn column(&self, col: usize) -> [u8; 9]

column returns the 0-indexed column specified by argument. This reads top-down; the 0th item in the returned array is the 0th row, to the 8th item in the returned array being the 8th row.

fn entry(&self, row: usize, col: usize) -> u8

entry returns the requested item in the puzzle by coordinates, or row+column. As always, these rows and columns are zero-indexed.

fn row(&self, row: usize) -> [u8; 9]

row returns the 0-indexed row specified by argument. This reads left-right; the 0th item in the returned array is the 0th column, to the 8th item in the returned array being the 8th column.

fn set_entry(&mut self, row: usize, col: usize, value: u8)

set_entry inserts a single entry into the board, by row+column.

fn square(&self, sq: usize) -> [u8; 9]

Loading content...

Implementors

impl Board for LinearU8Board[src]

impl Board for NanoBoard[src]

impl Board for OmniBoard[src]

Loading content...