I love performance
This commit is contained in:
parent
9367dc0caf
commit
338888133c
2 changed files with 8 additions and 9 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -34,7 +34,9 @@ impl Adjacencies {
|
||||||
|
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.amap.iter_mut().for_each(|bitvec| {
|
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 {
|
Adjacencies {
|
||||||
amap: self
|
amap: self
|
||||||
.amap
|
.amap
|
||||||
|
|
@ -154,10 +156,6 @@ impl Seating {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_clone(&self) -> Self {
|
|
||||||
self.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn empty_table_coords(&self) -> Vec<(usize, Side)> {
|
fn empty_table_coords(&self) -> Vec<(usize, Side)> {
|
||||||
self.people_top
|
self.people_top
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ use std::{
|
||||||
use shuffles::*;
|
use shuffles::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for size in 0..17 {
|
for size in 0..18 {
|
||||||
let table = Seating::make_seating(size);
|
let table = Seating::make_seating(size);
|
||||||
println!("We have a table\n{table}");
|
println!("We have a table\n{table}");
|
||||||
let mut corot = table.calc_alternatives(size);
|
let mut corot = table.calc_alternatives(size);
|
||||||
println!("searching size {size}");
|
println!("searching size {size}");
|
||||||
|
let mut total = 0;
|
||||||
loop {
|
loop {
|
||||||
match Pin::new(&mut corot).resume(()) {
|
match Pin::new(&mut corot).resume(()) {
|
||||||
CoroutineState::Yielded(val) => println!("found setting\n{val}"),
|
CoroutineState::Yielded(_val) => total += 1,
|
||||||
CoroutineState::Complete(total_checked) => {
|
CoroutineState::Complete(total_checked) => {
|
||||||
println!("checked {total_checked} in total");
|
println!("checked {total_checked} in total to find {total} valid alternatives");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue