Struct sudoku_variants::solver::strategy::impls::TupleStrategy [−][src]
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]
fn clone(&self) -> TupleStrategy<F>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Fn(usize) -> usize> Strategy for TupleStrategy<F>
[src]
fn apply(&self, sudoku_info: &mut SudokuInfo<impl Constraint + Clone>) -> bool
[src]
Auto Trait Implementations
impl<F> RefUnwindSafe for TupleStrategy<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for TupleStrategy<F> where
F: Send,
F: Send,
impl<F> Sync for TupleStrategy<F> where
F: Sync,
F: Sync,
impl<F> Unpin for TupleStrategy<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for TupleStrategy<F> where
F: UnwindSafe,
F: 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,