diff options
-rw-r--r-- | src/main.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig index 0e09d81..2534c17 100644 --- a/src/main.zig +++ b/src/main.zig @@ -26,12 +26,10 @@ const SudokuSolver = struct { fn possibleMovesForCell(self: SudokuSolver, row: usize, col: usize) std.StaticBitSet(9) { var cell_guesses: std.StaticBitSet(9) = .initEmpty(); - for (1..10) |n| { + const constraints = join(self.rows[row], join(self.cols[col], self.boxes[boxOf(row, col)])); + inline for (1..10) |n| { // A number is a possible move iff it does not already exist in the current row, col, or box. - if (countEql( - join(self.rows[row], join(self.cols[col], self.boxes[boxOf(row, col)])), - @intCast(n), - ) == 0) { + if (countEql(constraints, @intCast(n)) == 0) { cell_guesses.set(n - 1); } } |