| 132 | } |
| 133 | |
| 134 | bool GetRandomUnit(Unit& unit_out, const ObservationInterface* observation, UnitTypeID unit_type) { |
| 135 | Units my_units = observation->GetUnits(Unit::Alliance::Self); |
| 136 | std::random_shuffle(my_units.begin(), my_units.end()); // Doesn't work, or doesn't work well. |
| 137 | for (const Unit& unit : my_units) { |
| 138 | if (unit.unit_type == unit_type) { |
| 139 | unit_out = unit; |
| 140 | return true; |
| 141 | } |
| 142 | } |
| 143 | return false; |
| 144 | } |
| 145 | |
| 146 | void MultiplayerBot::PrintStatus(std::string msg) { |
| 147 | int64_t bot_identifier = int64_t(this) & 0xFFFLL; |
no test coverage detected