# In this program the robot works with # the world ex_3_harvest_2.wld. # It picks up all beepers and puts # beepers in the spots that were empty # before. That is, at the end, the # spots that had beepers are empty and # the spots that were empty have # beepers. def turn_right(): repeat(turn_left,3) def pick_or_put_and_move(): if on_beeper(): pick_beeper() else: put_beeper() move() # deals with one row def one_row(): repeat(pick_or_put_and_move, 5) # deals with one row from left to right, # turns around and goes up one line, # deals with the next row, # turns around and goes up one line def two_rows(): one_row() turn_around_left() one_row() turn_around_right() def turn_around_left(): turn_left() pick_or_put_and_move() turn_left() def turn_around_right(): turn_right() pick_or_put_and_move() turn_right() move() repeat(two_rows, 3) turn_off()