This is what im using to get enemy attackers first positions
def getPosofEnemyAttackers(self,game_state):
Enemy_Attackers = []
if game_state.turn_number!=0:
for unit in all_turn_states[game_state.turn_number -1][0][“p2Units”][3]:
Enemy_Attackers.append([unit[0],unit[1]])
for unit in all_turn_states[game_state.turn_number -1][0][“p2Units”][4]:
Enemy_Attackers.append([unit[0],unit[1]])
for unit in all_turn_states[game_state.turn_number -1][0][“p2Units”][5]:
Enemy_Attackers.append([unit[0],unit[1]])
gamelib.debug_write(Enemy_Attackers)
and it all works well, i used gamelib.debug_write(enemy_attackers) after the for loops to see. It outputted this, which is what I wanted:
[[15, 26], [15, 26], [15, 26], [15, 26], [15, 26], [15, 26], [15, 26], [15, 26]]
Then i called it in my defense algorithm:
def defenseAlgorithm(self,game_state):
self.getPosofEnemyAttackers(game_state)
units_to_place = []
gamelib.debug_write(“If next is [] then i confused”)
gamelib.debug_write(Enemy_Attackers)
and the debug_write at the bottom says this:
[]
…
yeah im confused
is there something stupid i am doing in here?