Suppose we have a sheet of paper partitioned in a grid of squares. We label squares with coordinates (i,j). Square (0,0) is the leftmost top square. Square (i,j) is the square in row i+1 and column j+1. For example, square (1,2) is the second square from the top row, in the third column.

On this sheet we want to draw a letter E of 10 squares high and 5 squares wide. The sheet contains at least 5 rows and 10 columns of squares.

There are three primitive drawing instructions:

  1. pen down: put the pen down;
  2. pen up: put the pen up; and
  3. goto (i,j): go to square (i,j).
If the pen is down, then goto will draw a line from the current square to square (i,j).
  1. Make a drawing to illustrate the movements of the pen. Instead of lines use vectors and label the vectors with 1, 2, ... to mark the order of movements.

    Answer:
    Squares in the sketch below are seperated by blank spaces.

    
      + - - - - > (1)
      
      |
    
      |
    
      |
    
      + - - - - > (3)
    
      |
    
      |
    
      |
    
      |
    
      + - - - - > (4)
            
     \ /
     (2)
    
  2. Write all instructions for the algorithm to draw a E of 10 squares high and 5 squares wide, using only the three primitive drawing operations.

    Answer:

       goto (0,0)
       pen down
       goto (0,4)
       pen up
       goto (0,0)
       pen down
       goto (9,0)
       goto (9,4)
       pen up
       goto (4,0)
       pen down
       goto (4,4)
    
Note: to learn how to do this with turtle, in a Python session, type
>>> import turtle
>>> help(turtle)