Karel

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.0 kB
1
Indexable
Never
```# This is an editor! An editor is where you write code.
# Make karel: move, turn_left, move
def main():
   starting_position()
#   move()
#   turn_left()
#   move()
   # add your code here
#   turn_right()
#   move()
#For loop to make a frame
   for i in range(2):
      put_row_beepers()
      put_column_beepers()
#      put_row_beepers()
#      put_column_beepers()

#Gets Karel to the starting position to build the frame
def starting_position():
   move()
   turn_left()
   move()
   turn_right()
   
   
#Instructs Karel to turn right
def turn_right():
   turn_left()
   turn_left()
   turn_left()
   
#Instructs Karel to turn the corner and reposition on empty square
def turn_corner(): 
   turn_left()
   move()

#Instructs Karel to put down 4 beepers in the current row
def put_row_beepers():
   for i in range(4):
      put_beeper()
      move()
   turn_left()

#Instructs Karel to put down 5 beepers in the current column
def put_column_beepers():
   for i in range(5):
      put_beeper()
      move()
   turn_left()
```