Struct sudoku_variants::generator::Reducer [−][src]
A reducer can be applied to the output of a Generator to remove numbers from the grid as long as it is still uniquely solveable using the provided Solver. This may be intentionally suboptimal to control the difficulty. A random number generator decides which digits are removed.
Reducer::new_default will yield a reducer with the highest difficulty (a perfect backtracking solver) and a ThreadRng.
Implementations
impl Reducer<BacktrackingSolver, ThreadRng>
[src]
pub fn new_default() -> Reducer<BacktrackingSolver, ThreadRng>
[src]
Generates a new reducer with a BacktrackingSolver to check unique solveability and a ThreadRng to decide which digits are removed.
impl<S: Solver, R: Rng> Reducer<S, R>
[src]
pub fn new(solver: S, rng: R) -> Reducer<S, R>
[src]
Creates a new reducer with the given solver and random number gnerator.
Arguments
solver
: A Solver to be used to check whether a reduced Sudoku is still uniquely solveable. This controls the difficulty by specifying a strategy that must be able to solve the Sudoku.rng
: A random number generator that decides which digits are removed.
pub fn reduce<C: Constraint + Clone>(&mut self, sudoku: &mut Sudoku<C>)
[src]
Reduces the given Sudoku as much as possible. That is, removes random digits until all remaining ones are necessary for the solver used by this reducer to still be able to solve the Sudoku. All changes are done to the given mutable Sudoku.
Auto Trait Implementations
impl<S, R> RefUnwindSafe for Reducer<S, R> where
R: RefUnwindSafe,
S: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, R> Send for Reducer<S, R> where
R: Send,
S: Send,
R: Send,
S: Send,
impl<S, R> Sync for Reducer<S, R> where
R: Sync,
S: Sync,
R: Sync,
S: Sync,
impl<S, R> Unpin for Reducer<S, R> where
R: Unpin,
S: Unpin,
R: Unpin,
S: Unpin,
impl<S, R> UnwindSafe for Reducer<S, R> where
R: UnwindSafe,
S: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
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,
pub 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, 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.
pub 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,