<commit_before>'use strict';

function generation_level(time) {
    /*INITIALISATION */
    var high = 0;
    var pattern = [];
    var i = 0;

    while (i < time) {								//put an obstacle all the 5secs
        var rand = Math.floor((Math.random() * 2) + 1); // Random between 1 and 2 .
        if (rand == 2) {
            if (high <= 4) {			//the maximum high for a player is 4. can be change.
                high++;
            }
        } else {
            if (high != 0) {
                high--;
            }
        }
        var item = {
            "input": rand,				//1 -> down  2-> up.
            "high": high,				//the high of the player (for a graphical game).
            "time": i					//time when the obstacle pop.
        };

        pattern.push(item);

        var delay = computDelay(0, 1);

        i = i + delay;					//TODO maybe a better random.


    }

    return JSON.stringify({level: pattern});


}

function computDelay(min, max) {

    return Math.floor((Math.random() * (max - min)) + 1);

}

<commit_msg>ajout de id pour la generation de level<commit_after>'use strict';

function generation_level(time) {
    /*INITIALISATION */
    var high = 0;
    var pattern = [];
    var i = 0;
	var cmp = 0;

    while (i < time) {								//put an obstacle all the 5secs
        var rand = Math.floor((Math.random() * 2) + 1); // Random between 1 and 2 .
        if (rand == 2) {
            if (high <= 4) {			//the maximum high for a player is 4. can be change.
                high++;
            }
        } else {
            if (high != 0) {
                high--;
            }
        }
        var item = {
			"id": cmp,
            "input": rand,				//1 -> down  2-> up.
            "high": high,				//the high of the player (for a graphical game).
            "time": i					//time when the obstacle pop.
        };

        pattern.push(item);

        var delay = computDelay(0, 1);

        i = i + delay;					//TODO maybe a better random.
		cmp++;

    }

    return JSON.stringify({level: pattern});


}

function computDelay(min, max) {

    return Math.floor((Math.random() * (max - min)) + 1);

}


{'fraction_non_alphanumeric': 0.13932898415657036, 'fraction_numerical': 0.01537744641192917, 'mean_word_length': 1.4123595505617978, 'pattern_counts': {'":': 7, '<': 7, '<?xml version=': 0, '>': 7, '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': '6862309', 'n_tokens_mistral': 748, 'n_tokens_neox': 657, 'n_words': 223}