

for while for (item) in [list_of items]: while Something is ture: do Something to each item do something repeatedly



장애물 높이, 위치와 골의 위치가 모두 바뀔 경우
def turn_right(): turn_left() turn_left() turn_left() def jump(): turn_left() while wall_on_right(): if front_is_clear(): move() else: turn_left() turn_right() move() turn_right() while not at_goal(): if front_is_clear(): move() else: jump()

def turn_right(): turn_left() turn_left() turn_left() while not at_goal(): if front_is_clear()&right_is_clear(): turn_right() move() elif front_is_clear()&wall_on_right(): move() elif wall_in_front()&right_is_clear(): turn_right() move() else: while wall_in_front(): turn_left() move()