diff --git a/src/lib.rs b/src/lib.rs index fd73ed3..ca91a67 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,9 @@ impl Adjacencies { pub fn reset(&mut self) { self.amap.iter_mut().for_each(|bitvec| { - bitvec.clear(); + if bitvec.any() { + bitvec.clear(); + } }) } @@ -45,7 +47,7 @@ impl Adjacencies { }) } - fn intersect(&self, other: &Adjacencies) -> Adjacencies { + pub fn intersect(&self, other: &Adjacencies) -> Adjacencies { Adjacencies { amap: self .amap @@ -154,10 +156,6 @@ impl Seating { } } - fn make_clone(&self) -> Self { - self.clone() - } - fn empty_table_coords(&self) -> Vec<(usize, Side)> { self.people_top .iter() diff --git a/src/main.rs b/src/main.rs index 04d8514..8137114 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,16 +7,17 @@ use std::{ use shuffles::*; fn main() { - for size in 0..17 { + for size in 0..18 { let table = Seating::make_seating(size); println!("We have a table\n{table}"); let mut corot = table.calc_alternatives(size); println!("searching size {size}"); + let mut total = 0; loop { match Pin::new(&mut corot).resume(()) { - CoroutineState::Yielded(val) => println!("found setting\n{val}"), + CoroutineState::Yielded(_val) => total += 1, CoroutineState::Complete(total_checked) => { - println!("checked {total_checked} in total"); + println!("checked {total_checked} in total to find {total} valid alternatives"); break; } }