def newPopulation(self, miners_pop): new_pop = [] soft_max = self.softmax() for i in range(self.maxpop): father = self.pickParent(miners_pop, soft_max) mother = self.pickParent(miners_pop, soft_max) if father.fitness() >= 1: child = Miner(father.id_number, father.size, father.maze_grid, father.path) elif mother.fitness() >= 1: child = Miner(mother.id_number, mother.size, mother.maze_grid, mother.path) else: child = Miner.crossover(father, mother) new_pop.append(child) return new_pop