Esempio n. 1
0
    def update(self, t):
        BaseContext.update(self, t)

        done = True
        for world in self.worlds:
            if world.update(constants.UPS):
                done = False

        if done and self._train:
            self.pop.save_to_file(constants.res_loc("networks") + self.pop.name + ".pop")
            self.pop.create_next_generation()
            self.pop.generation_count += 1

            self.worlds = []
            for net in self.pop.current_generation:
                nWorld = NeuronalWorld(self.pop.seed, net)
                nWorld.renderer = RenderNeuronalWorld(nWorld)
                self.worlds.append(nWorld)
                nWorld.generatePlatform()
 def update(self, t):
     BaseContext.update(self, t)
     if not self._world.update(t):
         self._setContextFunc(GameOverContext(self, self._setContextFunc))