데블스캠프2011/셋째날/RUR-PLE/박정근 (rev. 1.6)
Harvest.rur ¶
def turn_right():
repeat(turn_left,3)
def getbeeper():
while on_beeper():
if on_beeper():
pick_beeper()
while True:
if front_is_clear():
move()
getbeeper()
else:
turn_left()
if facing_north():
move()
getbeeper()
turn_left()
else:
repeat(turn_left,2)
move()
getbeeper()
turn_right()
turn_off()
Trash.rur ¶
def turn_right():
repeat(turn_left,3)
def getbeeper():
while on_beeper():
if on_beeper():
pick_beeper()
def putbeeper():
while carries_beepers():
put_beeper()
while not right_is_clear():
if front_is_clear():
move()
getbeeper()
else:
repeat(turn_left,2)
turn_right()
move()
putbeeper()
turn_off()
Maze.rur ¶
def turn_right():
repeat(turn_left,3)
while not on_beeper():
if left_is_clear():
turn_left()
move()
elif front_is_clear():
move()
elif right_is_clear():
turn_right()
else:
repeat(turn_left,2)
pick_beeper()
turn_off()