pub struct LatinSquare {
pub possibilities: Vec<Possibility>,
pub constraints: Vec<Constraint>,
}Expand description
Instance of a Latin square puzzle.
Fields§
§possibilities: Vec<Possibility>The list of possible positions + values that could solve the Latin square puzzle.
constraints: Vec<Constraint>The list of constraints that must be satisfied for this Latin square puzzle.
Implementations§
Source§impl LatinSquare
impl LatinSquare
Sourcepub fn new(
side_length: usize,
filled_values: impl IntoIterator<Item = Possibility>,
) -> Self
pub fn new( side_length: usize, filled_values: impl IntoIterator<Item = Possibility>, ) -> Self
Create a new Latin square puzzle.
The puzzle has dimensions side_length × side_length and the given
list of filled values.
Trait Implementations§
Source§impl Debug for LatinSquare
impl Debug for LatinSquare
Source§impl ExactCover for LatinSquare
impl ExactCover for LatinSquare
Source§type Constraint = Constraint
type Constraint = Constraint
The type of value that are constraints on a given instance of an exact
cover problem.
Source§type Possibility = Possibility
type Possibility = Possibility
The type of values that are elements of a solution to the exact cover
problem.
Source§fn satisfies(&self, poss: &Self::Possibility, cons: &Self::Constraint) -> bool
fn satisfies(&self, poss: &Self::Possibility, cons: &Self::Constraint) -> bool
Return true if the given
Possibility will satisfy the given
Constraint.Source§fn is_optional(&self, _cons: &Self::Constraint) -> bool
fn is_optional(&self, _cons: &Self::Constraint) -> bool
Return true if the given
Constraint is optional.Source§fn possibilities(&self) -> &[Self::Possibility]
fn possibilities(&self) -> &[Self::Possibility]
Return a list of possibilities for this instance of the problem.
Source§fn constraints(&self) -> &[Self::Constraint]
fn constraints(&self) -> &[Self::Constraint]
Return a list of constraints that must be satisfied for this instance of
the problem.
Auto Trait Implementations§
impl Freeze for LatinSquare
impl RefUnwindSafe for LatinSquare
impl Send for LatinSquare
impl Sync for LatinSquare
impl Unpin for LatinSquare
impl UnwindSafe for LatinSquare
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