i think it is working
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import random
|
||||
class Simulation():
|
||||
"""
|
||||
Class for controlling the different calculation steps of the Simulation.
|
||||
"""
|
||||
def __init__(self) -> None:
|
||||
self.tick_funcs={}
|
||||
pass
|
||||
|
||||
def seed(self,a):
|
||||
"""
|
||||
Sets the random seed
|
||||
"""
|
||||
random.seed(a)
|
||||
def register_tick(self,id,tickfunc):
|
||||
|
||||
self.tick_funcs[id]=tickfunc
|
||||
|
||||
def tick_random_order(self):
|
||||
"""
|
||||
Ticks all agents in a Random Order
|
||||
"""
|
||||
keys=list(self.tick_funcs.keys())
|
||||
random.shuffle(keys)
|
||||
for k in keys:
|
||||
fun=self.tick_funcs[k]
|
||||
fun()
|
||||
Reference in New Issue
Block a user