@@ -8,7 +8,12 @@ pub fn solve(url: &str) -> Result<Board, &'static str> {
88
99 let height = problem. len ( ) ;
1010 let width = problem[ 0 ] . len ( ) ;
11- let mut board = Board :: new ( BoardKind :: OuterGrid , height, width, check_uniqueness ( & ans) ) ;
11+ let mut board = Board :: new (
12+ BoardKind :: ColoredGrid ( "#cccccc" ) ,
13+ height,
14+ width,
15+ check_uniqueness ( & ans) ,
16+ ) ;
1217 for y in 0 ..height {
1318 for x in 0 ..width {
1419 if let Some ( clue) = problem[ y] [ x] {
@@ -40,7 +45,7 @@ mod tests {
4045 compare_board_and_check_no_solution_case ! (
4146 solve( "https://puzz.link/p?araf/6/6/h3j3j3p-1cj8j8h" ) ,
4247 Board {
43- kind: BoardKind :: OuterGrid ,
48+ kind: BoardKind :: ColoredGrid ( "#cccccc" ) ,
4449 height: 6 ,
4550 width: 6 ,
4651 data: vec![
@@ -57,107 +62,65 @@ mod tests {
5762 Item { y: 11 , x: 7 , color: "black" , kind: ItemKind :: Circle } ,
5863 Item { y: 11 , x: 7 , color: "black" , kind: ItemKind :: Num ( 8 ) } ,
5964 Item { y: 2 , x: 1 , color: "green" , kind: ItemKind :: Cross } ,
60- Item { y: 2 , x: 1 , color: "#cccccc" , kind: ItemKind :: Wall } ,
6165 Item { y: 1 , x: 2 , color: "green" , kind: ItemKind :: Cross } ,
62- Item { y: 1 , x: 2 , color: "#cccccc" , kind: ItemKind :: Wall } ,
6366 Item { y: 2 , x: 3 , color: "green" , kind: ItemKind :: BoldWall } ,
6467 Item { y: 1 , x: 4 , color: "green" , kind: ItemKind :: Cross } ,
65- Item { y: 1 , x: 4 , color: "#cccccc" , kind: ItemKind :: Wall } ,
6668 Item { y: 2 , x: 5 , color: "green" , kind: ItemKind :: Cross } ,
67- Item { y: 2 , x: 5 , color: "#cccccc" , kind: ItemKind :: Wall } ,
6869 Item { y: 1 , x: 6 , color: "green" , kind: ItemKind :: Cross } ,
69- Item { y: 1 , x: 6 , color: "#cccccc" , kind: ItemKind :: Wall } ,
7070 Item { y: 2 , x: 7 , color: "green" , kind: ItemKind :: Cross } ,
71- Item { y: 2 , x: 7 , color: "#cccccc" , kind: ItemKind :: Wall } ,
7271 Item { y: 1 , x: 8 , color: "green" , kind: ItemKind :: Cross } ,
73- Item { y: 1 , x: 8 , color: "#cccccc" , kind: ItemKind :: Wall } ,
7472 Item { y: 2 , x: 9 , color: "green" , kind: ItemKind :: Cross } ,
75- Item { y: 2 , x: 9 , color: "#cccccc" , kind: ItemKind :: Wall } ,
7673 Item { y: 1 , x: 10 , color: "green" , kind: ItemKind :: Cross } ,
77- Item { y: 1 , x: 10 , color: "#cccccc" , kind: ItemKind :: Wall } ,
7874 Item { y: 2 , x: 11 , color: "green" , kind: ItemKind :: Cross } ,
79- Item { y: 2 , x: 11 , color: "#cccccc" , kind: ItemKind :: Wall } ,
8075 Item { y: 4 , x: 1 , color: "green" , kind: ItemKind :: BoldWall } ,
8176 Item { y: 3 , x: 2 , color: "green" , kind: ItemKind :: BoldWall } ,
8277 Item { y: 4 , x: 3 , color: "green" , kind: ItemKind :: Cross } ,
83- Item { y: 4 , x: 3 , color: "#cccccc" , kind: ItemKind :: Wall } ,
8478 Item { y: 3 , x: 4 , color: "green" , kind: ItemKind :: BoldWall } ,
8579 Item { y: 4 , x: 5 , color: "green" , kind: ItemKind :: Cross } ,
86- Item { y: 4 , x: 5 , color: "#cccccc" , kind: ItemKind :: Wall } ,
8780 Item { y: 3 , x: 6 , color: "green" , kind: ItemKind :: Cross } ,
88- Item { y: 3 , x: 6 , color: "#cccccc" , kind: ItemKind :: Wall } ,
8981 Item { y: 4 , x: 7 , color: "green" , kind: ItemKind :: Cross } ,
90- Item { y: 4 , x: 7 , color: "#cccccc" , kind: ItemKind :: Wall } ,
9182 Item { y: 3 , x: 8 , color: "green" , kind: ItemKind :: Cross } ,
92- Item { y: 3 , x: 8 , color: "#cccccc" , kind: ItemKind :: Wall } ,
9383 Item { y: 4 , x: 9 , color: "green" , kind: ItemKind :: Cross } ,
94- Item { y: 4 , x: 9 , color: "#cccccc" , kind: ItemKind :: Wall } ,
9584 Item { y: 3 , x: 10 , color: "green" , kind: ItemKind :: Cross } ,
96- Item { y: 3 , x: 10 , color: "#cccccc" , kind: ItemKind :: Wall } ,
9785 Item { y: 4 , x: 11 , color: "green" , kind: ItemKind :: Cross } ,
98- Item { y: 4 , x: 11 , color: "#cccccc" , kind: ItemKind :: Wall } ,
9986 Item { y: 6 , x: 1 , color: "green" , kind: ItemKind :: Cross } ,
100- Item { y: 6 , x: 1 , color: "#cccccc" , kind: ItemKind :: Wall } ,
10187 Item { y: 5 , x: 2 , color: "green" , kind: ItemKind :: BoldWall } ,
10288 Item { y: 6 , x: 3 , color: "green" , kind: ItemKind :: Cross } ,
103- Item { y: 6 , x: 3 , color: "#cccccc" , kind: ItemKind :: Wall } ,
10489 Item { y: 5 , x: 4 , color: "green" , kind: ItemKind :: BoldWall } ,
10590 Item { y: 6 , x: 5 , color: "green" , kind: ItemKind :: Cross } ,
106- Item { y: 6 , x: 5 , color: "#cccccc" , kind: ItemKind :: Wall } ,
10791 Item { y: 5 , x: 6 , color: "green" , kind: ItemKind :: Cross } ,
108- Item { y: 5 , x: 6 , color: "#cccccc" , kind: ItemKind :: Wall } ,
10992 Item { y: 6 , x: 7 , color: "green" , kind: ItemKind :: Cross } ,
110- Item { y: 6 , x: 7 , color: "#cccccc" , kind: ItemKind :: Wall } ,
11193 Item { y: 5 , x: 8 , color: "green" , kind: ItemKind :: Cross } ,
112- Item { y: 5 , x: 8 , color: "#cccccc" , kind: ItemKind :: Wall } ,
11394 Item { y: 6 , x: 9 , color: "green" , kind: ItemKind :: Cross } ,
114- Item { y: 6 , x: 9 , color: "#cccccc" , kind: ItemKind :: Wall } ,
11595 Item { y: 5 , x: 10 , color: "green" , kind: ItemKind :: Cross } ,
116- Item { y: 5 , x: 10 , color: "#cccccc" , kind: ItemKind :: Wall } ,
11796 Item { y: 6 , x: 11 , color: "green" , kind: ItemKind :: Cross } ,
118- Item { y: 6 , x: 11 , color: "#cccccc" , kind: ItemKind :: Wall } ,
11997 Item { y: 8 , x: 1 , color: "green" , kind: ItemKind :: Cross } ,
120- Item { y: 8 , x: 1 , color: "#cccccc" , kind: ItemKind :: Wall } ,
12198 Item { y: 7 , x: 2 , color: "green" , kind: ItemKind :: BoldWall } ,
12299 Item { y: 8 , x: 3 , color: "green" , kind: ItemKind :: Cross } ,
123- Item { y: 8 , x: 3 , color: "#cccccc" , kind: ItemKind :: Wall } ,
124100 Item { y: 7 , x: 4 , color: "green" , kind: ItemKind :: BoldWall } ,
125101 Item { y: 8 , x: 5 , color: "green" , kind: ItemKind :: BoldWall } ,
126102 Item { y: 7 , x: 6 , color: "green" , kind: ItemKind :: Cross } ,
127- Item { y: 7 , x: 6 , color: "#cccccc" , kind: ItemKind :: Wall } ,
128103 Item { y: 8 , x: 7 , color: "green" , kind: ItemKind :: BoldWall } ,
129104 Item { y: 7 , x: 8 , color: "green" , kind: ItemKind :: Cross } ,
130- Item { y: 7 , x: 8 , color: "#cccccc" , kind: ItemKind :: Wall } ,
131105 Item { y: 8 , x: 9 , color: "green" , kind: ItemKind :: BoldWall } ,
132106 Item { y: 7 , x: 10 , color: "green" , kind: ItemKind :: Cross } ,
133- Item { y: 7 , x: 10 , color: "#cccccc" , kind: ItemKind :: Wall } ,
134107 Item { y: 8 , x: 11 , color: "green" , kind: ItemKind :: Cross } ,
135- Item { y: 8 , x: 11 , color: "#cccccc" , kind: ItemKind :: Wall } ,
136108 Item { y: 10 , x: 1 , color: "green" , kind: ItemKind :: Cross } ,
137- Item { y: 10 , x: 1 , color: "#cccccc" , kind: ItemKind :: Wall } ,
138109 Item { y: 9 , x: 2 , color: "green" , kind: ItemKind :: BoldWall } ,
139110 Item { y: 10 , x: 3 , color: "green" , kind: ItemKind :: BoldWall } ,
140111 Item { y: 9 , x: 4 , color: "green" , kind: ItemKind :: Cross } ,
141- Item { y: 9 , x: 4 , color: "#cccccc" , kind: ItemKind :: Wall } ,
142112 Item { y: 10 , x: 5 , color: "green" , kind: ItemKind :: BoldWall } ,
143113 Item { y: 9 , x: 6 , color: "green" , kind: ItemKind :: Cross } ,
144- Item { y: 9 , x: 6 , color: "#cccccc" , kind: ItemKind :: Wall } ,
145114 Item { y: 10 , x: 7 , color: "green" , kind: ItemKind :: BoldWall } ,
146115 Item { y: 9 , x: 8 , color: "green" , kind: ItemKind :: Cross } ,
147- Item { y: 9 , x: 8 , color: "#cccccc" , kind: ItemKind :: Wall } ,
148116 Item { y: 10 , x: 9 , color: "green" , kind: ItemKind :: BoldWall } ,
149117 Item { y: 9 , x: 10 , color: "green" , kind: ItemKind :: BoldWall } ,
150118 Item { y: 10 , x: 11 , color: "green" , kind: ItemKind :: Cross } ,
151- Item { y: 10 , x: 11 , color: "#cccccc" , kind: ItemKind :: Wall } ,
152119 Item { y: 11 , x: 2 , color: "green" , kind: ItemKind :: Cross } ,
153- Item { y: 11 , x: 2 , color: "#cccccc" , kind: ItemKind :: Wall } ,
154120 Item { y: 11 , x: 4 , color: "green" , kind: ItemKind :: Cross } ,
155- Item { y: 11 , x: 4 , color: "#cccccc" , kind: ItemKind :: Wall } ,
156121 Item { y: 11 , x: 6 , color: "green" , kind: ItemKind :: Cross } ,
157- Item { y: 11 , x: 6 , color: "#cccccc" , kind: ItemKind :: Wall } ,
158122 Item { y: 11 , x: 8 , color: "green" , kind: ItemKind :: BoldWall } ,
159123 Item { y: 11 , x: 10 , color: "green" , kind: ItemKind :: Cross } ,
160- Item { y: 11 , x: 10 , color: "#cccccc" , kind: ItemKind :: Wall } ,
161124 ] ,
162125 uniqueness: Uniqueness :: Unique ,
163126 } ,
0 commit comments