<commit_before>var obstacleGenerator = {
    addObstacleToBack: function() {
        var obstacle = this.makeRandomObstacle();
        var lastObstacle = objects.obstacles[objects.obstacles.length - 1];
        objects.obstacles.push(obstacle);
        var newX = this.findBack(lastObstacle, game.world.width, calculateDifficultyModifier(gameState.score), Math);
        obstacle.moveToX(newX);
        obstacle.hasScored = false;
        this.onObstacleAdded.dispatch(newX, lastObstacle);
    },

    findBack: function(lastInList, screenEdge, difficultyModifier, math) {
        var minBuffer = lastInList ? lastInList.minimumSpaceBehind : 0;
        var newX = screenEdge + minBuffer;
        newX += difficultyModifier;
        newX += math.random() * constants.runnerSize;
        if (math.random() > 0.7) {
            // Randomly add a big-ish gap
            newX += constants.runnerSize * 2;
        }

        return newX;
    },

    onObstacleAdded: new Phaser.Signal(),

    makeRandomObstacle: function() {
        var index = Math.floor(Math.random() * (objects.polygonPrototypes.length));
        var prototype = objects.polygonPrototypes[index];
        return new Obstacle(new ExtendedPolygon(prototype.polygon(), prototype.color), prototype.minimumSpaceBehind, prototype.name);
    }
};

var calculateDifficultyModifier = function(currentScore) {
    return Math.pow(7/10, currentScore) * 200;
};

function Obstacle(thingToExtend, minimumSpaceBehind, name) {
    thingToExtend.minimumSpaceBehind = minimumSpaceBehind;
    thingToExtend.name = name;
    thingToExtend.runnerLandCallback = function() {
        thingToExtend.vspeed = -4 * constants.chargeEffects[gameState.lastJump.chargeLevel];
    };
    objects.runner.onLand.add(thingToExtend.runnerLandCallback);
    return thingToExtend;
}<commit_msg>juice - obstacles have a bit of randomness to their hops to make the sounds less static<commit_after>var obstacleGenerator = {
    addObstacleToBack: function() {
        var obstacle = this.makeRandomObstacle();
        var lastObstacle = objects.obstacles[objects.obstacles.length - 1];
        objects.obstacles.push(obstacle);
        var newX = this.findBack(lastObstacle, game.world.width, calculateDifficultyModifier(gameState.score), Math);
        obstacle.moveToX(newX);
        obstacle.hasScored = false;
        this.onObstacleAdded.dispatch(newX, lastObstacle);
    },

    findBack: function(lastInList, screenEdge, difficultyModifier, math) {
        var minBuffer = lastInList ? lastInList.minimumSpaceBehind : 0;
        var newX = screenEdge + minBuffer;
        newX += difficultyModifier;
        newX += math.random() * constants.runnerSize;
        if (math.random() > 0.7) {
            // Randomly add a big-ish gap
            newX += constants.runnerSize * 2;
        }

        return newX;
    },

    onObstacleAdded: new Phaser.Signal(),

    makeRandomObstacle: function() {
        var index = Math.floor(Math.random() * (objects.polygonPrototypes.length));
        var prototype = objects.polygonPrototypes[index];
        return new Obstacle(new ExtendedPolygon(prototype.polygon(), prototype.color), prototype.minimumSpaceBehind, prototype.name);
    }
};

var calculateDifficultyModifier = function(currentScore) {
    return Math.pow(7/10, currentScore) * 200;
};

function Obstacle(thingToExtend, minimumSpaceBehind, name) {
    thingToExtend.minimumSpaceBehind = minimumSpaceBehind;
    thingToExtend.name = name;
    thingToExtend.runnerLandCallback = function() {
        thingToExtend.vspeed = -4 + Math.random() * constants.chargeEffects[gameState.lastJump.chargeLevel];
    };
    objects.runner.onLand.add(thingToExtend.runnerLandCallback);
    return thingToExtend;
}
{'fraction_non_alphanumeric': 0.10567148207597646, 'fraction_numerical': 0.006420545746388443, 'mean_word_length': 3.3628938156359394, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4199330', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1114, 'n_words': 210}