Course VVLogo A - Lesson 2

Overview

The VVLogo commands introduced in this lesson are Slow, Home, and PenUp (PU) and PenDown (PD).

Introductory

To refresh the class's memory, ask some questions. What is the name of the computer language we're learning? What kind of animal moves around on the screen? What commands can we give the turtle? (Don't forget HOWTO and END.) What are the abbreviations for those commands?

The class probably noticed that the turtle instantly responds to commands. It can be handy to slow the turtle down, and the command to do this is Slow. A number goes after Slow. Slow 2 is slow, Slow 3 is very sllooww, and Slow 4 is incredibly slow. Slow 1 is actually pretty speedy, and Slow 0 is the same as not using Slow at all. If you use a number less than 0 or greater that 4 after Slow, it's the same as 0 or 4.

Sometimes it is handy to move the turtle around on the window without drawing a line. In other words, we'd like tell the turtle to lift its pen, go forward or back, and then put its pen back down again. We can do this with the commands PenUp and PenDown. Notice that these are each one word with no space. Their abbreviations are PU and PD. You don't put a number after PU or PD.

Ask, what's something you might want the turtle to draw that would require PenUp and PenDown? What would be the result of these commands: "FD 5 PU FD 5 PD FD 5 PU FD 5 PD FD 5" ? A dashed line.

Another handy command to give the turtle is Home. Home puts the turtle back in the center of the window, heading straight up. When the turtle moves to its home, it doesn't draw a line, whether the pen is up or down.

Programming Lab

As always, the first step in the lab is to log on to the computer, start a web browser, and go to http://vvlogo.csed.org.
  1. VVLogo program Type this program in the program window:
    HOWTO Draw
      FD 50 RT 120
      FD 50 RT 120
      FD 50 RT 120
    END
    
    and press the Draw button. You should see the turtle draw a triangle in the output window. Don't clear the program.

  2. Type SLOW 2 before the first FD and run the program again. Try different speeds (you can use 0, 1, 2, 3, or 4 after SLOW).

  3. Put PENUP before the first FD. What effect does that have? Now remove the PENUP.

  4. VVLogo program Suppose we want to draw a few unconnected triangles. We need to use PenUp or PU and PenDown or PD so the turtle doesn't leave a trail bewteen the triangles. Add some more commands to your program so that it looks like this:
    HOWTO Draw
      FD 50 RT 120
      FD 50 RT 120
      FD 50 RT 120
      PU LT 45 FD 25 PD
      FD 50 RT 120
      FD 50 RT 120
      FD 50 RT 120
    END
    
    Can you add some more commands so that the turtle draws three triangles that don't touch each other?
    Some students may be familiar with copy and paste, which is handy for this step. You may want to tell other students about this facility.

  5. The size of the drawing window can change the look of the turtle tracks. Clear the programming window, then type in and run this program:
    HOWTO Draw
      SLOW 2
      RT 63 FD 300
      HOME
      LT 78 BK 300
      HOME
      LT 175 FD 300
    END
    
    Run this program several times, changing the size of the output window. Slow the turtle down even more, if necessary, to make sure you understand how the turtle is wrapping around from one edge to another.

Concluding Questions and Answers

VVLogo output Draw this picture on the board and ask the students what they think it is. How could the turtle could draw it? The students will probably need a hint, perhaps the first two lines. The entire program will look something like this:
HOWTO Draw
  LT 90 PU FD 20 PD FD 20
  HOME
  LT 60 PU FD 20 PD FD 20
  HOME
  LT 30 PU FD 20 PD FD 20
  HOME
  PU FD 20 PD FD 20
  HOME
  RT 30 PU FD 20 PD FD 20
  HOME
  RT 60 PU FD 20 PD FD 20
  HOME
  RT 90 PU FD 20 PD FD 20
  HOME
END

Evaluation Activity

  1. Write a short program on the board, and have the students "play turtle" and draw the result on a sheet of paper. Here's a possibility, which draws a Y:
    HOWTO Draw
      FD 50
      RT 45
      FD 25
      BK 25
      LT 90
      FD 25
    END
    
  2. Write a shape or design on the board, and have the students write the turtle commands that would produce it. Good choices are a square and a capital T.