<commit_before>from nytram.ext.box2d import Vec2
from nytram.ext.box2d.movement import InstantVelocity

class Ball:
    """ Represents a ball's behavior """
    
    def start(self):
        """ Start the body """
        direction = Vec2(0, 1)
        speed = InstantVelocity(5)
        speed.apply(self.body, direction)
        
    @property
    def body(self):
        """ Return the body the ball is connected to """
        return self.entity.body<commit_msg>THe ball now starts with a random direction<commit_after>from nytram.ext.box2d import Vec2
from nytram.ext.box2d.movement import InstantVelocity

import random

class Ball:
    """ Represents a ball's behavior """
    
    def start(self):
        """ Start the body """
        direction = self.getInitialDirection()
        speed = InstantVelocity(5)
        speed.apply(self.body, direction)
        
    def getInitialDirection(self):
        """ Return the initial direction for the Ball """
        directions = [.1, .2, .3, .4, .5, .6, .7, .8, .9, 1]
        posOrNeg = [-1, 1]
        
        x = random.choice(directions)*random.choice(posOrNeg)
        y = random.choice(directions)*random.choice(posOrNeg)
        return Vec2(x, y)
        
    @property
    def body(self):
        """ Return the body the ball is connected to """
        return self.entity.body
{'fraction_non_alphanumeric': 0.11343283582089553, 'fraction_numerical': 0.01791044776119403, 'mean_word_length': 2.3609022556390977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7527584', 'n_tokens_mistral': 410, 'n_tokens_neox': 401, 'n_words': 115}