Skip to content

Commit

Permalink
Fixes SpiralNavigation skipping waypoints (#807)
Browse files Browse the repository at this point in the history
* Fixed sleep to use floats again

* Fixed sleep to use floats again #2

* Refactored jitter to have its own function to be used elsewhere

* Fixes SpiralNavigation skipping waypoints

* Fixing stationary movements
  • Loading branch information
tstumm authored and eggins committed Jul 25, 2016
1 parent 844ae69 commit 2006abd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 5 additions & 3 deletions pokemongo_bot/human_behaviour.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@


def sleep(seconds, delta=0.3):
jitter = delta * seconds
sleep_time = uniform(seconds - jitter, seconds + jitter)
time.sleep(sleep_time)
time.sleep(jitter(seconds,delta))

def jitter(value, delta=0.3):
jitter = delta * value
return uniform(value-jitter, value+jitter)


def random_lat_long_delta():
Expand Down
10 changes: 8 additions & 2 deletions pokemongo_bot/spiral_navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def take_step(self):
if self.x == self.y or self.x < 0 and self.x == -self.y or self.x > 0 and self.x == 1 - self.y:
(self.dx, self.dy) = (-self.dy, self.dx)

(self.x, self.y) = (self.x + self.dx, self.y + self.dy)
sleep(10)
if distance(
i2f(self.api._position_lat),
i2f(self.api._position_lng),
position[0],
position[1]
) <= 1 or (self.config.walk > 0 and self._step_walker == None):
(self.x, self.y) = (self.x + self.dx, self.y + self.dy)
sleep(1)
return position[0:2]

0 comments on commit 2006abd

Please sign in to comment.