<commit_before>from abstract_strategy import *

class GoToBall(AbstractStrategy):
    def __init__(self):
        self.ball_pos = Point(0, 0)
        self.control_option = control_options.pose_line
        self.th = 0
        self.tolerance_radius = 0.1
        self.goal = Point(0, 0)

    def get_strategy_output(self):
        return [self.goal.X, self.goal.Y, 0, self.u, 0, 0, 0, self.control_option]

    def calculate_goal(self):
        if math.sqrt((self.ball_pos.X - self.position.X)**2 + (self.ball_pos.Y - self.position.Y)**2) <= self.tolerance_radius:
            if self.fieldSide == Side.RIGHT:
                if self.ball_pos.Y > 0:
                    self.u = 4
                else:
                    self.u = 3

            if self.fieldSide == Side.LEFT:
                if self.ball_pos.Y > 0:
                    self.u = 3
                else:
                    self.u = 4
        else:
            self.goal = Point(self.ball_pos.x, self.ball_pos.y)
            self.u = 0<commit_msg>GoToBall doesn't go beyond a limit x value<commit_after>from abstract_strategy import *

class GoToBall(AbstractStrategy):
    def __init__(self):
        self.ball_pos = Point(0, 0)
        self.control_option = control_options.pose_line
        self.th = 0
        self.tolerance_radius = 0.1
        self.goal = Point(0, 0)
        self.lim_x = 0.50

    def get_strategy_output(self):
        return [self.goal.X, self.goal.Y, 0, self.u, 0, 0, 0, self.control_option]

    def calculate_goal(self):
        if math.sqrt((self.ball_pos.X - self.position.X)**2 + (self.ball_pos.Y - self.position.Y)**2) <= self.tolerance_radius:
            if self.fieldSide == Side.RIGHT:
                if self.ball_pos.Y > 0:
                    self.u = 3
                else:
                    self.u = 4

            if self.fieldSide == Side.LEFT:
                if self.ball_pos.Y > 0:
                    self.u = 4
                else:
                    self.u = 3
        else:
            if self.fieldSide == Side.RIGHT:
                if self.ball_pos.X >= self.lim_x:
                    self.goal = Point(self.lim_x, self.ball_pos.y)
                else:
                    self.goal = Point(self.ball_pos.x, self.ball_pos.y)

            if self.fieldSide == Side.LEFT:
                if self.ball_pos.X <= self.lim_x:
                    self.goal = Point(-self.lim_x, self.ball_pos.y)
                else:
                    self.goal = Point(self.ball_pos.x, self.ball_pos.y)                

            self.u = 0
{'fraction_non_alphanumeric': 0.1114162416633974, 'fraction_numerical': 0.016869360533542564, 'mean_word_length': 1.430886558627264, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5195883', 'n_tokens_mistral': 876, 'n_tokens_neox': 790, 'n_words': 163}