[−][src]Struct icub3d_sudoku_solver::Board
A representation of a sudoku board.
Example
use icub3d_sudoku_solver::Board;
let mut board = Board::new( "120400586060201403040096000090000014081000360430000070000720030608903040372008051" .to_string(), ) .unwrap();
assert_eq!(board.solve(), true); assert_eq!(board.to_string(), "1 2 9 | 4 3 7 | 5 8 6\n8 6 7 | 2 5 1 | 4 9 3\n5 4 3 | 8 9 6 | 1 2 7\n------+-------+------\n7 9 5 | 3 6 2 | 8 1 4\n2 8 1 | 5 7 4 | 3 6 9\n4 3 6 | 1 8 9 | 2 7 5\n------+-------+------\n9 1 4 | 7 2 5 | 6 3 8\n6 5 8 | 9 1 3 | 7 4 2\n3 7 2 | 6 4 8 | 9 5 1\n");
Methods
impl Board
[src]
pub fn new(s: String) -> Result<Board, Error>
[src]
Create a new board. Will fail if the string isn't exactly 81 characters long. '.', '_', ' ', and '0' can be used for empty spaces.
pub fn solve(&mut self) -> bool
[src]
Solve the board. Returns true on success and false if no solution was found.
Trait Implementations
impl Debug for Board
[src]
impl PartialEq<Board> for Board
[src]
impl StructuralPartialEq for Board
[src]
impl ToString for Board
[src]
Auto Trait Implementations
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnwindSafe for Board
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,