|
@@ -1016,7 +1016,7 @@ impl AnySolver {
|
|
|
board: initial_board.clone(),
|
|
|
possible: AnyPossible::new(initial_board.size),
|
|
|
group: AnyGroup::new(initial_board.size),
|
|
|
- /*
|
|
|
+ /*
|
|
|
cell_poss: vec![
|
|
|
default_poss;
|
|
|
initial_board.width as usize * initial_board.width as usize
|
|
@@ -1114,7 +1114,9 @@ impl AnySolver {
|
|
|
}
|
|
|
|
|
|
if updated_here {
|
|
|
- println!("find_pairs (update)");
|
|
|
+ if OUTPUT {
|
|
|
+ println!("find_pairs (update)");
|
|
|
+ }
|
|
|
}
|
|
|
updated_here = false;
|
|
|
|
|
@@ -1504,9 +1506,10 @@ impl AnySolver {
|
|
|
|
|
|
|
|
|
*/
|
|
|
-
|
|
|
+ /*
|
|
|
println!("finalize_possible ends...");
|
|
|
updated
|
|
|
+ */
|
|
|
}
|
|
|
|
|
|
// I'm saving finalize_cell, just because it's working,
|
|
@@ -1897,7 +1900,7 @@ impl AnySolver {
|
|
|
let mut default_poss = Flags::new(self.board.width as usize);
|
|
|
default_poss.set_range(0..self.board.width as usize);
|
|
|
|
|
|
- /*
|
|
|
+ /*
|
|
|
for x in 0..self.board.width {
|
|
|
self.cell_poss[x as usize] = default_poss.clone();
|
|
|
}
|
|
@@ -1961,7 +1964,7 @@ impl AnySolver {
|
|
|
let mut default_poss = Flags::new(self.board.width as usize);
|
|
|
default_poss.set_range(0..self.board.width as usize);
|
|
|
|
|
|
- /*
|
|
|
+ /*
|
|
|
for x in 0..self.board.width {
|
|
|
self.cell_poss[x as usize] = default_poss.clone();
|
|
|
}
|
|
@@ -2066,7 +2069,7 @@ impl AnySolver {
|
|
|
self.board.copy(&backup.board);
|
|
|
self.possible.copy(&backup.possible);
|
|
|
|
|
|
- /*
|
|
|
+ /*
|
|
|
for i in 0..backup.cell_poss.len() {
|
|
|
self.cell_poss[i] = backup.cell_poss[i].clone();
|
|
|
}
|
|
@@ -2084,14 +2087,26 @@ impl AnySolver {
|
|
|
|
|
|
/// Make a puzzle by removing items
|
|
|
/// - Verify it still has a single solution.
|
|
|
- pub fn make_puzzle(&mut self) {
|
|
|
+ pub fn make_puzzle(&mut self) -> i32 {
|
|
|
let mut rng = ChaCha20Rng::from_entropy();
|
|
|
|
|
|
+ /*
|
|
|
+ // This doesn't seem like this is correct here.
|
|
|
+ // This fills the board in, and I'm removing parts below...
|
|
|
if !self.board.complete() {
|
|
|
self.fill_board(&mut rng);
|
|
|
}
|
|
|
+ */
|
|
|
+
|
|
|
self.reset_possible();
|
|
|
- while self.remove(&mut rng) {}
|
|
|
+ let mut count = 0;
|
|
|
+ println!("Remove {count} .. begin:");
|
|
|
+ while self.remove(&mut rng) {
|
|
|
+ count += 1;
|
|
|
+ println!("Removed {count}");
|
|
|
+ }
|
|
|
+
|
|
|
+ count
|
|
|
}
|
|
|
|
|
|
/// Remove an item
|