Exemplo n.º 1
0
 def mutate(self):
     rand_int = randint(0, len(self.genes) - 1)
     # If even, is engine type
     if rand_int % 2 == 0:
         self.genes[rand_int] = random_engine()
     # if odd, fuel tank size
     else:
         self.genes[rand_int] = random_fuel()
Exemplo n.º 2
0
 def create_random_rocket(self):
     return Rocket([
         random_engine(), random_fuel(),
         random_engine(), random_fuel(),
         random_engine(), random_fuel(),
     ])