~cpp def check_beeper(): while next_to_a_beeper(): pick_beeper() def go_move_1(): if front_is_clear(): move() else: turn_left() check_beeper() def go_move_2(): move() put_beeper() def go_start_1(): if front_is_clear(): move() else: repeat(turn_left,3) def go_start_2(): if front_is_clear(): move() repeat(go_move_1,6) turn_left() repeat(go_move_1,5) turn_left() repeat(go_move_1,5) turn_left() repeat(go_move_1,4) turn_left() repeat(go_move_1,4) turn_left() repeat(go_move_1,3) turn_left() repeat(go_move_1,3) turn_left() repeat(go_move_1,2) turn_left() repeat(go_move_1,2) turn_left() repeat(go_move_1,1) turn_left() repeat(go_move_1,1) turn_left() repeat(go_start_1,7) repeat(go_start_2,7) repeat(turn_left,2) repeat(go_move_2,6) turn_left() repeat(go_move_2,5) turn_left() repeat(go_move_2,5) turn_left() repeat(go_move_2,4) turn_left() repeat(go_move_2,4) turn_left() repeat(go_move_2,3) turn_left() repeat(go_move_2,3) turn_left() repeat(go_move_2,2) turn_left() repeat(go_move_2,2) turn_left() repeat(go_move_2,1) turn_left() repeat(go_move_2,1) turn_off()
~cpp def turn_right(): repeat(turn_left, 3) def k(): move() if next_to_a_beeper(): pick_beeper() if next_to_a_beeper(): pick_beeper() def j(): move() if not next_to_a_beeper(): put_beeper() k() repeat(k, 5) turn_left() repeat(k, 5) turn_left() repeat(k, 5) turn_left() repeat(k, 4) turn_left() repeat(k, 4) turn_left() repeat(k, 3) turn_left() repeat(k, 3) turn_left() repeat(k, 2) turn_left() repeat(k, 2) turn_left() repeat(k, 1) turn_left() repeat(k, 1) turn_left() turn_left() put_beeper() repeat(j, 1) turn_right() repeat(j, 1) turn_right() repeat(j, 2) turn_right() repeat(j, 2) turn_right() repeat(j, 3) turn_right() repeat(j, 3) turn_right() repeat(j, 4) turn_right() repeat(j, 4) turn_right() repeat(j, 5) turn_right() repeat(j, 5) turn_right() repeat(j, 5) move() turn_left() turn_left()
~cpp def turn_right(): turn_left() turn_left() turn_left() def sooheak(): while front_is_clear() : while next_to_a_beeper(): if next_to_a_beeper(): pick_beeper() move() def rightgo(): turn_right() if next_to_a_beeper(): pick_beeper() move() turn_right() def leftgo(): turn_left() if next_to_a_beeper(): pick_beeper() move() turn_left() def sooheak_all(): sooheak() rightgo() sooheak() leftgo() def rightgo_ppurigi(): turn_right() put_beeper() if next_to_a_beeper(): pick_beeper() move() put_beeper() turn_right() def leftgo_ppurigi(): turn_left() put_beeper() if next_to_a_beeper(): pick_beeper() move() put_beeper() turn_left() def ppurigi(): move() put_beeper() move() put_beeper() move() put_beeper() move() put_beeper() move() put_beeper() move() put_beeper() def ppurigi_all(): ppurigi() rightgo_ppurigi() ppurigi() leftgo() turn_left() repeat(sooheak_all, 3) sooheak() turn_left() turn_left() repeat(ppurigi_all, 2) ppurigi() rightgo_ppurigi() move() put_beeper() move() put_beeper() move() put_beeper() move() put_beeper() move() put_beeper() move() turn_off()
~cpp def one_carrot_only(): move() if not next_to_a_carrot(): plant_carrot() else: pick_carrot() if not next_to_a_carrot(): plant_carrot() one_carrot_only() turn_left() repeat(one_carrot_only,5) repeat(turn_left,3) one_carrot_only() repeat(turn_left,3) repeat(one_carrot_only,3) turn_left() repeat(one_carrot_only,2) repeat(turn_left,3) repeat(one_carrot_only,2) repeat(turn_left,3) repeat(one_carrot_only,2) repeat(turn_left,3) repeat(one_carrot_only,4) repeat(turn_left,3) repeat(one_carrot_only,3) repeat(turn_left,3) repeat(one_carrot_only,4) turn_left() one_carrot_only() turn_left() repeat(one_carrot_only,4) turn_off()
~cpp def turn_right(): repeat(turn_left, 3) # def pick(): pick_beeper() def put(): put_beeper() def carrot_pick(): if next_to_a_beeper(): pick() else: if not next_to_a_beeper(): put() # def carrot_put(): if not next_to_a_beeper(): put() # def move_pick(): move() carrot_pick() def move_pick5(): repeat(move_pick,5) # def move_put(): move() carrot_put() def move_put5(): repeat(move_put,5) move_pick5() move() carrot_pick() turn_left() move() carrot_pick() turn_left() move_pick5() turn_right() move() turn_right() move_pick5() turn_left() move() carrot_pick() turn_left() move_pick5() turn_right() move() turn_right() move_pick5() turn_left() move() carrot_pick() turn_left() move_pick5() turn_right() turn_right() move_put5() turn_right() move() turn_right() move_put5() turn_left() carrot_put() move() carrot_pick() turn_left() move_put5() turn_right() move() carrot_put() turn_right() move_put5() turn_left() move() carrot_put() turn_left() move_put5() turn_right() move() carrot_put() turn_right() move_put5() move() turn_right() turn_right() turn_off()