if (knitr:::is_latex_output()) {
knitr::asis_output('\\url{....}')
} else {
knitr::include_graphics("fig/Storm_01.gif")
}
move(), turn_left(), take(), toss()object_here(), carries_object(), front_is_clear(), wall_in_front()while문과 제어 조건 if 문을 사용if (knitr:::is_latex_output()) {
knitr::asis_output('\\url{....}')
} else {
knitr::include_graphics("fig/Storm_01.gif")
}
def turn_right():
turn_left()
turn_left()
turn_left()
def turn_around():
turn_left()
turn_left()
while front_is_clear():
move()
while object_here():
take()
turn_around()
repeat 5:
move()
turn_right()
while carries_object():
toss() move(), turn_left(), take(), toss()object_here(), carries_object(), front_is_clear(), wall_in_front()while문과 제어 조건 if 문을 사용if (knitr:::is_latex_output()) {
knitr::asis_output('\\url{....}')
} else {
knitr::include_graphics("fig/Storm_02.gif")
}
def turn_around():
turn_left()
turn_left()
def turn_right():
turn_left()
turn_left()
turn_left()
def collect_leaves():
while front_is_clear():
while object_here():
take()
move()
def first_collect_leaves():
while front_is_clear():
while object_here():
take()
move()
turn_around()
repeat 4:
move()
turn_right()
move()
turn_right()
collect_leaves()
turn_left()
move()
turn_left()
def go_to_beginning():
while object_here():
take()
turn_around()
while not wall_in_front():
move()
turn_left()
move()
turn_left()
def go_to_home():
while not wall_in_front():
move()
while object_here():
take()
turn_left()
while not at_goal():
if front_is_clear():
move()
elif right_is_clear():
turn_right()
elif wall_in_front():
turn_left()
turn_right()
while carries_object():
toss()
move()
first_collect_leaves()
repeat 3:
collect_leaves()
go_to_beginning()
go_to_home()