<commit_before>(function() {
    'use strict';

    var Game = window.Game = window.Game || {};

    //
    // The main state holding class for the game.
    // It deals with input and rendering.
    //

    // Create a game screen.
    // The startingState must be a world state message.
    // The socket must be of type Game.Socket.
    Game.GameScreen = function(playerId, playerSize, bulletSize, startingState, socket) {
        var state = startingState;
        var keymap = {};
        var self = this;

        // Get the current player entity or null if you are dead.
        var getPlayer = function() {
            var temp = state.alivePlayers.filter(function(player) {
                return player.id === playerId;
            });

            return temp[0] || null;
        }

        // Update your movement vector in correspondance to the currently pressed keys.
        var updateMoving = function(){
            var move_x = 0;
            var move_y = 0;

            if (keymap[Game.INPUT_MOVE_UP]) {
                move_y += -1;
            }
            if (keymap[Game.INPUT_MOVE_DOWN]) {
                move_y += 1;
            }
            if (keymap[Game.INPUT_MOVE_LEFT]) {
                move_x += -1;
            }
            if (keymap[Game.INPUT_MOVE_RIGHT]) {
                move_x += 1;
            }

            if move_x === 0 && move_y === 0 {
                socket.stopMoving();
            } else {
                socket.startMoving(Game.makeVector(move_x, move_y));
            }
        };

        // Process a mouse click
        self.onMouseClick = function(x, y, type) {
            var player = getPlayer();

            if (player == null) {
                return;
            }

            var dx = x - player.position.x;
            var dy = y - player.position.y;


            socket.fire(Game.makeVector(dx, dy));
        }

        // Process a key down event
        self.onKeyDown = function(key) {
            keymap[key] = true;
            updateMoving();
        };
<commit_msg>Fix gamescreen.js<commit_after>(function() {
    'use strict';

    var Game = window.Game = window.Game || {};

    //
    // The main state holding class for the game.
    // It deals with input and rendering.
    //

    // Create a game screen.
    // The startingState must be a world state message.
    // The socket must be of type Game.Socket.
    Game.GameScreen = function(playerId, playerSize, bulletSize, startingState, socket) {
        var state = startingState;
        var keymap = {};
        var self = this;

        // Get the current player entity or null if you are dead.
        var getPlayer = function() {
            var temp = state.alivePlayers.filter(function(player) {
                return player.id === playerId;
            });

            return temp[0] || null;
        }

        // Update your movement vector in correspondance to the currently pressed keys.
        var updateMoving = function(){
            var move_x = 0;
            var move_y = 0;

            if (keymap[Game.INPUT_MOVE_UP]) {
                move_y += -1;
            }
            if (keymap[Game.INPUT_MOVE_DOWN]) {
                move_y += 1;
            }
            if (keymap[Game.INPUT_MOVE_LEFT]) {
                move_x += -1;
            }
            if (keymap[Game.INPUT_MOVE_RIGHT]) {
                move_x += 1;
            }

            if (move_x === 0 && move_y === 0) {
                socket.stopMoving();
            } else {
                socket.startMoving(Game.makeVector(move_x, move_y));
            }
        };

        // Process a mouse click
        self.onMouseClick = function(x, y, type) {
            var player = getPlayer();

            if (player == null) {
                return;
            }

            var dx = x - player.position.x;
            var dy = y - player.position.y;


            socket.fire(Game.makeVector(dx, dy));
        }

        // Process a key down event
        self.onKeyDown = function(key) {
            keymap[key] = true;
            updateMoving();
        };

{'fraction_non_alphanumeric': 0.1069167072576717, 'fraction_numerical': 0.00438382854359474, 'mean_word_length': 1.3562822719449226, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4969853', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1114, 'n_words': 315}