<commit_before>/**
 * Created by truthlighting on 9/14/2016.
 */
var roleHarvester = require('role.harvester');
var roleUpgrader = require('role.upgrader');
var roleBuilder = require('role.builder');
var roleTower = require('role.tower');
var roleHauler = require('role.hauler');

if (!Memory.hCreepID) {
    Memory.hCreepID = 1;
}
if (!Memory.bCreepID) {
    Memory.bCreepID = 1;
}
if (!Memory.uCreepID) {
    Memory.uCreepID = 1;
}
if (!Memory.cCreepID) {
    Memory.cCreepID = 1;
}

module.exports.loop = function () {

    for(var name in Memory.creeps) {
        if(!Game.creeps[name]) {
            delete Memory.creeps[name];
            console.log('Clearing non-existing creep memory:', name);
        }
    }

    var harvesters = _.filter(Game.creeps, (creep) => creep.memory.role == 'harvester');
//    console.log('Harvesters: ' + harvesters.length);
    var sources = Game.rooms['W2N48'].find(FIND_SOURCES);
    var harvesterSources = _.map(harvesters, 'memory.assignedSource.id');
    console.log("hs: " + harvesterSources + " s: " + sources);
    var source;
    for (var i=0, l=sources.length; i < l; i++) {
        if (harvesterSources.indexOf(sources[i].id) == -1) { source = sources[i]; break; }
    }
    //console.log("source: " + source);
//WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,MOVE
    if(harvesters.length < 2 && Game.spawns['Harmony'].canCreateCreep([WORK,WORK,WORK,WORK,CARRY,MOVE], "H-" + Memory.hCreepID)==OK) {
        var newName = Game.spawns['Harmony'].createCreep([WORK,WORK,WORK,WORK,CARRY,MOVE], "H-" + Memory.hCreepID, {role: 'harvester', assignedSource: source});
        Memory.hCreepID++;
        console.log('Spawning new harvester: ' + newName);
    }

    var haulers = _.filter(Game.creeps, (creep) => creep.memory.role == 'hauler');<commit_msg>debugging main<commit_after>/**
 * Created by truthlighting on 9/14/2016.
 */
var roleHarvester = require('role.harvester');
var roleUpgrader = require('role.upgrader');
var roleBuilder = require('role.builder');
var roleTower = require('role.tower');
var roleHauler = require('role.hauler');

if (!Memory.hCreepID) {
    Memory.hCreepID = 1;
}
if (!Memory.bCreepID) {
    Memory.bCreepID = 1;
}
if (!Memory.uCreepID) {
    Memory.uCreepID = 1;
}
if (!Memory.cCreepID) {
    Memory.cCreepID = 1;
}

module.exports.loop = function () {

    for(var name in Memory.creeps) {
        if(!Game.creeps[name]) {
            delete Memory.creeps[name];
            console.log('Clearing non-existing creep memory:', name);
        }
    }

    var harvesters = _.filter(Game.creeps, (creep) => creep.memory.role == 'harvester');
//    console.log('Harvesters: ' + harvesters.length);
    var sources = Game.rooms['W2N48'].find(FIND_SOURCES);
    var harvesterSources = _.map(harvesters, 'memory.assignedSource.id');
    console.log("hs: " + harvesterSources + " s: " + sources);
    var source;
    for (var i=0, l=sources.length; i < l; i++) {
        if (harvesterSources.indexOf(sources[i].id) == -1) { source = sources[i]; break; }
    }
    //console.log("source: " + source);
//WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,MOVE
    if(harvesters.length < 2 && Game.spawns['Harmony'].canCreateCreep([WORK,WORK,WORK,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,MOVE], "H-" + Memory.hCreepID)==OK) {
        var newName = Game.spawns['Harmony'].createCreep([WORK,WORK,WORK,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,MOVE], "H-" + Memory.hCreepID, {role: 'harvester', assignedSource: source});
        Memory.hCreepID++;
        console.log('Spawning new harvester: ' + newName);
    }

    var haulers = _.filter(Game.creeps, (creep) => creep.memory.role == 'hauler');
{'fraction_non_alphanumeric': 0.17813765182186234, 'fraction_numerical': 0.009176788124156544, 'mean_word_length': 3.7881136950904395, 'pattern_counts': {'":': 0, '<': 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': '427441', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1340, 'n_words': 226}