Help me!I need help on level treasure cave


#1

My code is not working! here it is:

def findway(x,y):
loop:
if self.isPathClear(self.pos, {“x”: x, “y”: y}):
self.moveXY(x, y)

        break
    if y != self.pos.y:    
        if y > self.pos.y:
            if self.isPathClear(self.pos, {"x": self.pos.x, "y": y}):
                self.move({"x": self.pos.x, "y": self.pos.y +1})
        elif y < self.pos.y:    
            if self.isPathClear(self.pos, {"x": self.pos.x, "y": y}):
                self.move({"x": self.pos.x, "y": self.pos.y -1})
        else:
            pass
    if x != self.pos.x:    
        if x > self.pos.x:
            if self.isPathClear(self.pos.x, {"x": x, "y": self.pos.y }):
                self.move({"x": self.pos.x+1, "y": self.pos.y })
        elif x < self.pos.x:    
            if self.isPathClear(self.pos, {"x": x, "y": self.pos.y }):
                self.move({"x": self.pos.x-1, "y": self.pos.y })
        else:
            pass