# In this program the robot picks up # all the trash lying around in the # 10 by 10 grid. # There can be more than one piece of # trash in the same spot. def turn_right(): repeat(turn_left,3) def pick_up_all_and_move(): while on_beeper(): pick_beeper() move() # deals with one row def one_row(): repeat(pick_up_all_and_move, 9) # 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() if front_is_clear(): pick_up_all_and_move() turn_left() def turn_around_right(): turn_right() if front_is_clear(): pick_up_all_and_move() turn_right() repeat(two_rows, 5) turn_off()