Skip to content

Commit dc7713c

Browse files
author
User
committed
update
1 parent 04a2c19 commit dc7713c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rl/grid_world.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ def move(self, action):
169169
next_state_probs = self.probs[(s, a)]
170170
next_states = list(next_state_probs.keys())
171171
next_probs = list(next_state_probs.values())
172-
s2 = np.random.choice(next_states, p=next_probs)
172+
next_state_idx = np.random.choice(len(next_states), p=next_probs)
173+
s2 = next_states[next_state_idx]
173174

174175
# update the current state
175176
self.i, self.j = s2

0 commit comments

Comments
 (0)