示例#1
0
文件: world.py 项目: trun/redux
    def run(self):
        self.round += 1

        # begin round
        print '[WORLD] begin round', self.round
        for obj in self.objects.itervalues():
            obj.begin_round()

        # execute each object - TODO: assumes all robots are objects
        for obj in self.objects.itervalues():
            obj.begin_turn()
            Scheduler.instance().run_thread(obj.id)
            obj.end_turn()

        # end round
        for obj in self.objects.itervalues():
            obj.end_round()
        print '[WORLD] end round', self.round
示例#2
0
文件: world.py 项目: trun/redux
 def __init__(self):
     self.objects = OrderedDict()
     self.round = -1
     self.next_id = 0
     Scheduler.create(self)
示例#3
0
文件: world.py 项目: trun/redux
 def add_object(self, obj):
     self.objects[obj.id] = obj
     Scheduler.instance().spawn_thread(obj)