class VacuumCleaner:
def __init__(self):
self.location = (0, 0)
def move(self, direction):
x, y = self.location
if direction == "up":
x -= 1
elif direction == "down":
x += 1
elif direction == "left":
y -= 1
elif direction == "right":
y += 1
self.location = (x, y)
def clean_environment(self, environment):
while "dirty" in environment.values():
if environment[self.location] == "dirty":
print(f"Cleaning location: {self.location}")
environment[self.location] = "clean"
if self.location[1] % 2 == 0:
self.move("right")
else:
self.move("left")
environment = {(i, j): "dirty" for i in range(3) for j in range(3)}
vacuum_cleaner = VacuumCleaner()
vacuum_cleaner.clean_environment(environment)