Created
May 30, 2018 05:12
-
-
Save Manishearth/59f6eaac595d9e49f5621201cd434b6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/sudoku.rs b/src/sudoku.rs | |
index d3be5ff..e39c035 100644 | |
--- a/src/sudoku.rs | |
+++ b/src/sudoku.rs | |
@@ -222,7 +222,7 @@ impl Sudoku { | |
// until we can't solve any more values with this method | |
let mut found = None; | |
- for (row_i, row) in self.tiles.iter_mut().enumerate() { | |
+ 'inner: for (row_i, row) in self.tiles.iter_mut().enumerate() { | |
for (col_i, tile) in row.iter_mut().enumerate() { | |
// Skip if this is not an empty tile or a tile with only a single possible value | |
// remaining | |
@@ -234,6 +234,7 @@ impl Sudoku { | |
for (value, possible) in tile.possible_values.iter().enumerate() { | |
if *possible { | |
found = Some((row_i, col_i, (value + 1) as u8)); | |
+ break 'inner; | |
} | |
} | |
tile.possible_count = tile.possible_values.len(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment