<commit_before>'use strict';
var util = require('./lib/util');


/**
    Fonction permettant d'ajouter un objet : position, taille et couleur
**/
exports.addObject = function (toAdd, c, object) {
    var radius = c.object.objectRadius;
    while (toAdd--) {

        var position = c.foodUniformDisposition ? util.uniformPosition(object, radius) : util.randomPosition(radius);
        var random = Math.floor(Math.random() * 3) + 1;
        if(random === 1) {
            object.push({
                // Make IDs unique.
                id: ((new Date()).getTime() + '' + object.length) >>> 0,
                x: position.x,
                y: position.y,
                radius: c.object.objectRadius,
                hue: c.object.mineType.fill,
                fill: c.object.mineType.fill,
                stroke: c.object.mineType.stroke,
                strokeWidth: c.object.strokeWidth,
                type: c.object.mineType.name,
                imageUrl: 'img/bomb.png'
            });
        } else if(random === 2) {
            object.push({
                // Make IDs unique.
                id: ((new Date()).getTime() + '' + object.length) >>> 0,
                x: position.x,
                y: position.y,
                radius: c.object.objectRadius,
                hue: c.object.bulletType.fill,
                fill: c.object.bulletType.fill,
                stroke: c.object.bulletType.stroke,
                strokeWidth: c.object.strokeWidth,
                type: c.object.bulletType.name,
                imageUrl: 'img/treature.png'
            });
        } else {
            object.push({
                // Make IDs unique.
                id: ((new Date()).getTime() + '' + object.length) >>> 0,
                x: position.x,
                y: position.y,
                radius: c.object.objectRadius,
                hue: c.object.lifeType.fill,
                fill: c.object.lifeType.fill,
                stroke: c.object.lifeType.stroke,
                strokeWidth: c.object.strokeWidth,
                type: c.object.lifeType.name,
                imageUrl: 'img/life.png'
            });
        }
        
    }

};


/**
    Fonction s'occupant de la generation d'objet en fonction des objets restant
    fait un ratio entre objet max et objet restant.
**/

/** Simple suppression d'objet **/
exports.removeObject = function(toRem) {
    while (toRem--) {
        Object.pop();
    }
};
/** Test de collision **/
exports.funcObject = function (f) {
    return SAT.pointInCircle(new SATVector(f.x, f.y), playerCircle);
};
/** Suppression d'objet **/
exports.deleteObject = function (f) {
    object[f] = {};
    object.splice(f, 1);
};<commit_msg>Code cleaning<commit_after>'use strict';
var util = require('./lib/util');


/**
 Fonction permettant d'ajouter un objet : position, taille et couleur
 **/
exports.addObject = function (toAdd, configuration, object) {
    var radius = configuration.object.objectRadius;
    while (toAdd--) {

        var position = configuration.foodUniformDisposition ? util.uniformPosition(object, radius) : util.randomPosition(radius);
        var random = Math.floor(Math.random() * 3) + 1;
        if (random === 1) {
            object.push({
                // Make IDs unique.
                id: ((new Date()).getTime() + '' + object.length) >>> 0,
                x: position.x,
                y: position.y,
                radius: configuration.object.objectRadius,
                hue: configuration.object.mineType.fill,
                fill: configuration.object.mineType.fill,
                stroke: configuration.object.mineType.stroke,
                strokeWidth: configuration.object.strokeWidth,
                type: configuration.object.mineType.name,
                imageUrl: 'img/bomb.png'
            });
        } else if (random === 2) {
            object.push({
                // Make IDs unique.
                id: ((new Date()).getTime() + '' + object.length) >>> 0,
                x: position.x,
                y: position.y,
                radius: configuration.object.objectRadius,
                hue: configuration.object.bulletType.fill,
                fill: configuration.object.bulletType.fill,
                stroke: configuration.object.bulletType.stroke,
                strokeWidth: configuration.object.strokeWidth,
                type: configuration.object.bulletType.name,
                imageUrl: 'img/treature.png'
            });
        } else {
            object.push({
                // Make IDs unique.
                id: ((new Date()).getTime() + '' + object.length) >>> 0,
                x: position.x,
                y: position.y,
                radius: configuration.object.objectRadius,
                hue: configuration.object.lifeType.fill,
                fill: configuration.object.lifeType.fill,
                stroke: configuration.object.lifeType.stroke,
                strokeWidth: configuration.object.strokeWidth,
                type: configuration.object.lifeType.name,
                imageUrl: 'img/life.png'
            });
        }

    }

};


/**
 Fonction s'occupant de la generation d'objet en fonction des objets restant
 fait un ratio entre objet max et objet restant.
 **/

/** Simple suppression d'objet **/
exports.removeObject = function (toRemove) {
    while (toRemove--) {
        Object.pop();
    }
};
/** Test de collision **/
exports.funcObject = function (object) {
    return SAT.pointInCircle(new SATVector(object.x, object.y), playerCircle);
};
/** Suppression d'objet **/
exports.deleteObject = function (object) {
    object[object] = {};
    object.splice(object, 1);
};
{'fraction_non_alphanumeric': 0.12790697674418605, 'fraction_numerical': 0.0028188865398167725, 'mean_word_length': 1.6930740037950665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '7180638', 'n_tokens_mistral': 1632, 'n_tokens_neox': 1535, 'n_words': 342}