Can you check enemy coordinates for specific firewall units?

I’ve been experimenting with making my algo adaptive, but i ran into a problem. I wanted to spawn information units based on locations of enemy destructors, but i could only figure out how to use contains_stationary_unit, is there a way to specify certain units to check a given location for?

You can modify the function you mentioned:

def contains_unit_of_type(self, type, location):
	x, y = map(int, location)
	if self.game_map[x,y] == None: return False
	for unit in self.game_map[x,y]:
		if unit.unit_type == type:
			return unit
	return False

where if you called game_state.contains_unit_of_type(DESTRUCTOR, location) it would work the same as contains_stationary_unit but with that specific type.


oh thanks, and would i put that in algostrategy or a edit a different file?

You would put it in GameState (gamelib/, hence the call game_state.contains_unit_of_type(DESTRUCTOR, location) because it should be part of the GameState class, just like contains_stationary_unit.

1 Like

yeah i figured, just wanted to make sure, thanks again, this was a big help.