Opposing side's resources (and a few other questions)

So I know there’s the “Self” but what about the opposing side, which variable stores the number of bits the opposing side might have? Also, what is the variable to see how much stability a firewall has and an example of using it? Another questions is how can you say “if filters in any location are destroyed, do blank”.

A lot of these helpful function are inside the game_state class. For example to get enemy resources you can call:

def get_resource(self, resource_type, player_index = 0):
    """Gets a players resources

    Args:
        * resource_type: self.CORES or self.BITS
        * player_index: The index corresponding to the player whos resources you are querying, 0 for you 1 for the enemy

    Returns:
        The number of the given resource the given player controls

    """

So you could call it with
game_state.get_resource(game_state.CORES, 1)
to get the cores of the enemy player.

For checking how much stability a unit has at a given location you can do:
game_state.game_map[13, 13].stability

The game_map.py and unit.py files have more info

To check if any filter has been destroyed is a bit more complicated I’ll leave that to you :wink:

3 Likes