我们第一战设定为编写一个2BB的战术,如果成功的话1V1电脑应该没有问题,尤其是TVZ。
首先我们要11农民的时候造一个兵营
//If we have at least 11 SCVs and we have not built barracks before
if ((bwapi.getSelf().getSupplyUsed() == 22)){
//Check if we have enough minerals for a barrack
if (bwapi.getSelf().getMinerals() >= 150){
int worker = getNearestUnit(UnitTypes.Terran_SCV.ordinal(), homePositionX, homePositionY);
if (worker != -1) {
// if we found him, try to select appropriate build tile position for a barrack, near home. We will change it to choke point later
Point buildTile = getBuildTile(worker, UnitTypes.Terran_Barracks.ordinal(), homePositionX, homePositionY);
//if we found a good build position
if (buildTile.x != -1) {
firstbb = 0;
bwapi.build(worker, buildTile.x, buildTile.y, UnitTypes.Terran_Barracks.ordinal());
}
}
}
}
这里模仿的是造房子的代码。为什