MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / OnStep

Method OnStep

examples/bot_simple.cc:20–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 };
19
20 virtual void OnStep() final {
21 uint32_t game_loop = Observation()->GetGameLoop();
22
23 if (game_loop % 100 == 0) {
24 sc2::Units units = Observation()->GetUnits(sc2::Unit::Alliance::Self);
25 for (auto& it_unit : units) {
26 sc2::Point2D target = sc2::FindRandomLocation(Observation()->GetGameInfo());
27 Actions()->UnitCommand(it_unit, sc2::ABILITY_ID::SMART, target);
28 }
29 }
30 };
31
32 virtual void OnGameEnd() final {
33 ++restarts_;

Callers

nothing calls this directly

Calls 5

ObservationClass · 0.85
FindRandomLocationFunction · 0.85
GetGameLoopMethod · 0.80
GetUnitsMethod · 0.80
UnitCommandMethod · 0.80

Tested by

no test coverage detected