No older revisions available
No older revisions available
1. 데블스캠프2005/RUR-PLE/Newspaper/Refactoring ¶
~cpp
def turn_right():
repeat(turn_left, 3)
#define it.
def floor_up():
turn_left()
move()
turn_right()
move()
move()
#define it.
def floor_down():
move()
move()
turn_left()
move()
turn_right()
move()
#use it.
repeat(floor_up,4)
put_beeper()
turn_left()
turn_left()
#use it.
repeat(floor_down, 4)
move()
~cpp
def turn_right():
repeat(turn_left, 3)
def upAndGo():
turn_left()
move()
turn_right()
move()
move()
def goAndDown():
move()
move()
turn_left()
move()
turn_right()
#start
move()
repeat(upAndGo, 4)
put_beeper()
turn_left()
turn_left()
repeat(goAndDown, 3)
move()
turn_off()
~cpp
def turn_right():
turn_left()
turn_left()
turn_left()
def move_up():
turn_left()
move()
turn_right()
move()
move()
def move_down():
move()
move()
turn_left()
move()
turn_right()
move()
repeat(move_up, 4)
put_beeper()
turn_left()
turn_left()
repeat(move_down, 3)
move()
turn_off()