<commit_before>import numpy as np
from ev3control import Robot

def act(robot, coords, img_res=(640, 480), atol=10):
    """
    Moves the robot towards the brick.

    :param robot: The robot instance
    :param coords: The brick coordinates
    :param img_res: The image resolution
    :param atol: The absolute error tolerance
    :return: Direction string
    """

    img_res = np.asarray(img_res)
    coords = np.asarray(coords)

    img_center = img_res / 2
    error = img_center - coords

    vel = 400

    if np.isclose(coords[0], img_center[0], atol=atol):
        robot.move_forward(vel)
        return "forward"
    elif error[0] > 0:
        robot.rotate_forever(vel=-vel)
        return "left"
    elif error[0] < 0:
        robot.rotate_forever(vel=vel)
        return "right"


def main_loop():

    robot = Robot({

        "leftMotor": "LargeMotor('outA')",
        "rightMotor": "LargeMotor('outB')",
        "gripper": "MediumMotor('outC')",<commit_msg>Positive velocity for turning left<commit_after>import numpy as np
from ev3control import Robot

def act(robot, coords, img_res=(640, 480), atol=10):
    """
    Moves the robot towards the brick.

    :param robot: The robot instance
    :param coords: The brick coordinates
    :param img_res: The image resolution
    :param atol: The absolute error tolerance
    :return: Direction string
    """

    img_res = np.asarray(img_res)
    coords = np.asarray(coords)

    img_center = img_res / 2
    error = img_center - coords

    vel = 400

    if np.isclose(coords[0], img_center[0], atol=atol):
        robot.move_forward(vel)
        return "forward"
    elif error[0] > 0:
        # Positive velocity for turning left
        robot.rotate_forever(vel=vel)
        return "left"
    elif error[0] < 0:
        robot.rotate_forever(vel=-vel)
        return "right"


def main_loop():

    robot = Robot({

        "leftMotor": "LargeMotor('outA')",
        "rightMotor": "LargeMotor('outB')",
        "gripper": "MediumMotor('outC')",
{'fraction_non_alphanumeric': 0.11656746031746032, 'fraction_numerical': 0.018849206349206348, 'mean_word_length': 2.7984934086629, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, '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': '4369070', 'n_tokens_mistral': 715, 'n_tokens_neox': 668, 'n_words': 178}