added expected log

This commit is contained in:
Tyrel Souza 2016-06-29 14:42:30 -04:00
parent be4b33d728
commit 02a08d2d8d
No known key found for this signature in database
GPG Key ID: 2EECB5087209E6A5

22
main.js
View File

@ -8,7 +8,7 @@ var creepRolePriority = ['harvester', 'builder', 'upgrader', 'guard'];
var creepsConfig = {
harvester: {
bodyParts: [WORK, CARRY, MOVE, MOVE, MOVE],
minimumCreeps: 2,
minimumCreeps: 3,
role: roleHarvester
},
builder: {
@ -18,12 +18,12 @@ var creepsConfig = {
},
upgrader: {
bodyParts: [WORK, CARRY, MOVE, MOVE, MOVE],
minimumCreeps: 3,
minimumCreeps: 4,
role: roleUpgrader
},
guard: {
bodyParts: [TOUGH, MOVE, ATTACK, MOVE, ATTACK],
minimumCreeps: 2,
minimumCreeps: 3,
role: roleGuard
}
};
@ -59,12 +59,8 @@ module.exports.loop = function(){
}
// Run stuff for each creep
var roleCounts = {
builder: 0,
harvester: 0,
upgrader: 0,
guard: 0
}
var roleCounts = { builder: 0, harvester: 0, upgrader: 0, guard: 0 }
var expected = { builder: 0, harvester: 0, upgrader: 0, guard: 0 }
for (var name in Game.creeps){
var creep = Game.creeps[name];
var role = creep.memory.role;
@ -72,6 +68,10 @@ module.exports.loop = function(){
creepsConfig[role].role.run(creep);
}
console.log(JSON.stringify(roleCounts));
for (var role in creepsConfig){
expected[role] = creepsConfig[role].minimumCreeps;
}
console.log("current:", JSON.stringify(roleCounts));
console.log("expect: ", JSON.stringify(expected));
console.log("#############################################################");
};
};