You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for (autoi(0); i< response->game_info().player_info_size(); ++i)
{
constauto& playerID = ActualObservation.player_common().player_id();
constauto& playerInfo = response->game_info().player_info(i);
if(playerInfo.player_id() == playerID && playerInfo.race_actual()==SC2APIProtocol::Race::Terran)
{
size_t totalHealth = 0U;
for (autoii(0); ii< ActualObservation.raw_data().units_size(); ++ii)
{
constauto unit = ActualObservation.raw_data().units(ii);
if (unit.alliance() != SC2APIProtocol::Alliance::Self)
{
continue;
}
// This can be abused. Hide a worker somewhere.// But the solution is proper seek and destroy code of the attacker.// And it would gain nothing because a tie is a tie.if (!unit.is_flying())
{
lastGameLoopWithNonFlyer = currentGameLoop;
break;
}
else
{
totalHealth+=unit.health();
}
}
// If the flying building(s) gets attacked it is not a stalemateif (totalHealth_old != totalHealth)
{
totalHealth_old = totalHealth;
lastGameLoopWithNonFlyer = currentGameLoop;
}
}
}
if (currentGameLoop - lastGameLoopWithNonFlyer > maxLoopsWithoutNonFlyer)
{
std::cout << "DETECTED STALEMATE!!!!" << std::endl;
CurrentExitCase = ExitCase::Stalemate;
}
Did I miss an obvious or not so obvious corner case?
Should be possible to detect if there are only flying buildings. From that moment start a timer of X minutes until draw.
The text was updated successfully, but these errors were encountered: