pub struct NQueens {
pub possibilities: Vec<Possibility>,
pub constraints: Vec<Constraint>,
pub side_length: usize,
}Expand description
An instance of the n queens problem.
Fields§
§possibilities: Vec<Possibility>The list of possible positions that could solve the n queens puzzle.
constraints: Vec<Constraint>The list of constraints that must be satisfied for this n queens
puzzle.
side_length: usizeThe length of the chess board side, equal to n.
Implementations§
Source§impl NQueens
impl NQueens
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 instance of the n queens problem with the given filled
values and side length.
Trait Implementations§
Source§impl ExactCover for NQueens
impl ExactCover for NQueens
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 NQueens
impl RefUnwindSafe for NQueens
impl Send for NQueens
impl Sync for NQueens
impl Unpin for NQueens
impl UnwindSafe for NQueens
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