(self, point: Point)
| 214 | self.find_char_random_walk(char) |
| 215 | |
| 216 | def approach(self, point: Point): |
| 217 | north = point.forward("N") |
| 218 | if north in self.char_locations["."]: |
| 219 | self.goto(north) |
| 220 | self.face("S") |
| 221 | return |
| 222 | south = point.forward("S") |
| 223 | if south in self.char_locations["."]: |
| 224 | self.goto(south) |
| 225 | self.face("N") |
| 226 | return |
| 227 | east = point.forward("E") |
| 228 | if east in self.char_locations["."]: |
| 229 | self.goto(east) |
| 230 | self.face("W") |
| 231 | return |
| 232 | west = point.forward("W") |
| 233 | if west in self.char_locations["."]: |
| 234 | self.goto(west) |
| 235 | self.face("E") |
| 236 | return |
| 237 | # TODO handle case where |
| 238 | # * point is surrounded |
| 239 | # * not in dogs memory |
| 240 | success = self.goto(west) |
| 241 | if success: |
| 242 | self.face("E") |
| 243 | else: |
| 244 | # TODO this can still fail |
| 245 | rand = self._generate_random_point(max_dist=4) |
| 246 | self.goto(rand) |
| 247 | self.approach(point) |
| 248 | |
| 249 | |
| 250 | def pick_known(self, char: str, point: Point): |
no test coverage detected