<commit_before>#Python 2

import rrb2 as rrb
import os
import math
import sys
import pygame

#import ex_8x8_pixels

rr = rrb.RRB2(revision=2)
pygame.init()
pygame.joystick.init()
controller = pygame.joystick.Joystick(0)
controller.init()

CONTROLLER_PAD_UP = 4
CONTROLLER_PAD_RIGHT = 5
CONTROLLER_PAD_DOWN = 6
CONTROLLER_PAD_LEFT = 7

movement = {"x1": 0, "y1": 0, "x2": 0, "y2": 0}

# def forward(lspeed, rspeed):
#     rr.set_motors(lspeed, 0, rspeed, 0)
#
# def reverse(lspeed, rspeed):
#     rr.set_motors(lspeed, 1, rspeed, 1)
#

def stop():
    rr.set_motors(0, 0, 0, 0)

def calc_dir():
    left_reverse = False
    right_reverse = False
    left_speed = 0
    right_speed = 0

    if movement["x2"] > 0:
        right_speed = (1 - math.sqrt(abs(movement["y1"]))) + 0.1
        left_speed = abs(movement["y1"])
    elif movement["x2"] < 0:
        left_speed = (1 - math.sqrt(abs(movement["y1"]))) + 0.1
        right_speed = abs(movement["y1"])

    if movement["y1"] > 0:<commit_msg>use 2 axis controller for speed and direction<commit_after>#Python 2

import rrb2 as rrb
import os
import math
import sys
import pygame

#import ex_8x8_pixels

rr = rrb.RRB2(revision=2)
pygame.init()
pygame.joystick.init()
controller = pygame.joystick.Joystick(0)
controller.init()

CONTROLLER_PAD_UP = 4
CONTROLLER_PAD_RIGHT = 5
CONTROLLER_PAD_DOWN = 6
CONTROLLER_PAD_LEFT = 7

movement = {"x1": 0, "y1": 0, "x2": 0, "y2": 0}

# def forward(lspeed, rspeed):
#     rr.set_motors(lspeed, 0, rspeed, 0)
#
# def reverse(lspeed, rspeed):
#     rr.set_motors(lspeed, 1, rspeed, 1)
#

def stop():
    rr.set_motors(0, 0, 0, 0)

def calc_dir():
    left_reverse = False
    right_reverse = False

    if movement["x2"] > 0:
        right_speed = (1 - math.sqrt(abs(movement["y1"]))) + 0.1
        left_speed = abs(movement["y1"])
    elif movement["x2"] < 0:
        left_speed = (1 - math.sqrt(abs(movement["y1"]))) + 0.1
        right_speed = abs(movement["y1"])
    else:
        right_speed = abs(movement["y1"])
        left_speed = abs(movement["y1"])

    if movement["y1"] > 0:
{'fraction_non_alphanumeric': 0.15217391304347827, 'fraction_numerical': 0.04396135265700483, 'mean_word_length': 3.5717439293598234, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 7, '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': '559224', 'n_tokens_mistral': 909, 'n_tokens_neox': 845, 'n_words': 189}