U E D R , A S I H C RSS

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

데블스캠프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()
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:13
Processing time 0.0320 sec