U E D R , A S I H C RSS

데블스캠프2011/셋째날/RUR-PLE/김태진,송치완

미로 찾기

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라고 하시더군요 ㅎㅎㅎ -김태진
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:13
Processing time 0.0091 sec