Example #1
0
File: world.py Project: 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
Example #2
0
File: world.py Project: trun/redux
 def __init__(self):
     self.objects = OrderedDict()
     self.round = -1
     self.next_id = 0
     Scheduler.create(self)
Example #3
0
File: world.py Project: trun/redux
 def add_object(self, obj):
     self.objects[obj.id] = obj
     Scheduler.instance().spawn_thread(obj)