미로 찾기 ¶
def turn_right(): repeat(turn_left,3) def left_handed(): if left_is_clear(): turn_left() move() elif front_is_clear(): move() elif right_is_clear(): turn_right() move() else: turn_left() turn_left() while(1): left_handed() if on_beeper(): turn_off()
Sorting ¶
def r(): turn_left() turn_left() turn_left() def l(): turn_left() def line_sort(): while front_is_clear(): if on_beeper(): pick_beeper() move() if on_beeper(): pick_beeper() l() l() while carries_beepers(): put_beeper() if front_is_clear(): move() while front_is_clear(): move() l() move() move() move() move() r() line_sort() l() move() l() line_sort() l() move() l() line_sort() l() move() l() line_sort() l() move() l() line_sort() turn_off()
- Sort랍시고 짰지만, 형진이형이 사실은 Alignment라고 하시더군요 ㅎㅎㅎ -김태진