Skip to content

Commit

Permalink
Merge pull request #308 from robinbg/main
Browse files Browse the repository at this point in the history
Get admissible commands in Jericho environments
  • Loading branch information
MarcCote committed May 31, 2023
2 parents e5e5640 + d4737ca commit 825ca37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions textworld/envs/zmachine/jericho.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def _gather_infos(self):
self.state["inventory"], _, _, _ = self._jericho.step("inventory")
self._jericho.set_state(bkp)

if self.infos.admissible_commands:
self.state["_valid_commands"] = self._jericho.get_valid_actions()
self.state["admissible_commands"] = sorted(set(self.state["_valid_commands"]))

def reset(self):
if not self.game_running:
raise GameNotRunningError("Call env.load(gamefile) before env.reset().")
Expand Down

0 comments on commit 825ca37

Please sign in to comment.