if not wall_is_beneath(): while not wall_is_on_the_right(): move_right() move_down() while not wall_is_on_the_left(): move_left() move_down() elif not wall_is_above(): while not wall_is_on_the_right(): move_right() move_up() while not wall_is_on_the_left(): move_left() move_up()