code: def _prepare_step(self, state):
          
          self.state: GameState = state
          # Required for events
          self._units_previous_map.clear()
          for unit in self.units:
              self._units_previous_map[unit.tag] = unit
  
          self.units: Units = state.own_units
          self.workers: Units = self.units(race_worker[self.race])
          self.townhalls: Units = self.units(race_townhalls[self.race])
          self.geysers: Units = self.units(race_gas[self.race])
  
          self.minerals: Union[float, int] = state.common.minerals
          self.vespene: Union[float, int] = state.common.vespene
          self.supply_used: Union[float, int] = state.common.food_used
          self.supply_cap: Union[float, int] = state.common.food_cap
          self.supply_left: Union[float, int] = self.supply_cap - self.supply_used
          # reset cached values
          self.cached_known_enemy_structures = None
          self.cached_known_enemy_units = None
docs: Set attributes from new state before on_step.