Skip to content

Commit

Permalink
Cliffwalking should terminate when running into cliff
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Young Jin committed Jun 10, 2024
1 parent bff8824 commit 5e78583
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions gymnasium/envs/toy_text/cliffwalking.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from gymnasium.envs.toy_text.utils import categorical_sample
from gymnasium.error import DependencyNotInstalled


UP = 0
RIGHT = 1
DOWN = 2
Expand Down Expand Up @@ -164,7 +163,7 @@ def _calculate_transition_prob(self, current, delta):
new_position = self._limit_coordinates(new_position).astype(int)
new_state = np.ravel_multi_index(tuple(new_position), self.shape)
if self._cliff[tuple(new_position)]:
return [(1.0, self.start_state_index, -100, False)]
return [(1.0, self.start_state_index, -100, True)]

terminal_state = (self.shape[0] - 1, self.shape[1] - 1)
is_terminated = tuple(new_position) == terminal_state
Expand Down

0 comments on commit 5e78583

Please sign in to comment.