I have the following code. I would like to know how I can create an as many attribute for the object labyrinth that I have robot. I have two doubts, how to create the attribute and how to call the function. Anyone ? :)
class Robot:
"""Class that represents a robot."""
def __init__(self, name, x, y):
self.name = name
self.x = x
self.y = y
class Labyrinth:
"""Class that represents a labyrinth."""
def __init__(self, obstacles, *args):
self.grid = {}
for robot in args: # First doubt
self.robot.name = [robot.x, robot.y] # First doubt
robot_1 = Robot(robot_1, 5, 6)
robot_2 = Robot(robot_2, 8, 9)
...
...
...
# unkown number of robots...
labyrinth = Labyrinth(obstacles, ......) # Second doubt