@@ -123,59 +123,46 @@ impl GameState {
123
123
}
124
124
125
125
self . open ( x, y) . unwrap ( ) ;
126
- self . recursive_open ( x, y) ;
126
+ // self.recursive_open(x, y);
127
127
128
128
Ok ( ( ) )
129
129
}
130
130
131
- fn recursive_open ( & mut self , x : usize , y : usize ) {
132
- let nof_mines_around = self . count_mines_around ( x, y) ;
131
+ // fn recursive_open(&mut self, x: usize, y: usize) {
132
+ // let nof_mines_around = self.count_mines_around(x, y);
133
133
134
- if nof_mines_around > 0 {
135
- self . open ( x, y) . unwrap ( ) ;
136
- return ;
137
- }
134
+ // if nof_mines_around > 0 {
135
+ // self.open(x, y).unwrap();
136
+ // return;
137
+ // }
138
138
139
- if self . has_mine ( x, y) {
140
- return ;
141
- }
139
+ // if self.has_mine(x, y) {
140
+ // return;
141
+ // }
142
142
143
- if self . is_flagged ( x, y) {
144
- return ;
145
- }
143
+ // if self.is_flagged(x, y) {
144
+ // return;
145
+ // }
146
146
147
- self . open ( x, y) . unwrap ( ) ;
147
+ // self.open(x, y).unwrap();
148
148
149
- if x > 0 && self . is_in_range ( x - 1 , y) . is_ok ( ) && !self . is_opened ( x - 1 , y) {
150
- self . recursive_open ( x - 1 , y) ;
151
- }
149
+ // if x > 0 && self.is_in_range(x - 1, y).is_ok() && !self.is_opened(x - 1, y) {
150
+ // self.recursive_open(x - 1, y);
151
+ // }
152
152
153
- if y > 0 && self . is_in_range ( x, y - 1 ) . is_ok ( ) && !self . is_opened ( x, y - 1 ) {
154
- self . recursive_open ( x, y - 1 ) ;
155
- }
153
+ // if y > 0 && self.is_in_range(x, y - 1).is_ok() && !self.is_opened(x, y - 1) {
154
+ // self.recursive_open(x, y - 1);
155
+ // }
156
156
157
- if self . is_in_range ( x + 1 , y) . is_ok ( ) && !self . is_opened ( x + 1 , y) {
158
- self . recursive_open ( x + 1 , y) ;
159
- }
157
+ // if self.is_in_range(x + 1, y).is_ok() && !self.is_opened(x + 1, y) {
158
+ // self.recursive_open(x + 1, y);
159
+ // }
160
160
161
- if self . is_in_range ( x, y + 1 ) . is_ok ( ) && !self . is_opened ( x, y + 1 ) {
162
- self . recursive_open ( x, y + 1 ) ;
163
- }
161
+ // if self.is_in_range(x, y + 1).is_ok() && !self.is_opened(x, y + 1) {
162
+ // self.recursive_open(x, y + 1);
163
+ // }
164
164
165
- // let min_x = if x == 0 { 0 } else { x - 1 };
166
- // let min_y = if y == 0 { 0 } else { y - 1 };
167
- // let max_x = if x >= self.width { self.width } else { x + 1 };
168
- // let max_y = if y >= self.height { self.height } else { y + 1 };
169
-
170
- // for x_it in min_x..=max_x {
171
- // for y_it in min_y..=max_y {
172
- // if !self.is_opened(x_it, y_it) {
173
- // self.open(x_it, y_it);
174
- // // self.recursive_open(x_it, y_it);
175
- // }
176
- // }
177
- // }
178
- }
165
+ // }
179
166
180
167
pub fn mines_left ( & self ) -> usize {
181
168
self . mines . len ( ) - self . flags . len ( )
0 commit comments