|
@@ -627,18 +627,6 @@ impl Sudoku {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if pair_removed {
|
|
|
- println!(
|
|
|
- "Pair found! {} {}: {} {:?} and {} {:?} !",
|
|
|
- gidx,
|
|
|
- fidx,
|
|
|
- gpos,
|
|
|
- xy(gpos),
|
|
|
- fpos,
|
|
|
- xy(fpos)
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
// Check the x's and y's to see if we can also process a row/column too.
|
|
|
if xy(gpos).0 == xy(fpos).0 {
|
|
|
// Matching X - process column
|
|
@@ -660,28 +648,20 @@ impl Sudoku {
|
|
|
self.possible[pos(column, remove) as usize]
|
|
|
.set(values[0], false);
|
|
|
found_something = true;
|
|
|
+ pair_removed = true;
|
|
|
}
|
|
|
- /* v
|
|
|
- .is_some()
|
|
|
- {
|
|
|
- found_something = true;
|
|
|
- };
|
|
|
- */
|
|
|
+
|
|
|
if self.possible[pos(column, remove) as usize]
|
|
|
.get(values[1])
|
|
|
{
|
|
|
self.possible[pos(column, remove) as usize]
|
|
|
.set(values[1], false);
|
|
|
found_something = true;
|
|
|
+ pair_removed = true;
|
|
|
}
|
|
|
- /*
|
|
|
- .is_some()
|
|
|
- {
|
|
|
- found_something = true;
|
|
|
- };
|
|
|
- */
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if xy(gpos).1 == xy(fpos).1 {
|
|
|
// Matching Y - process row
|
|
|
let row = xy(gpos).1;
|
|
@@ -695,24 +675,33 @@ impl Sudoku {
|
|
|
if (remove == xy(gpos).0) || (remove == xy(fpos).0) {
|
|
|
continue;
|
|
|
}
|
|
|
- self.possible[pos(remove, row) as usize]
|
|
|
- .set(values[0], false);
|
|
|
- /*
|
|
|
- .is_some()
|
|
|
- {
|
|
|
+ if self.possible[pos(remove, row) as usize].get(values[0]) {
|
|
|
+ self.possible[pos(remove, row) as usize]
|
|
|
+ .set(values[0], false);
|
|
|
found_something = true;
|
|
|
- };
|
|
|
- */
|
|
|
- self.possible[pos(remove, row) as usize]
|
|
|
- .set(values[1], false);
|
|
|
- /*
|
|
|
- .is_some()
|
|
|
- {
|
|
|
+ pair_removed = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if self.possible[pos(remove, row) as usize].get(values[1]) {
|
|
|
+ self.possible[pos(remove, row) as usize]
|
|
|
+ .set(values[1], false);
|
|
|
found_something = true;
|
|
|
- };
|
|
|
- */
|
|
|
+ pair_removed = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if pair_removed {
|
|
|
+ println!(
|
|
|
+ "Pair found! {} {}: {} {:?} and {} {:?} !",
|
|
|
+ gidx,
|
|
|
+ fidx,
|
|
|
+ gpos,
|
|
|
+ xy(gpos),
|
|
|
+ fpos,
|
|
|
+ xy(fpos)
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|