summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/solvers.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/solvers.rs b/src/solvers.rs
index a0845a1..e8cefb3 100644
--- a/src/solvers.rs
+++ b/src/solvers.rs
@@ -71,7 +71,7 @@ pub struct Solver<T: num::PrimInt> {
static mut COUNT: u32 = 0;
/// Save the current state for each row
-#[derive(Clone, Eq, Copy)]
+#[derive(Clone, Copy)]
pub struct SaveState<T: num::PrimInt> {
/// Mask of all currently used stones
pub bitmask: T,
@@ -81,22 +81,6 @@ pub struct SaveState<T: num::PrimInt> {
pub row: u32,
}
-impl<T: num::PrimInt> std::cmp::Ord for SaveState<T> {
- fn cmp(&self, other: &Self) -> std::cmp::Ordering {
- self.sum.cmp(&other.sum)
- }
-}
-impl<T: num::PrimInt> std::cmp::PartialOrd for SaveState<T> {
- fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
- Some(self.sum.cmp(&other.sum))
- }
-}
-impl<T: num::PrimInt> std::cmp::PartialEq for SaveState<T> {
- fn eq(&self, other: &Self) -> bool {
- self.sum.eq(&other.sum)
- }
-}
-
impl<T: num::PrimInt> SaveState<T> {
pub fn new() -> Self {
Self {
@@ -141,6 +125,7 @@ impl<T: num::PrimInt> Solver<T> {
let heap = permutohedron::Heap::new(&mut heap);
let n_f = permutohedron::factorial(n as usize);
let mut permutations = Vec::with_capacity(n_f);
+ println!("Generating permutations");
for data in heap {
permutations.push(data.clone());
}
@@ -157,7 +142,7 @@ impl<T: num::PrimInt> Solver<T> {
//for (n, i) in self.permutations.iter().enumerate() {
// println!("perm {}: {:?}", n, i);
//}
- self.check_perm(&[3, 16, 23]);
+ println!("calculate results");
self.permute(
permutohedron::factorial(self.n as usize),
0,