<commit_before>var harvester = require('harvester');
var miner = require('miner');
var collecter = require('collector');
var builder = require('builder');
var guard = require('guard');
var attacker = require('attacker');
var rangedattacker = require('rangedattacker');


Spawn.prototype.createRole = function(role) {
    return this.createCreep(roles[role], null, {role: role});
};

Creep.prototype.isSafe = function(position) {
    return position.findInRange(FIND_HOSTILE_CREEPS, 5).length == 0
        && position.findInRange(FIND_HOSTILE_STRUCTURES, 5).length == 0;
}

var getTarget = function(creep) {
    var target = null;
    var creepTarget = creep.pos.findClosest(FIND_HOSTILE_CREEPS);
    var structTarget = creep.pos.findClosest(FIND_HOSTILE_STRUCTURES);
    if (!structTarget) {
        target = creepTarget;
    } else if (!creepTarget) {
        target = structTarget;
    } else {
        creepTargetDist = creep.pos.findPathTo(creepTarget);
        structTargetDist = creep.pos.findPathTo(structTarget);
        if (creepTargetDist < structTargetDist + 5) {
            target = creepTarget;
        } else{ 
            target = structTarget;
        }
    }
    return target;
}

var roles = {
    'miner': [MOVE, WORK, WORK, WORK, WORK],
    'collector': [MOVE, MOVE, CARRY, CARRY, CARRY],
    'harvester': [MOVE, MOVE, CARRY, WORK],
    'builder': [WORK, WORK, CARRY, CARRY, MOVE],
    'guard': [TOUGH, MOVE, ATTACK, ATTACK, ATTACK],
    'attack': [TOUGH, ATTACK, ATTACK, MOVE, MOVE],
    'rangedattack': [TOUGH, MOVE, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK],
    'upgrader': [MOVE, WORK, WORK, WORK, WORK],
    'upgraderhelper': [MOVE, MOVE, CARRY, CARRY, CARRY],
}

var desiredRoles = {
    'miner': 1,
    'collector': 5,
    'guard': 2,
    'attack': 0,
    'builder': 3,
    'rangedattack': 0,
    'upgrader': 1,
    'upgraderhelper': 2,
}<commit_msg>Give upgraders a CARRY part<commit_after>var harvester = require('harvester');
var miner = require('miner');
var collecter = require('collector');
var builder = require('builder');
var guard = require('guard');
var attacker = require('attacker');
var rangedattacker = require('rangedattacker');


Spawn.prototype.createRole = function(role) {
    return this.createCreep(roles[role], null, {role: role});
};

Creep.prototype.isSafe = function(position) {
    return position.findInRange(FIND_HOSTILE_CREEPS, 5).length == 0
        && position.findInRange(FIND_HOSTILE_STRUCTURES, 5).length == 0;
}

var getTarget = function(creep) {
    var target = null;
    var creepTarget = creep.pos.findClosest(FIND_HOSTILE_CREEPS);
    var structTarget = creep.pos.findClosest(FIND_HOSTILE_STRUCTURES);
    if (!structTarget) {
        target = creepTarget;
    } else if (!creepTarget) {
        target = structTarget;
    } else {
        creepTargetDist = creep.pos.findPathTo(creepTarget);
        structTargetDist = creep.pos.findPathTo(structTarget);
        if (creepTargetDist < structTargetDist + 5) {
            target = creepTarget;
        } else{ 
            target = structTarget;
        }
    }
    return target;
}

var roles = {
    'miner': [MOVE, WORK, WORK, WORK, WORK],
    'collector': [MOVE, MOVE, CARRY, CARRY, CARRY],
    'harvester': [MOVE, MOVE, CARRY, WORK],
    'builder': [WORK, WORK, CARRY, CARRY, MOVE],
    'guard': [TOUGH, MOVE, ATTACK, ATTACK, ATTACK],
    'attack': [TOUGH, ATTACK, ATTACK, MOVE, MOVE],
    'rangedattack': [TOUGH, MOVE, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK],
    'upgrader': [MOVE, WORK, WORK, WORK, CARRY],
    'upgraderhelper': [MOVE, MOVE, CARRY, CARRY, CARRY],
}

var desiredRoles = {
    'miner': 1,
    'collector': 5,
    'guard': 2,
    'attack': 0,
    'builder': 3,
    'rangedattack': 0,
    'upgrader': 1,
    'upgraderhelper': 2,
}
{'fraction_non_alphanumeric': 0.1455411484519714, 'fraction_numerical': 0.006880127017729558, 'mean_word_length': 3.570737605804111, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2661289', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1324, 'n_words': 298}