~cpp move() turn_off()
~cpp move() turn_left() move() turn_off()
~cpp def turn_right(): repeat(turn_left, 3)
~cpp if next_to_a_beeper(): pick_beeper()
~cpp def move_or_turn(): if front_is_clear(): move() else: turn_left()
~cpp # introducing vocabulary related to the problem next_to_a_carrot = next_to_a_beeper plant_carrot = put_beeper pick_carrot = pick_beeper def one_carrot_only(): if not next_to_a_carrot(): plant_carrot() # replace missing seed else: pick_carrot() if not next_to_a_carrot(): # oops! plant_carrot() # we had removed the only one
~cpp next_to_a_carrot = next_to_a_beeper plant_carrot = put_beeper pick_carrot = pick_beeper def one_carrot_only(): while next_to_a_carrot(): pick_carrot() # pick them all! plant_carrot() # replant only one