commit 373064734d5b09ee3e8181d04f6a92396fb20a65
parent 4dca07e7bd573401ba1e1b818e3498419feaa754
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Mon, 8 Apr 2024 22:19:17 +0200
Add check for Box Line Reduction
Diffstat:
1 file changed, 24 insertions(+), 0 deletions(-)
diff --git a/main.cpp b/main.cpp
@@ -610,6 +610,18 @@ class Grid {
changes++;
}
+
+ const auto ptr = rows[row].get_pointing_row();
+ for (const auto [idx, val] : ptr) {
+ std::cout << "box line reduction row: " << (int)row << " " << (int)idx << " " << (int)val
+ << std::endl;
+
+ const auto [r1, r2] = row_col_t::other_subgrid_row(row);
+ _clear_row((r1 / 3) * 3 + idx, r1 % 3, val);
+ _clear_row((r2 / 3) * 3 + idx, r2 % 3, val);
+
+ changes++;
+ }
}
for (uint8_t col = 0; col < 9; col++) {
@@ -694,6 +706,18 @@ class Grid {
changes++;
}
+
+ const auto ptr = cols[col].get_pointing_row();
+ for (const auto [idx, val] : ptr) {
+ std::cout << "box line reduction col: " << (int)col << " " << (int)idx << " " << (int)val
+ << std::endl;
+
+ const auto [c1, c2] = row_col_t::other_subgrid_row(col);
+ _clear_col(idx * 3 + c1 / 3, c1 % 3, val);
+ _clear_col(idx * 3 + c2 / 3, c2 % 3, val);
+
+ changes++;
+ }
}
if (changes) iter++;