Commit 33353f33 authored by Yuxin Wu's avatar Yuxin Wu

a default implementation for restart_episode

parent dee9d398
...@@ -86,7 +86,7 @@ class LimitLengthPlayer(ProxyPlayer): ...@@ -86,7 +86,7 @@ class LimitLengthPlayer(ProxyPlayer):
isOver = True isOver = True
self.player.restart_episode() self.player.restart_episode()
if isOver: if isOver:
print self.cnt #print self.cnt, self.player.stats # to see what limit is appropriate
self.cnt = 0 self.cnt = 0
return (r, isOver) return (r, isOver)
......
...@@ -29,9 +29,9 @@ class RLEnvironment(object): ...@@ -29,9 +29,9 @@ class RLEnvironment(object):
:returns: (reward, isOver) :returns: (reward, isOver)
""" """
@abstractmethod
def restart_episode(self): def restart_episode(self):
""" Start a new episode, even if the current hasn't ended """ """ Start a new episode, even if the current hasn't ended """
raise NotImplementedError()
def get_stat(self): def get_stat(self):
""" """
......
...@@ -44,7 +44,7 @@ class StoppableThread(threading.Thread): ...@@ -44,7 +44,7 @@ class StoppableThread(threading.Thread):
try: try:
q.put(obj, timeout=5) q.put(obj, timeout=5)
break break
except queue.Queue.Full: except queue.Full:
pass pass
def queue_get_stoppable(self, q): def queue_get_stoppable(self, q):
...@@ -52,7 +52,7 @@ class StoppableThread(threading.Thread): ...@@ -52,7 +52,7 @@ class StoppableThread(threading.Thread):
while not self.stopped(): while not self.stopped():
try: try:
return q.get(timeout=5) return q.get(timeout=5)
except queue.Queue.Full: except queue.Empty:
pass pass
class LoopThread(threading.Thread): class LoopThread(threading.Thread):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment