pub fn new(side_length: usize, filled_values: impl IntoIterator<Item = Possibility>) -> Self {
        let filled_values: Vec<_> = filled_values.into_iter().collect();

        let satisfied: HashSet<_> = filled_values
            .iter()
            .copied()
            .flat_map(|poss| poss.satisfied_constraints(side_length))
            .collect();

        let filled_coordinates: HashSet<_> = filled_values
            .iter()
            .map(|poss| (poss.row, poss.column))
            .collect();

        let possibilities: Vec<_> = Possibility::all(side_length)
            .filter(|poss| !filled_coordinates.contains(&(poss.row, poss.column)))
            .collect();

        let constraints = Constraint::all(side_length)
            .filter(|cons| !satisfied.contains(cons))
            .collect();

        Self {
            possibilities,
            constraints,
            side_length,
        }
    }
/// Create a new instance of the `n` queens problem with the given filled
/// values and side length.
Create a new instance of the `n` queens problem with the given filled
values and side length.
Create a new instance of the ` n ` queens problem with the given filled values and side length .
pub fn new(side_length: usize, filled_values: impl IntoIterator<Item = Possibility>) -> Self {
        let filled_values: Vec<_> = filled_values.into_iter().collect();
        let satisfied: HashSet<_> = filled_values
            .iter()
            .copied()
            .flat_map(|poss| poss.satisfied_constraints(side_length))
            .collect();
        let filled_coordinates: HashSet<_> = filled_values
            .iter()
            .map(|poss| (poss.row, poss.column))
            .collect();
        let possibilities: Vec<_> = Possibility::all(side_length)
            .filter(|poss| !filled_coordinates.contains(&(poss.row, poss.column)))
            .collect();
        let constraints = Constraint::all(side_length)
            .filter(|cons| !satisfied.contains(cons))
            .collect();
        Self {
            possibilities,
            constraints,
            side_length,
        }
    }
pub fn new ( side_length : usize , filled_values : impl IntoIterator < Item = Possibility > ) -> Self { let filled_values : Vec < _ > = filled_values . into_iter ( ) . collect ( ) ; let satisfied : HashSet < _ > = filled_values . iter ( ) . copied ( ) . flat_map ( | poss | poss . satisfied_constraints ( side_length ) ) . collect ( ) ; let filled_coordinates : HashSet < _ > = filled_values . iter ( ) . map ( | poss | ( poss . row , poss . column ) ) . collect ( ) ; let possibilities : Vec < _ > = Possibility :: all ( side_length ) . filter ( | poss | ! filled_coordinates . contains ( & ( poss . row , poss . column ) ) ) . collect ( ) ; let constraints = Constraint :: all ( side_length ) . filter ( | cons | ! satisfied . contains ( cons ) ) . collect ( ) ; Self { possibilities , constraints , side_length , } }
Create a new instance of the `n` queens problem with the given filled
values and side length.
Create a new instance of the ` n ` queens problem with the given filled values and side length .
side_length
usize
filled_values
impl IntoIterator<Item = Possibility>
side_length
usize
filled_values
impl IntoIterator<Item = Possibility>