for (Region neut : visibleRegions){
if (neut.ownedByPlayer("neutral") && getSubRegionsOwnedByPlayerName(neut.getSuperRegion(), opponentName).isEmpty()){
if ( getSubRegionsOwnedByPlayerName(neut.getSuperRegion(),myName).size()==neut.getSuperRegion().getSubRegions().size()-1 ){
priorityNeutralRegions_0.add(neut);
}
else if ( getSubRegionsOwnedByPlayerName(neut.getSuperRegion(), myName).size()==neut.getSuperRegion().getSubRegions().size()-2 ){
priorityNeutralRegions_1.add(neut);
}
else{
for (Region neig : neut.getNeighbors()){
if ( neig.getSuperRegion().ownedByPlayer(myName)){
priorityNeutralRegions_2.add(neut);
break;
}
}
}
else if ( !getSubRegionsOwnedByPlayerName(neut.getSuperRegion(), myName).isEmpty()){
priorityNeutralRegions_3.add(neut);
}
else{
priorityNeutralRegions_4.add(neut);
}
}
}
答案 0 :(得分:1)
包装函数中的循环,将该函数作为else if
条件的一部分调用。