Skip to content

Commit

Permalink
Do not overwrite existing information with None
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcCote committed Oct 1, 2024
1 parent c1b959b commit 673da9d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion textworld/envs/wrappers/tw_inform7.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def _send(self, command: str) -> str:
def _track_info(self, info):
extra_infos, _ = _detect_extra_infos(self._send('tw-extra-infos {}'.format(info)))
self._tracked_infos.append(info)
self.state.update(extra_infos)
# Update the state with the new information. Avoid overwriting existing information if new value is None.
self.state.update({k: v for k, v in extra_infos.items() if k not in self.state or v is not None})

def reset(self):
self._tracked_infos = []
Expand Down

0 comments on commit 673da9d

Please sign in to comment.