Skip to content

Commit

Permalink
change add terminal state
Browse files Browse the repository at this point in the history
  • Loading branch information
MorvanZhou committed Jan 14, 2018
1 parent 8a8c0b4 commit 639902b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contents/3_Sarsa_maze/maze_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ def step(self, action):
if s_ == self.canvas.coords(self.oval):
reward = 1
done = True
s_ = 'terminal'
elif s_ in [self.canvas.coords(self.hell1), self.canvas.coords(self.hell2)]:
reward = -1
done = True
s_ = 'terminal'
else:
reward = 0
done = False
Expand Down
2 changes: 2 additions & 0 deletions contents/4_Sarsa_lambda_maze/maze_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ def step(self, action):
if s_ == self.canvas.coords(self.oval):
reward = 1
done = True
s_ = 'terminal'
elif s_ in [self.canvas.coords(self.hell1), self.canvas.coords(self.hell2)]:
reward = -1
done = True
s_ = 'terminal'
else:
reward = 0
done = False
Expand Down

0 comments on commit 639902b

Please sign in to comment.