pub struct NakedSingleStrategy;
Expand description
A Strategy which detects naked singles, that is, cells which only have one possible value, and enters them into the Sudoku.
As a small example, take a look at the following grid:
╔═══╤═══╦═══╤═══╗
║ X │ ║ │ 2 ║
╟───┼───╫───┼───╢
║ │ 1 ║ │ ║
╠═══╪═══╬═══╪═══╣
║ │ ║ │ ║
╟───┼───╫───┼───╢
║ 3 │ ║ │ ║
╚═══╧═══╩═══╧═══╝
The cell marked with X cannot be a 1 because of the 1 in its block, nor a 2 because of the 2 in its row, and also cannot be a 3 because of the 3 in its column. Consequently, it can only be a 4. This would be detected by this strategy.
Trait Implementations§
Source§impl Clone for NakedSingleStrategy
impl Clone for NakedSingleStrategy
Source§fn clone(&self) -> NakedSingleStrategy
fn clone(&self) -> NakedSingleStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Strategy for NakedSingleStrategy
impl Strategy for NakedSingleStrategy
Source§fn apply(&self, sudoku_info: &mut SudokuInfo<impl Constraint + Clone>) -> bool
fn apply(&self, sudoku_info: &mut SudokuInfo<impl Constraint + Clone>) -> bool
Applies this strategy to the given Sudoku. The strategy may rely on and
modify the information in the given
sudoku_info
. This instance is
given to other strategies that participate in the solution and/or
future iterations of the same strategy. It can thus be used to
communicate insights. Read moreAuto Trait Implementations§
impl Freeze for NakedSingleStrategy
impl RefUnwindSafe for NakedSingleStrategy
impl Send for NakedSingleStrategy
impl Sync for NakedSingleStrategy
impl Unpin for NakedSingleStrategy
impl UnwindSafe for NakedSingleStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more