<commit_before>var PhysicsEngines = (function() {

    var StandartPhysicsEngine = function() {

        function init(inputProvider) {
            this.inputProvider = inputProvider;
            this.world = {
                x: 640,
                y: 480
            };
            return this;
        }

        function updateState(worldObjects) {
            updateSnake.call(this, worldObjects.snake);
        }

        function updateSnake(snake) {
            var input = this.inputProvider.getDirection();
            var updateX = 1,
                updateY = 1;

            function checkCollision() {
                if (snake.headX < 0 || this.world.x < snake.headX ) {
                    return true;
                }

                if (snake.headY < 0 || this.world.y < snake.headY ) {
                    return true;
                }
                return false;
            }

            if (!(input === 'other' || input === '')) {
                snake.direction = this.inputProvider.getDirection();
            }

            switch (snake.direction) {
                case 'up':
                    updateX = 0;
                    updateY *= -1;
                    break;
                case 'right':
                    updateY = 0;
                    break;
                case 'down':
                    updateX = 0;
                    break;
                case 'left':
                    updateX *= -1;
                    updateY = 0;
                    break;
            }

            for (var i = 0; i < snake.speed; i++) {
                snake.tail.push({
                    x: snake.headX + updateX,
                    y: snake.headY + updateY
                });
                snake.headX += updateX;
                snake.headY += updateY;

                if (snake.tail.length > snake.length) {
                    snake.tail.shift();
                }
            }

            if (checkCollision.call(this)) {
                Globals.gameOver = true;
            }
        }

        return {
            init: init,
            updateState: updateState
        }
    }();

    return {
        StandartPhysicsEngine: StandartPhysicsEngine
    }

}());<commit_msg>Renamed method<commit_after>var PhysicsEngines = (function() {

    var StandartPhysicsEngine = function() {

        function init(inputProvider) {
            this.inputProvider = inputProvider;
            this.world = {
                x: 640,
                y: 480
            };
            return this;
        }

        function updateState(worldObjects) {
            updateSnake.call(this, worldObjects.snake);
        }

        function updateSnake(snake) {
            var input = this.inputProvider.getDirection();
            var updateX = 1,
                updateY = 1;

            function isOutOfWorld() {
                if (snake.headX < 0 || this.world.x < snake.headX ) {
                    return true;
                }

                if (snake.headY < 0 || this.world.y < snake.headY ) {
                    return true;
                }
                return false;
            }

            if (!(input === 'other' || input === '')) {
                snake.direction = this.inputProvider.getDirection();
            }

            switch (snake.direction) {
                case 'up':
                    updateX = 0;
                    updateY *= -1;
                    break;
                case 'right':
                    updateY = 0;
                    break;
                case 'down':
                    updateX = 0;
                    break;
                case 'left':
                    updateX *= -1;
                    updateY = 0;
                    break;
            }

            for (var i = 0; i < snake.speed; i++) {
                snake.tail.push({
                    x: snake.headX + updateX,
                    y: snake.headY + updateY
                });
                snake.headX += updateX;
                snake.headY += updateY;

                if (snake.tail.length > snake.length) {
                    snake.tail.shift();
                }
            }

            if (isOutOfWorld.call(this)) {
                Globals.gameOver = true;
            }
        }

        return {
            init: init,
            updateState: updateState
        }
    }();

    return {
        StandartPhysicsEngine: StandartPhysicsEngine
    }

}());
{'fraction_non_alphanumeric': 0.09827238052501683, 'fraction_numerical': 0.007628449629795826, 'mean_word_length': 0.9116638078902229, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, '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': '4791454', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1082, 'n_words': 231}