예제 #1
0
파일: universe.py 프로젝트: xspize/com411
    def generate(self):
        #creates a planet
        planet = Planet()

        #adds a random number of humans and robots to the planet object

        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)