Updates the index to keep track of history. For example: ``history = 4``, ``delta = 3`` will produce ``self.history = {1, 4, 7, 10}`` and ``self.history_index`` will be updated according to ``self.delta`` and will wrap around the history dictionary.
(self)
| 246 | self.obs = temp |
| 247 | |
| 248 | def update_index(self) -> None: |
| 249 | # language=rst |
| 250 | """ |
| 251 | Updates the index to keep track of history. For example: ``history = 4``, |
| 252 | ``delta = 3`` will produce ``self.history = {1, 4, 7, 10}`` and |
| 253 | ``self.history_index`` will be updated according to ``self.delta`` and will wrap |
| 254 | around the history dictionary. |
| 255 | """ |
| 256 | if self.episode_step_count % self.delta == 0: |
| 257 | if self.history_index != max(self.history.keys()): |
| 258 | self.history_index += self.delta |
| 259 | else: |
| 260 | # Wrap around the history. |
| 261 | self.history_index = (self.history_index % max(self.history.keys())) + 1 |