Beispiel #1
0
    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)

        for index in range(random.randint(1, 10)):
            human = Human(f"Human{index}")
            planet.add(human)

        # add to list of planets
        self.planets.append(planet)