1 parent 66caf0e commit 6de4c95Copy full SHA for 6de4c95
1 file changed
cspuz_rs_puzzles/src/puzzles/fillmat.rs
@@ -25,6 +25,8 @@ pub fn solve_fillmat(
25
.ne(num.slice((1.., ..)))
26
.iff(&is_border.horizontal),
27
);
28
+
29
+ // Same numbers cannot be diagonally adjacent. Takes care of the shape constraint
30
for i in 1..=4 {
31
solver.add_expr(!(num.eq(i).slice((..(h - 1), ..(w - 1))) & num.eq(i).slice((1.., 1..))));
32
solver.add_expr(!(num.eq(i).slice((..(h - 1), 1..)) & num.eq(i).slice((1.., ..(w - 1)))));
@@ -41,7 +43,7 @@ pub fn solve_fillmat(
41
43
}
42
44
45
- // No 4 intersections (technically redundant by theory but keeping it for optimization)
46
+ // No 4 intersections
47
for y in 1..h {
48
for x in 1..w {
49
let left = &is_border.horizontal.at((y - 1, x - 1));
0 commit comments