from domain.entities.entity import Entity from domain.world import World class Vacuum(Entity): def __init__(self, x: int, y: int, world: World): super().__init__(x, y, 'VACUUM') self.world = world self.battery = 100 # TODO add more properties def move(self, dx, dy): end_x = self.x + dx end_y = self.y + dy if end_x > self.world.width - 1 or end_y > self.world.height - 1 or end_x < 0 or end_y < 0: return if self.world.is_obstacle_at(end_x, end_y): return self.x = end_x self.y = end_y