Exemple #1
0
 def predict(self, game: Game, player: Player):
     actions = []
     e_x, e_y = game.get_closest_enemy_location(player.location[0], player.location[1], player.team_id)
     actions.append((ATTACK_CLOSEST_TARGET, self.distance((e_x, e_y), player.location)))
     r_x, r_y = game.get_nearest_resource_index(player.location[0], player.location[1])
     actions.append((HARVEST_CLOSEST_RESOURCE, self.distance((r_x, r_y), player.location)))
     b_x, b_y = game.get_enemy_base(player.team_id)
     actions.append((ATTACK_BASE, self.distance((b_x, b_y), player.location)))
     return min(actions, key=lambda x: x[1])[0]