~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()