added expected log
This commit is contained in:
parent
be4b33d728
commit
02a08d2d8d
20
main.js
20
main.js
@ -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("#############################################################");
|
||||
};
|
Loading…
Reference in New Issue
Block a user