def calculate_properties(self, *args): if self.visible: ball_position = args[0] BaseRobot.calculate_properties(self, ball_position) if self.desired_position is not None: self.direction["desired_position"] = Util.get_direction(self.position, self.desired_position) if self.enemy1.visible: self.direction["enemy1"] = Util.get_direction(self.position, self.enemy1.position) if self.enemy2.visible: self.direction["enemy2"] = Util.get_direction(self.position, self.enemy2.position) if self.enemy1.visible and self.enemy2.visible: self.intercept_line = [self.enemy1.position, self.enemy2.position] if self.facing_attacking_goal: if self.enemy1.visible and self.enemy2.visible and self.ally.visible: list_of_robots = [self.ally, self.enemy1, self.enemy2] self.can_score = Util.can_score(self.attacking_goal, self, list_of_robots) else: return True else: self.can_score = False self.direction['attacking goal'] = Util.get_direction(self.position, Util.get_midpoint(self.attacking_goal_line))
def calculate_properties(self, *args): if self.visible: ball_position = args[0] BaseRobot.calculate_properties(self, ball_position) if self.desired_position is not None: self.direction["desired_position"] = Util.get_direction(self.position, self.desired_position) if self.enemy1.visible: self.direction["enemy1"] = Util.get_direction(self.position, self.enemy1.position) if self.enemy2.visible: self.direction["enemy2"] = Util.get_direction(self.position, self.enemy2.position) if self.enemy1.visible and self.enemy2.visible: self.intercept_line = [self.enemy1.position, self.enemy2.position]