reading fucking cells
This commit is contained in:
+16
-2
@@ -5,6 +5,9 @@ class Simulation():
|
||||
"""
|
||||
def __init__(self) -> None:
|
||||
self.tick_funcs={}
|
||||
self.reset_funcs={}
|
||||
self.tick_count=0
|
||||
self.episode_count=0
|
||||
pass
|
||||
|
||||
def seed(self,a):
|
||||
@@ -12,9 +15,10 @@ class Simulation():
|
||||
Sets the random seed
|
||||
"""
|
||||
random.seed(a)
|
||||
def register_tick(self,id,tickfunc):
|
||||
def register_agent(self,id,tickfunc,resetfunc):
|
||||
|
||||
self.tick_funcs[id]=tickfunc
|
||||
self.reset_funcs[id]=resetfunc
|
||||
|
||||
def tick_random_order(self):
|
||||
"""
|
||||
@@ -24,4 +28,14 @@ class Simulation():
|
||||
random.shuffle(keys)
|
||||
for k in keys:
|
||||
fun=self.tick_funcs[k]
|
||||
fun()
|
||||
fun(self.tick_count,self.episode_count)
|
||||
self.tick_count+=1
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets all agents to new Episode
|
||||
"""
|
||||
for k,v in self.reset_funcs.items():
|
||||
v(self.episode_count)
|
||||
self.tick_count=0
|
||||
self.episode_count+=1
|
||||
Reference in New Issue
Block a user