From dfcb9894663cc53901f62db950e115755d29889f Mon Sep 17 00:00:00 2001 From: Alex Yao Date: Fri, 19 Aug 2016 10:16:07 -0700 Subject: [PATCH] Step walker improvement --- pokemongo_bot/walkers/step_walker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pokemongo_bot/walkers/step_walker.py b/pokemongo_bot/walkers/step_walker.py index 1946351b8a..7b8fe41785 100644 --- a/pokemongo_bot/walkers/step_walker.py +++ b/pokemongo_bot/walkers/step_walker.py @@ -1,6 +1,6 @@ from math import sqrt -from random import random +from random import uniform from pokemongo_bot.cell_workers.utils import distance from pokemongo_bot.human_behaviour import random_lat_long_delta, sleep @@ -20,14 +20,14 @@ def __init__(self, bot, dest_lat, dest_lng): dest_lng ) - self.speed = self.bot.config.walk_max - random() * (self.bot.config.walk_max - self.bot.config.walk_min) + self.speed = uniform(self.bot.config.walk_min, self.bot.config.walk_max) self.destLat = dest_lat self.destLng = dest_lng self.totalDist = max(1, self.dist) if self.speed == 0: - self.steps = 1 + raise Exception("Walking speed cannot be 0!") else: self.steps = (self.dist + 0.0) / (self.speed + 0.0)