Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes SpiralNavigation skipping waypoints #807

Merged
merged 11 commits into from
Jul 25, 2016
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]