<commit_before>#!/usr/bin/env python

import getopt, pyglet, sys, time
from pyglet.window import key

from const import Const
from entity import Entity
from model import Model
from player import Player
from util import Util
from world import World

if __name__ == '__main__':
    try:
        opts, args = getopt.getopt(sys.argv[1:], "d")
    except getopt.GetoptError as err:
        print str(err)
        sys.exit(2)

    for o, a in opts:
        if o == "-d":
            Util.get().debug += 1

    Util.get().window = window = pyglet.window.Window(resizable=True)

    Util.get().world = world = World("world1", (400, 400))
    world.generate()

    Util.get().player = player = Player(Util.get().entityModels['player'], world, (world.width / 2, world.height / 2 + 5))

    keys = key.KeyStateHandler()
    window.push_handlers(keys)

    pyglet.gl.glClearColor(0, 40, 200, 0)

    batch = Util.get().batch

    if Util.get().debug:
        debugStats = [  '"FPS: {}".format(pyglet.clock.get_fps())',
                        '"player.x: {}".format(self.player.x)',
                        '"player.y: {}".format(self.player.y)',
                        '"player.vx: {}".format(self.player.vx)',
                        '"player.vy: {}".format(self.player.vy)',
                        '"player.stillJumping: {}".format(self.player.stillJumping)',
                        '"player.againstBlockDown: {}".format(self.player.againstBlockDown)']
        Util.get().addDebugStats(debugStats)

    @window.event
    def on_draw():
        window.clear()
        world.prepareDraw()
        if Util.get().debug:
            Util.get().updateDebugStats()
        player.prepareDraw()
        batch.draw()
        pyglet.image.SolidColorImagePattern(color=(255,255,0,128)).create_image(16, 16).texture.blit(*Util.get().blocksToPixels(player.getClosestBlockDown()))

    def update(self):
        playerJumping = False
        if keys[key.LEFT] or keys[key.A]:
            player.walkLeft()
        if keys[key.RIGHT] or keys[key.D]:
            player.walkRight()
        if keys[key.SPACE]:
            playerJumping = True
            player.jump()
        if keys[key.PLUS] or keys[key.NUM_ADD]:<commit_msg>prevent debug collision blocks from appearing in non-debug mode<commit_after>#!/usr/bin/env python

import getopt, pyglet, sys, time
from pyglet.window import key

from const import Const
from entity import Entity
from model import Model
from player import Player
from util import Util
from world import World

if __name__ == '__main__':
    try:
        opts, args = getopt.getopt(sys.argv[1:], "d")
    except getopt.GetoptError as err:
        print str(err)
        sys.exit(2)

    for o, a in opts:
        if o == "-d":
            Util.get().debug += 1

    Util.get().window = window = pyglet.window.Window(resizable=True)

    Util.get().world = world = World("world1", (400, 400))
    world.generate()

    Util.get().player = player = Player(Util.get().entityModels['player'], world, (world.width / 2, world.height / 2 + 5))

    keys = key.KeyStateHandler()
    window.push_handlers(keys)

    pyglet.gl.glClearColor(0, 40, 200, 0)

    batch = Util.get().batch

    if Util.get().debug:
        debugStats = [  '"FPS: {}".format(pyglet.clock.get_fps())',
                        '"player.x: {}".format(self.player.x)',
                        '"player.y: {}".format(self.player.y)',
                        '"player.vx: {}".format(self.player.vx)',
                        '"player.vy: {}".format(self.player.vy)',
                        '"player.stillJumping: {}".format(self.player.stillJumping)',
                        '"player.againstBlockDown: {}".format(self.player.againstBlockDown)']
        Util.get().addDebugStats(debugStats)

    @window.event
    def on_draw():
        window.clear()
        world.prepareDraw()
        player.prepareDraw()
        if Util.get().debug:
            Util.get().updateDebugStats()
        batch.draw()
        if Util.get().debug:
            pyglet.image.SolidColorImagePattern(color=(255,255,0,128)).create_image(16, 16).texture.blit(*Util.get().blocksToPixels(player.getClosestBlockDown()))

    def update(self):
        playerJumping = False
        if keys[key.LEFT] or keys[key.A]:
            player.walkLeft()
        if keys[key.RIGHT] or keys[key.D]:
            player.walkRight()
        if keys[key.SPACE]:
            playerJumping = True
            player.jump()
        if keys[key.PLUS] or keys[key.NUM_ADD]:
{'fraction_non_alphanumeric': 0.1486095661846496, 'fraction_numerical': 0.015127919911012236, 'mean_word_length': 2.272197962154294, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4577567', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1361, 'n_words': 289}