Execute algorithm (if max_times = None, there can be forever loop).

def execute(self, string, max_tacts=None):
        """Execute algorithm (if max_times = None, there can be forever loop)."""
        self.init_tape(string)
        counter = 0

        while True:
            self.execute_once()
            if self.state == self.TERM_STATE:
                break
            counter += 1
            if max_tacts is not None and counter >= max_tacts:
                raise TimeoutError("algorithm hasn't been stopped")

        return self.get_tape()