Skip to content

Commit

Permalink
updated nodeath
Browse files Browse the repository at this point in the history
  • Loading branch information
BolunDai0216 committed Oct 6, 2024
1 parent b085105 commit e59c273
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions minigrid/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,9 @@ def __init__(self, env, no_death_types: tuple[str, ...], death_cost: float = -1.
def step(self, action):
# In Dynamic-Obstacles, obstacles move after the agent moves,
# so we need to check for collision before self.env.step()
front_cell = self.grid.get(*self.front_pos)
front_cell = self.unwrapped.grid.get(*self.unwrapped.front_pos)
going_to_death = (
action == self.actions.forward
action == self.unwrapped.actions.forward
and front_cell is not None
and front_cell.type in self.no_death_types
)
Expand All @@ -873,7 +873,7 @@ def step(self, action):

# We also check if the agent stays in death cells (e.g., lava)
# without moving
current_cell = self.grid.get(*self.agent_pos)
current_cell = self.unwrapped.grid.get(*self.unwrapped.agent_pos)
in_death = current_cell is not None and current_cell.type in self.no_death_types

if terminated and (going_to_death or in_death):
Expand Down

0 comments on commit e59c273

Please sign in to comment.