コード例 #1
0
 def step(self):
     if not self.ant.settled:
         try:
             self.ant.move()
         except Error as e:
             raise e
     else:
         if self.ant.y > self.maxHeight:
             self.maxHeight = self.ant.y
         if self.checkBridge():
             return False
         self.addJoints(self.ant)
         self.antId = self.antId + 1
         self.numAnts += 1
         if G.DeterministicAnts:
             self.ant = Pyramid(self.antId)
             self.oldy = self.y
             self.y = self.ant.y
             if self.y != self.oldy:
                 Physics.resetPhysics()
                 Physics.checkPhysics()
         else:
             self.ant = Ant(self.antId)
             Physics.resetPhysics()
             Physics.checkPhysics()
         self.updateShaking()
     return True