We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0740418 commit dc10681Copy full SHA for dc10681
RL/example2/maze.py
@@ -111,7 +111,7 @@ def get_reward_and_next_state(s, a):
111
s_ = 'terminal'
112
else:
113
reward = 0
114
- return s_, reward
+ return reward, s_
115
116
117
# update loop
@@ -121,9 +121,9 @@ def update():
121
is_terminated = False
122
while not is_terminated:
123
A = QLearn.choose_action(str(S))
124
- S_, R = get_reward_and_next_state(S, A) # take action & get next state and reward
+ R, S_ = get_reward_and_next_state(S, A) # take action & get reward and next state
125
QLearn.update_table(str(S), A, R, str(S_))
126
- S = S_
+ S = S_ # state will become next state
127
window.update()
128
time.sleep(0.1)
129
if S_ == 'terminal':
0 commit comments