def generate_actions(self):
        actions = []
        my_player = None
        enemy_player = None

        for player in self.players:
            if player.name == self.team_name:
                my_player = player
            else:
                enemy_player = player

        for my_tank in my_player.tanks:
            # print "Calculating for %s" % my_tank.id
            s_path_len = 9999999999
            s_path = []
            s_path_tank = None
            for enemy_dist, enemy_tank in my_tank.get_all_dist_tank(enemy_player.tanks):
                # print "\t %s" % enemy_tank.id
                temp_s_path = self.map.get_shortest_path(my_tank.position, enemy_tank.position)
                if s_path_len > len(temp_s_path) > 0:
                    s_path = temp_s_path
                    s_path_tank = enemy_tank
                    s_path_len = len(temp_s_path)
            if len(s_path) >= 1:
                tur_dir, tur_rad = my_tank.get_direction_rotation_turret_to_tank(s_path_tank)
                tra_dir, tra_rad = my_tank.get_direction_rotation_track_to_point(s_path[0])
                dist = my_tank.get_dist_to_point(s_path[0])
                actions.append(Command.get_turret_rotation_command(my_tank.id, tur_dir, tur_rad, self.client_token))
                actions.append(Command.get_tank_rotation_command(my_tank.id, tra_dir, tra_rad, self.client_token))
                actions.append(Command.get_movement_command(my_tank.id, 'FWD', dist, self.client_token))
                if my_tank.no_friendly_fire(my_player.tanks, my_tank.get_dist_to_tank(s_path_tank), s_path_tank):
                    actions.append(Command.get_fire_command(my_tank.id, self.client_token))
                else:
                    # don't shoot friend from queued bullet
                    actions.append(Command.get_stop_command(my_tank.id, CommType.FIRE, self.client_token))
            else:
                dist, tank = my_tank.get_closest_dist_tank(enemy_player.tanks)
                tur_dir, tur_rad = my_tank.get_direction_rotation_turret_to_tank(tank)
                tra_dir, tra_rad = my_tank.get_direction_rotation_track_to_tank(tank)
                actions.append(Command.get_turret_rotation_command(my_tank.id, tur_dir, tur_rad, self.client_token))
                actions.append(Command.get_tank_rotation_command(my_tank.id, tra_dir, tra_rad, self.client_token))
                actions.append(Command.get_movement_command(my_tank.id, 'FWD', dist, self.client_token))
                if my_tank.no_friendly_fire(my_player.tanks, dist, tank):
                    actions.append(Command.get_fire_command(my_tank.id, self.client_token))
                else:
                    # don't shoot friend from queued bullet
                    actions.append(Command.get_stop_command(my_tank.id, CommType.FIRE, self.client_token))
        return actions
    def generate_actions(self):
        actions = []
        my_player = None
        enemy_player = None

        for player in self.players:
            if player.name == self.team_name:
                my_player = player
            else:
                enemy_player = player

        # let's do this the dumbest way possible, all at once
        for my_tank in my_player.tanks:
            dist, tank = my_tank.get_closest_tank(enemy_player.tanks)
            tur_dir, tur_rad = my_tank.get_point_turret_to_tank(tank)
            tra_dir, tra_rad = my_tank.get_point_track_to_tank(tank)
            actions.append(Command.get_turret_rotation_command(my_tank.id, tur_dir, tur_rad, self.client_token))
            actions.append(Command.get_tank_rotation_command(my_tank.id, tra_dir, tra_rad, self.client_token))
            actions.append(Command.get_movement_command(my_tank.id, 'FWD', dist, self.client_token))
            actions.append(Command.get_fire_command(my_tank.id, self.client_token))
        return actions