# Escape from the maze!
# Some doors are blocked, some open when you are near them.
DBR = 16
startRoom = {"x": 18, "y": 19}
hero.move(startRoom)
while True:
# up
if hero.isPathClear(hero.pos, {'x': hero.pos.x, 'y': hero.pos.y + DBR}):
hero.moveXY(hero.pos.x, hero.pos.y + DBR)
elif hero.isPathClear(hero.pos, {'x': hero.pos.x + DBR, 'y': hero.pos.y}):
hero.moveXY(hero.pos.x + DBR, hero.pos.y)
# right
elif hero.isPathClear(hero.pos, {'x': hero.pos.x, 'y': hero.pos.y - DBR}):
hero.moveXY(hero.pos.x, hero.pos.y - DBR)
# down
elif hero.isPathClear(hero.pos, {'x': hero.pos.x - DBR, 'y': hero.pos.y}):
hero.moveXY(hero.pos.x - DBR, hero.pos.y)
# left
Here is my code. What is wrong?