<commit_before>import os
import collisions
from json import loads, dumps
from jsonschema import Draft4Validator
from vividict import vividict
from copy import deepcopy
from math import sin, cos, radians
from random import randint, sample

class Gamectl:
    def is_valid_move(self, prev_state, bot_move):
        """Validates the move made by a bot."""

        cdir = os.path.dirname(os.path.realpath('__file__'))
        move_schema = open(os.path.join(cdir, 'src', 'game', 'moveschema.json'), 'r').read()
        
        try:
            move = loads(bot_move)
            Draft4Validator(loads(move_schema)).validate(move)
        except Exception as e:
            print "[*] Exception: {}".format(e.message)
            return False
        else:
            return True

    def initialize_bots(self, map_text, lst):
        self.score = {}
        for bname in lst:
            self.score[bname] = 0
            
        prev_state = loads(map_text)
        
        prev_state['bots'] = [{'botname':lst[0], 'childno':0, 'angle':0, 'mass':50, 'radius':25, 'center':(0, 1000), 'velocity':1.0},
                              {'botname':lst[1], 'childno':0, 'angle':180, 'mass':150, 'radius':50, 'center':(1000, 1000), 'velocity':1.0}]

        prev_state['score'] = self.score
        # The '\n' acts as RETURN after the raw_input()
        return dumps(prev_state)+'\n'

    def update_decay(self, bot):
        bot['mass'] -= 0.002*bot['mass']

    def update_direction(self, bot, rel_angle):
        bot['angle'] = (rel_angle + bot['angle']) % 360

    def update_velocity(self, bot):
        """
        Update velocity with respect to mass
        """
        bot['velocity'] = 2.2*(bot['mass']**-0.439)

    def update_radius(self, bot):
        """
        Update radius with respect to mass
        """
        bot['radius'] = bot['mass']/2.0

    def pause(self, bot):
        """
        Bring this particular child to halt
        """
        bot['velocity'] = 0
        

    def eject_mass(self, bot):
        ejectangle = (bot['angle'] + 180) % 360<commit_msg>made initialization of the bots to normal again<commit_after>import os
import collisions
from json import loads, dumps
from jsonschema import Draft4Validator
from vividict import vividict
from copy import deepcopy
from math import sin, cos, radians
from random import randint, sample

class Gamectl:
    def is_valid_move(self, prev_state, bot_move):
        """Validates the move made by a bot."""

        cdir = os.path.dirname(os.path.realpath('__file__'))
        move_schema = open(os.path.join(cdir, 'src', 'game', 'moveschema.json'), 'r').read()
        
        try:
            move = loads(bot_move)
            Draft4Validator(loads(move_schema)).validate(move)
        except Exception as e:
            print "[*] Exception: {}".format(e.message)
            return False
        else:
            return True

    def initialize_bots(self, map_text, lst):
        self.score = {}
        for bname in lst:
            self.score[bname] = 0
            
        prev_state = loads(map_text)
        
        prev_state['bots'] = list(map(lambda x : {'botname':x,
                                                  'angle':randint(0, 359),
                                                  'velocity':0.59,
                                                  'mass':20,
                                                  'radius':10,
                                                  'childno':0,
                                                  'center':(randint(0, prev_state['maxX']), randint(0, prev_state['maxY']))}, lst))
        prev_state['score'] = self.score
        # The '\n' acts as RETURN after the raw_input()
        return dumps(prev_state)+'\n'

    def update_decay(self, bot):
        bot['mass'] -= 0.002*bot['mass']

    def update_direction(self, bot, rel_angle):
        bot['angle'] = (rel_angle + bot['angle']) % 360

    def update_velocity(self, bot):
        """
        Update velocity with respect to mass
        """
        bot['velocity'] = 2.2*(bot['mass']**-0.439)

    def update_radius(self, bot):
        """
        Update radius with respect to mass
        """
        bot['radius'] = bot['mass']/2.0

    def pause(self, bot):
        """
        Bring this particular child to halt
        """
        bot['velocity'] = 0
        

    def eject_mass(self, bot):
        ejectangle = (bot['angle'] + 180) % 360
{'fraction_non_alphanumeric': 0.13205849268841394, 'fraction_numerical': 0.02204724409448819, 'mean_word_length': 1.9192383453709783, '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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '876386', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1273, 'n_words': 332}