Trait quickbacktrack::Puzzle [] [src]

pub trait Puzzle: Clone {
    type Pos: Copy + Debug;
    type Val: Copy + Debug + PartialEq;
    fn solve_simple(&mut self);
    fn set(&mut self, pos: Self::Pos, val: Self::Val);
    fn print(&self);
    fn possible(&self, pos: Self::Pos) -> Vec<Self::Val>;
    fn is_solved(&self) -> bool;
    fn remove(&mut self, other: &Self);
}

Implemented by puzzles.

A puzzle stores the state of the problem, and can be modified by inserting a value at a position within the puzzle. The solver does not understand the internal structure of the puzzle, but is still able to find a solution (if any exists).

The initial state does not have to empty, and you can get the difference at the end by setting SolveSettings::difference(true).

Associated Types

The type of position.

The type of values stored in the puzzle.

Required Methods

Solve simple stuff faster. This will reduce the number of steps in solution. If you do not know how to solve this, leave it empty.

Sets a value at position.

Print puzzle out to standard output.

Returns possible values at a given position. The last move in the list has highest priority, because the solver pops the values in turn.

Whether puzzle is solved.

Removes values from other puzzle to show changes.

Implementors