def generate(self): planet = Planet() for count in range(random.randint(0, 100)): robot = Robot(f"Robot{count}") planet.add_robot(robot) self.robots = self.robots + 1 for count in range(random.randint(0, 100)): human = Human(f"Human{count}") planet.add_human(human) self.humans = self.humans + 1 self.planets.append(planet)
def generate(self): #Creates a new planet planet = Planet() for index in range(rnd.randint(1, 10)): robot = Robot(f"Robot{index}") planet.add_robot(robot) for index in range(rnd.randint(1, 10)): human = Human(f"Robot{index}") planet.add_human(human) #Populates the list of planets self.planets.append(planet)
def generate(self): # create a new planet planet = Planet() # populate with random humans and robots for index in range(random.randint(1, 10)): robot = Robot(f"Robot{index}") planet.add_robot(robot) for index in range(random.randint(1, 10)): human = Human(f"Human{index}") planet.add_human(human) # add to list of planets self.planets.append(planet)
def generate(self): planet = Planet() num_humans = random.randit(0, 100) num_robots = random.randit(0, 100) for count in range(num_humans): human = Human() planet.add_human(human) for count in range(num_robots): robot = Robot() planet.add_robot(robot) for index in range(random.randint(1,10)): robot = Robot(f"Robot{index}") planet.add_robot(human) for index in range(random.randint(1,10)): human = Human(f"Human{index}") planet.add_human(human) self.planets.append(planet)