<commit_before><commit_msg>reserver role<commit_after>var roleReserver = {

    /** @param {Creep} creep **/
    run: function(creep) {
        var hownSpawn = Game.getObjectById(creep.memory.homeSpawn);
        var targetRoomPosition = Game.getObjectById(creep.memory.targetRoomPosition);
        
        if(creep.carry.energy < creep.carryCapacity) {
            source = hownSpawn.room.find(FIND_STRUCTURES, {
                    filter: (structure) => {
                        return (structure.structureType == STRUCTURE_STORAGE)}}
            if(creep.harvest(source[0]) == ERR_NOT_IN_RANGE) {
                creep.moveTo(source[0], {visualizePathStyle: {stroke: '#ffaa00'}});
            }
	      }
        else
        {
            if(creep.room.name != targetRoomPosition.name)
            {
                creep.moveTo(targetRoomPosition, {visualizePathStyle: {stroke: '#ffaa00'}});
            }
            else
            {
                controller = hownSpawn.room.find(FIND_STRUCTURES, {
                    filter: (structure) => {
                        return (structure.structureType == STRUCUTRE_CONTROLLER)}}
                if(creep.reserveController(controller[0]) == ERR_NOT_IN_RANGE) {
                    creep.moveTo(controller[0], {visualizePathStyle: {stroke: '#ffaa00'}});
                }        
            }
        }
     }
};

module.exports = roleReserver;

{'fraction_non_alphanumeric': 0.11965811965811966, 'fraction_numerical': 0.007122507122507123, 'mean_word_length': 1.821285140562249, 'pattern_counts': {'":': 0, '<': 4, '<?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': '2799358', 'n_tokens_mistral': 428, 'n_tokens_neox': 414, 'n_words': 52}