'Add episodes to buffer.'

def add(self, episodes, *args):

    idx = 0
    while ((self.cur_size < self.max_size) and (idx < len(episodes))):
        self.buffer[self.cur_size] = episodes[idx]
        self.cur_size += 1
        idx += 1
    if (idx < len(episodes)):
        remove_idxs = self.remove_n((len(episodes) - idx))
        for remove_idx in remove_idxs:
            self.buffer[remove_idx] = episodes[idx]
            idx += 1
    assert (len(self.buffer) == self.cur_size)
