Esempio n. 1
0
 def get_action(self, obs):
     if FUNCTIONS.Move_screen.id in obs.observation.available_actions:
         player_relative = obs.observation.feature_screen.player_relative
         beacon = _xy_locs(player_relative == _PLAYER_NEUTRAL)
         if not beacon:
             return FUNCTIONS.no_op()
         beacon_center = np.mean(beacon, axis=0).round().astype(int)
         return FUNCTIONS.Move_screen("now", beacon_center)
     else:
         return FUNCTIONS.select_army("select")
Esempio n. 2
0
    def get_action(self, obs):
        if FUNCTIONS.Attack_screen.id in obs.observation.available_actions:
            player_relative = obs.observation.feature_screen.player_relative
            roaches = _xy_locs(player_relative == _PLAYER_ENEMY)
            if not roaches:
                return FUNCTIONS.no_op()

            # Find the roach with max y coord.
            target = roaches[np.argmax(np.array(roaches)[:, 1])]
            return FUNCTIONS.Attack_screen("now", target)
        else:
            return FUNCTIONS.no_op()
Esempio n. 3
0
def get_enemy_entities_locations(obs):
    self_entities = obs.observation.feature_screen.player_relative == features.PlayerRelative.ENEMY
    return _xy_locs(self_entities)
Esempio n. 4
0
def get_neutral_entities_locations(obs):
    self_entities = obs.observation.feature_screen.player_relative == features.PlayerRelative.NEUTRAL
    return _xy_locs(self_entities)