Struct sudoku_variants::solver::strategy::impls::TupleStrategy[][src]

pub struct TupleStrategy<F: Fn(usize) -> usize> { /* fields omitted */ }

A Strategy which searches groups for tuples, that is, 2 or more cells that in total have as many options as there are cells in the tuple. It then excludes all of these options from all cells in the group which are not a part of the tuple.

As an example, consider the following configuration (with standard Sudoku rules):

╔═══╤═══╤═══╦═══╤═══╤═══╦═══╤═══╤═══╗
║ A │ A │ A ║ 4 │ 5 │ 6 ║ 7 │ 8 │ 9 ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ B │ B │ B ║ 1 │ 2 │ 3 ║ 4 │ 5 │ 6 ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │ X ║   │   │   ║   │   │   ║
╠═══╪═══╪═══╬═══╪═══╪═══╬═══╪═══╪═══╣
║   │   │ 4 ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │ 5 ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╠═══╪═══╪═══╬═══╪═══╪═══╬═══╪═══╪═══╣
║   │   │   ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╚═══╧═══╧═══╩═══╧═══╧═══╩═══╧═══╧═══╝

Because the first row already contains the digits 4-9, the cells marked with A must contain the digits 1-3, meaning they are a triple (3-tuple). Similarly, the cells marked with B must contain the digits 7-9. This excludes the options 1-3 and 7-9 from the cell marked with X. The 4 and 5 in the third column then fix it to 6.

When creating a tuple strategy using TupleStrategy::new, the maximum size of tuples that are considered can be defined.

Implementations

impl<F: Fn(usize) -> usize> TupleStrategy<F>[src]

pub fn new(max_size_computer: F) -> TupleStrategy<F>[src]

Creates a new tuple strategy that considers tuples up to the size defined by max_size_computer. This closure receives the size of the grid and outputs the maximum size of tuples that this strategy shall consider.

Trait Implementations

impl<F: Clone + Fn(usize) -> usize> Clone for TupleStrategy<F>[src]

impl<F: Fn(usize) -> usize> Strategy for TupleStrategy<F>[src]

Auto Trait Implementations

impl<F> RefUnwindSafe for TupleStrategy<F> where
    F: RefUnwindSafe

impl<F> Send for TupleStrategy<F> where
    F: Send

impl<F> Sync for TupleStrategy<F> where
    F: Sync

impl<F> Unpin for TupleStrategy<F> where
    F: Unpin

impl<F> UnwindSafe for TupleStrategy<F> where
    F: UnwindSafe

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,