Struct sudoku::Sudoku
[−]
[src]
pub struct Sudoku { pub order: u8, pub elements: Vec<Option<Element>>, }
A (partial) grid of elements.
Fields
order: u8
The order of this sudoku.
elements: Vec<Option<Element>>
The elements composing this sudoku.
Methods
impl Sudoku
[src]
pub fn new(order: u8) -> Self
[src]
Constructs a new sudoku of the specified order.
This method reserves space in memory for the puzzle's elements.
Notes
This method does not generate a valid, uniquely solvable sudoku.
If you wish to generate such a sudoku (which you likely do), use
Sudoku::generate
.
pub fn is_complete(&self) -> bool
[src]
Returns whether the puzzle is completely full of values.
pub fn groups(&self, pos: Point) -> [Group; 3]
[src]
Returns the relevant groups for checking a given element in the grid.
The number of groups is always equal to the number of dimensions plus one.
pub fn substitute(&self, index: Point, value: Option<Element>) -> Self
[src]
Places the specified value (or lack thereof) at the specified index, returning an owned copy.
Trait Implementations
impl Generate for Sudoku
[src]
fn generate(order: u8, difficulty: Difficulty) -> Self
[src]
Generates a puzzle of the desired order and difficulty.
impl Clone for Sudoku
[src]
fn clone(&self) -> Sudoku
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Sudoku
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl PartialEq for Sudoku
[src]
fn eq(&self, __arg_0: &Sudoku) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Sudoku) -> bool
[src]
This method tests for !=
.
impl Grid for Sudoku
[src]
impl Index<Point> for Sudoku
[src]
type Output = Option<Element>
The returned type after indexing.
fn index(&self, index: Point) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl Puzzle for Sudoku
[src]
impl Solve for Sudoku
[src]
fn solution(&self) -> Result<Self, SolveError>
[src]
Returns the puzzle's unique solution if it exists.
fn is_uniquely_solvable(&self) -> bool
[src]
Whether the puzzle has a unique solution.
impl Score for Sudoku
[src]
fn score(&self) -> Option<usize>
[src]
The raw difficulty score of this puzzle.
fn difficulty(&self) -> Option<Difficulty>
[src]
The graded difficulty score of this puzzle.
impl Display for Sudoku
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more