sudokul/board/mod.rs
1//! `board` contains data structures which store the state of a sudoku board.
2//!
3//! Multiple different data structures are available, depending on your application's needs and
4//! performance characteristics. All of these structures implement the `board::Board` interface.
5//!
6//! Generally, to start, it doesn't matter which one you pick, so going with OmniBoard is fine.
7//!
8//! ```
9//! use sudokul::board::Board;
10//! use sudokul::board::OmniBoard;
11//!
12//! fn main() {
13//! let mut board = OmniBoard::new();
14//!
15//! // use `set_entry` to set individual entries on the board, by (row, column).
16//! board.set_entry(0, 0, 1);
17//! board.set_entry(0, 1, 3);
18//! board.set_entry(0, 2, 5);
19//!
20//! // use `entry` to retrieve individual entries on the board, by (row, column).
21//! let entry01 = board.entry(0, 1);
22//! assert_eq!(entry01, 3);
23//!
24//! // use `row`/`column`/`square` to retrieve views of the board
25//! let row0 = board.row(0);
26//! let col0 = board.column(0);
27//! let sq0 = board.square(0);
28//! assert_eq!(row0[0], 1);
29//! assert_eq!(row0[1], 3);
30//! assert_eq!(row0[2], 5);
31//! assert_eq!(col0[0], 1);
32//! assert_eq!(col0[1], 0);
33//! assert_eq!(sq0[1], 3);
34//! }
35//! ```
36
37mod board;
38mod linear_u8_board;
39mod nano_board;
40mod omni_board;
41
42pub use board::Board;
43pub use linear_u8_board::LinearU8Board;
44pub use nano_board::NanoBoard;
45pub use omni_board::OmniBoard;