As you most likely found out, we were too hasty in asking Reeborg to move forward after putting down a beeper. We need to check if there is a wall preventing him from moving first. Here's a solution to the problem.
def turn_right(): repeat(turn_left, 3) put_beeper() # begin changes if not front_is_clear(): turn_left() # end changes move() while not next_to_a_beeper(): if right_is_clear(): turn_right() move() elif front_is_clear(): move() else: turn_left() turn_off()
Test it now and see that it works. Can you imagine situations where it might not work?