MCPcopy Create free account
hub / github.com/JoshuaPostel/texaform / approach

Method approach

python/dog.py:216–247  ·  view source on GitHub ↗
(self, point: Point)

Source from the content-addressed store, hash-verified

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):

Callers 5

charge_if_neededMethod · 0.95
pick_knownMethod · 0.95
drop_offMethod · 0.95
drop_withinMethod · 0.95
clear_columnFunction · 0.80

Calls 4

gotoMethod · 0.95
faceMethod · 0.95
forwardMethod · 0.80

Tested by

no test coverage detected