Upload alea/envs/gridworld.py with huggingface_hub
Browse files- alea/envs/gridworld.py +3 -0
alea/envs/gridworld.py
CHANGED
|
@@ -115,6 +115,9 @@ class GridworldEnv(DecisionEnv):
|
|
| 115 |
self.pos = (nr, nc)
|
| 116 |
self.dist = self._bfs()
|
| 117 |
self.steps += 1
|
|
|
|
|
|
|
|
|
|
| 118 |
if self.pos == self.goal:
|
| 119 |
self._done = True
|
| 120 |
return 1.0, True
|
|
|
|
| 115 |
self.pos = (nr, nc)
|
| 116 |
self.dist = self._bfs()
|
| 117 |
self.steps += 1
|
| 118 |
+
if not self._legal():
|
| 119 |
+
self._done = True
|
| 120 |
+
return 0.0, True
|
| 121 |
if self.pos == self.goal:
|
| 122 |
self._done = True
|
| 123 |
return 1.0, True
|