def __init__(self, unique_id, radius, field_width, field_height, velocity, rng, probability):
     Cyclic_Drone.__init__(self, unique_id, radius, field_width, field_height, velocity, rng)
     Cyclic_Drone.create_cycle(self)
     self.probability = probability
     self.back_goal = None
     self.backtrack = False
     self.on_path = False
     self.strategy = 'random-tsp'
 def set_next_goal(self):
     adjacent = []
     for point in self.cycle:
         if self.x == point[0] and abs(self.y - point[1]) == (self.rng + 2)*2 and point != self.goal:
             adjacent.append(point)
         if self.y == point[1] and abs(self.x - point[0]) == (self.rng + 2)*2 and point != self.goal:
             adjacent.append(point)
     self.goal = random.choice(adjacent)
     Cyclic_Drone.set_directions(self)
 def set_next_goal(self):
     if self.index == 0:
         self.index += 1
         self.backwards = False
     elif self.backwards == True:
         self.index -= 1
     elif self.index >= len(self.cycle) - 1:
         self.backwards = True
         self.index -= 1
     else:
         self.index += 1
     self.goal = self.cycle[self.index]
     Cyclic_Drone.set_directions(self)
 def update(self, time):
     Drone.update(self)
     if Cyclic_Drone.check_reached_goal(self):
         if self.backtrack == True:
             self.backtrack = False
             self.goal = self.original_position
             self.on_path = True
             Cyclic_Drone.set_directions(self)
         elif self.on_path == True:
             self.on_path = False
             self.goal = self.back_goal
             Cyclic_Drone.set_directions(self)
         elif random.random() < self.probability:
             Cyclic_Drone.set_next_goal(self)
             self.back_goal = self.goal
             self.original_position = (self.x, self.y)
             self.backtrack = True
             self.set_next_goal()
         else:
             Cyclic_Drone.set_next_goal(self)
 def __init__(self, unique_id, radius, field_width, field_height, velocity, rng):
     Cyclic_Drone.__init__(self, unique_id, radius, field_width, field_height, velocity, rng)
     Cyclic_Drone.create_cycle(self)
     self.backwards = False
     self.strategy = 'partition'