How do I get the information, where every single enemy information unit is positioned every frame?
It is very similar to getting information from every turn. If you look in the AlgoCore class you will see this code:
if stateType == 0: """ This is the game turn game state message. Algo must now print to stdout 2 lines, one for build phase one for deploy phase. Printing is handled by the provided functions. """ self.on_turn(game_state_string) elif stateType == 1: """ If stateType == 1, this game_state_string string represents the results of an action phase """ # add a new function here, for example: self.on_frame(game_state_string)
You can see where I added a comment saying add a new function. That function would be called every single frame and you could do things with the information the same way you would with the beginning of each round.
You would have to create that function
on_frame() inside the AlgoCore class like so:
def on_frame(self, game_state_string): pass
And then you could use it in your AlgoStrategy class and do whatever you want inside it. You need to create it in AlgoCore so it knows the function exists, and then you can code an implementation inside AlgoStrategy the same way you do with
ok thanks, so now I can analyse every frame?
How do I get the positions of the enemy information units?
Sorry if this is a dumb question.
Utilize the on_frame() function (which you need to implement and write as described above) to analyze each frame. What you’ll have is a game_state_string which can be parsed into a game_state, which you’re familiar with. Parsing the string is no different than what happens in the on_turn function, so there’s nothing new to write there (copy/paste). Once you have a game_state, the logic is all the same, so to gather all the unit locations, just iterate over the game_map and take note of all the game unit locations, if that’s what you want to do with it.