[][src]Struct icub3d_sudoku_solver::Board

pub struct Board { /* fields omitted */ }

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.