Skip to content

Commit

Permalink
Adding the navigator to the list of workers (#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
elicwhite authored and douglascamata committed Jul 31, 2016
1 parent a761db4 commit 8804e46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ def __init__(self, config):
def start(self):
self._setup_logging()
self._setup_api()
self._setup_workers()

if self.config.navigator_type == 'spiral':
self.navigator=cell_workers.FollowSpiral(self)
self.navigator = cell_workers.FollowSpiral
elif self.config.navigator_type == 'path':
self.navigator=cell_workers.FollowPath(self)
self.navigator = cell_workers.FollowPath

self._setup_workers()

random.seed()

Expand Down Expand Up @@ -90,8 +91,6 @@ def tick(self):
if worker.work() == WorkerResult.RUNNING:
return

self.navigator.take_step()

def get_meta_cell(self):
location = self.position[0:2]
cells = self.find_close_cells(*location)
Expand Down Expand Up @@ -308,7 +307,8 @@ def _setup_workers(self):
cell_workers.SpinFort(self),
cell_workers.MoveToFort(self),
cell_workers.CatchLuredPokemon(self),
cell_workers.SpinFort(self)
cell_workers.SpinFort(self),
self.navigator(self)
]

def _print_character_info(self):
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/follow_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def load_gpx(self, file):

return points;

def take_step(self):
def work(self):
point = self.points[self.ptr]
lat = float(point['lat'])
lng = float(point['lng'])
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/follow_spiral.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _generate_spiral(starting_lat, starting_lng, step_size, step_limit):
m += 1
return coords

def take_step(self):
def work(self):
point = self.points[self.ptr]
self.cnt += 1

Expand Down

0 comments on commit 8804e46

Please sign in to comment.