<commit_before># -*- coding: utf-8 -*-
# pylint: disable=
"""
Created on Tue May  3 18:34:45 2016

@author: <NAME> and <NAME>
"""

import random
import sge

PLAYER_YOFFSET = 50
PLAYER_SPEED = 4
BULLET_START_SPEED = 15
BULLET_ACCELERATION = 0.5
CITIUS_COLOR = sge.gfx.Color("#EF7D10")

class Game(sge.dsp.Game):

    def event_key_press(self, key, char):
        global game_in_progress
        if key == 'f8':
            sge.gfx.Sprite.from_screenshot().save('screenshot.jpg')
        elif key == 'f11':
            self.fullscreen = not self.fullscreen
        elif key == 'escape':
            self.event_close()
        elif key in ('p', 'enter'):
            self.pause()
        #Invaders size scaling
        elif key in ('up', 'down'):
            if key == 'down':
                invaders[2].image_xscale -= 1.0
                invaders[2].image_yscale -= 1.0
            elif key == 'up':
                invaders[2].image_xscale += 1.0
                invaders[2].image_yscale += 1.0
            invaders[2].bbox_width = (invaders[2].sprite.width *
                                                      invaders[2].image_xscale)
            invaders[2].bbox_height = (invaders[2].sprite.height *
                                                      invaders[2].image_yscale)
        #Invaders color changing
        elif key == 'd':
            v = invaders[2].image_blend.red
            if v > 10:
                invaders[2].image_blend = sge.gfx.Color([v-10, v-10, v-10])
        elif key == 'l':
            v = invaders[2].image_blend.red
            if v < 245:
                invaders[2].image_blend = sge.gfx.Color([v+10, v+10, v+10])

    def event_close(self):
        self.end()

    def event_paused_key_press(self, key, char):
        if key == 'escape':
            # This allows the player to still exit while the game is
            # paused, rather than having to unpause first.
            self.event_close()
        else:
            self.unpause()

    def event_paused_close(self):
        # This allows the player to still exit while the game is paused,
        # rather than having to unpause first.
        self.event_close()


class Invader(sge.dsp.Object):
    attr_generators = {
        'scale': lambda: random.lognormvariate(0.5, 0.3),
        'alpha': lambda: random.randint(100, 255),
        'xvelocity': lambda: random.lognormvariate(0.1, 0.4),
        'yvelocity': lambda: random.lognormvariate(0.1, 0.4),
        'x_prob_change_dir': lambda: random.uniform(0.001, 0.01),
        'y_prob_change_dir': lambda: random.uniform(0.001, 0.01)
    }

    def __init__(self, **kwargs):
        # Generate random values and update with the ones provided in kwargs
        self.attributes = {k: self.attr_generators.get(k)() for k in self.attr_generators.keys()}
        self.attributes.update(kwargs)
        print self.attributes

        super(Invader, self).__init__(sge.game.width / 2., sge.game.height / 2. - 80,
                                      sprite=sge.gfx.Sprite(name='invader'),
                                      image_blend=sge.gfx.Color('white'),
                                      checks_collisions=False)

        self.xvelocity = self.attributes.get('xvelocity')<commit_msg>Random invaders now have always scale > 1<commit_after># -*- coding: utf-8 -*-
# pylint: disable=
"""
Created on Tue May  3 18:34:45 2016

@author: <NAME> and <NAME>
"""

import random
import sge

PLAYER_YOFFSET = 50
PLAYER_SPEED = 4
BULLET_START_SPEED = 15
BULLET_ACCELERATION = 0.5
CITIUS_COLOR = sge.gfx.Color("#EF7D10")

class Game(sge.dsp.Game):

    def event_key_press(self, key, char):
        global game_in_progress
        if key == 'f8':
            sge.gfx.Sprite.from_screenshot().save('screenshot.jpg')
        elif key == 'f11':
            self.fullscreen = not self.fullscreen
        elif key == 'escape':
            self.event_close()
        elif key in ('p', 'enter'):
            self.pause()
        #Invaders size scaling
        elif key in ('up', 'down'):
            if key == 'down':
                invaders[2].image_xscale -= 1.0
                invaders[2].image_yscale -= 1.0
            elif key == 'up':
                invaders[2].image_xscale += 1.0
                invaders[2].image_yscale += 1.0
            invaders[2].bbox_width = (invaders[2].sprite.width *
                                                      invaders[2].image_xscale)
            invaders[2].bbox_height = (invaders[2].sprite.height *
                                                      invaders[2].image_yscale)
        #Invaders color changing
        elif key == 'd':
            v = invaders[2].image_blend.red
            if v > 10:
                invaders[2].image_blend = sge.gfx.Color([v-10, v-10, v-10])
        elif key == 'l':
            v = invaders[2].image_blend.red
            if v < 245:
                invaders[2].image_blend = sge.gfx.Color([v+10, v+10, v+10])

    def event_close(self):
        self.end()

    def event_paused_key_press(self, key, char):
        if key == 'escape':
            # This allows the player to still exit while the game is
            # paused, rather than having to unpause first.
            self.event_close()
        else:
            self.unpause()

    def event_paused_close(self):
        # This allows the player to still exit while the game is paused,
        # rather than having to unpause first.
        self.event_close()


class Invader(sge.dsp.Object):
    attr_generators = {
        'scale': lambda: random.lognormvariate(0.5, 0.3)+1,
        'alpha': lambda: random.randint(100, 255),
        'xvelocity': lambda: random.lognormvariate(0.1, 0.4),
        'yvelocity': lambda: random.lognormvariate(0.1, 0.4),
        'x_prob_change_dir': lambda: random.uniform(0.001, 0.01),
        'y_prob_change_dir': lambda: random.uniform(0.001, 0.01)
    }

    def __init__(self, **kwargs):
        # Generate random values and update with the ones provided in kwargs
        self.attributes = {k: self.attr_generators.get(k)() for k in self.attr_generators.keys()}
        self.attributes.update(kwargs)
        print self.attributes

        super(Invader, self).__init__(sge.game.width / 2., sge.game.height / 2. - 80,
                                      sprite=sge.gfx.Sprite(name='invader'),
                                      image_blend=sge.gfx.Color('white'),
                                      checks_collisions=False)

        self.xvelocity = self.attributes.get('xvelocity')
{'fraction_non_alphanumeric': 0.12281240405280934, 'fraction_numerical': 0.031010132023334358, 'mean_word_length': 1.8301476976542137, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2581386', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2024, 'n_words': 459}