Example #1
0
def go_take(direction):
    if direction == "l":
        turn = turn_left
    else:
        turn = turn_right
    move()
    turn()
    for _ in range(2):
        move()
        take()
    turn_back()
    multi_move(2)
    while carries_object():
        put()
    turn()
Example #2
0
from library import multi_move, turn_right, turn_back
def clear_move():
    while front_is_clear():
        move()
while not is_facing_north():
    turn_left()
turn_back()
clear_move()
turn_left()
clear_move()
turn_back()
count = 1
while 1:
    while object_here():
        take()
    if front_is_clear():
        move()
    else:
        if count%2:
            turn = turn_right
        else:
            turn = turn_left
        turn()
        if front_is_clear():
            move()
            turn()
            count += 1
        else:
            turn_right()
            clear_move()
            break