Skip to content

Commit 6e65786

Browse files
committed
separate units of game state
extra pylon remover patch vespene move
1 parent 4e13ae2 commit 6e65786

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

BOBuilder.cpp

+16-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ namespace suboo {
5656
GameState state = tech.getInitial();
5757
BuildOrder bopre;
5858
std::unordered_set<UnitId> seen;
59-
for (auto & u : state.getUnits()) {
59+
for (auto & u : state.getFreeUnits()) {
60+
seen.insert(u.type);
61+
}
62+
for (auto & u : state.getBusyUnits()) {
6063
seen.insert(u.type);
6164
}
6265
int sz = bo.getItems().size();
@@ -117,7 +120,10 @@ namespace suboo {
117120
GameState state = tech.getInitial();
118121
BuildOrder bopre;
119122
std::unordered_set<UnitId> seen;
120-
for (auto & u : state.getUnits()) {
123+
for (auto & u : state.getFreeUnits()) {
124+
seen.insert(u.type);
125+
}
126+
for (auto & u : state.getBusyUnits()) {
121127
seen.insert(u.type);
122128
}
123129
int vesp=0;
@@ -164,6 +170,7 @@ namespace suboo {
164170
optimizers.emplace_back(new AddProduction());
165171
optimizers.emplace_back(new LeftShifter());
166172
fastoptimizers.emplace_back(new LeftShifter());
173+
fastoptimizers.emplace_back(new RemoveExtra());
167174
optimizers.emplace_back(new AddVespeneGatherer());
168175

169176

@@ -292,17 +299,23 @@ namespace suboo {
292299
int soongas = 0;
293300

294301
int vcount =0;
295-
for (auto & u : gs.getUnits()) {
302+
for (auto & u : gs.getFreeUnits()) {
296303
if (u.state == UnitInstance::MINING_VESPENE) {
297304
vcount++;
298305
}
299306
else if (u.type == UnitId::PROTOSS_ASSIMILATOR && u.state == UnitInstance::FREE) {
300307
gas++;
301308
}
309+
}
310+
for (auto & u : gs.getBusyUnits()) {
311+
if (u.state == UnitInstance::MINING_VESPENE) {
312+
vcount++;
313+
}
302314
else if (u.type == UnitId::PROTOSS_ASSIMILATOR) {
303315
soongas++;
304316
}
305317
}
318+
306319
if (vcount >= 3 * (gas+soongas)) {
307320
std::cout << "Gas over saturated skipping \n";
308321
//gs.print(std::cout);

0 commit comments

Comments
 (0)