def __on_wolf_die(self, wolf, type): if wolf.logged : return wolf.logged = True timestamp = time.time() - self.beginTime livetime = time.time() - wolf.born_time print "wolf", type LiveLog.append('wolf', timestamp, wolf.generation, livetime, type)
def __on_rabbit_die(self, rabbit, type): if rabbit.logged : return rabbit.logged = True timestamp = time.time() - self.beginTime livetime = time.time() - rabbit.born_time print "rabbit", type LiveLog.append('rabbit', timestamp, rabbit.generation, livetime, type)
def __on_new_wolf(self, wolf): self.wolves.append(wolf) timestamp = time.time() - self.beginTime PhenotypeLog.append('wolf', timestamp, wolf.generation, wolf.phenotype) LiveLog.append('wolf', timestamp, wolf.generation, 0, LiveLog.BIRTH)
def __on_new_rabit(self, rabbit): self.rabbits.append(rabbit) timestamp = time.time() - self.beginTime PhenotypeLog.append('rabbit', timestamp, rabbit.generation, rabbit.phenotype) LiveLog.append('rabbit', timestamp, rabbit.generation, 0, LiveLog.BIRTH)