Course VVLogo A - Lesson 4

Overview

Lesson 4 continues the study of HOWTOs, and introduces the remaining color commands: BGColor (BC) and TurtleColor (TC); and adding primary colors to make other colors. A third topic is use of comments in code, indicated by //.

Introductory

First a review: Forward (FD), Back (BK), Right (RT), Left (LT), PenUp (PU), PenDown (PD), Howto, End, Home, Slow, PenColor (PC), and colors Red (R), Green (G), Blue (B), White (W), and Black (K).

We know how to change the pen color. It's also possible to change the background color with the command BGColor, abbreviated BC. For example,

BC B
will make the background blue. The BC command only works if it's given to the turtle before anything has been drawn. The third color controlling command is TurtleColor or TC, which changes the color of the turtle itself.

To make colors other than the primary colors, the primary colors are "mixed" using +. For instance, pink is R+W, purple is R+B, and gray is W+K. Surprisingly, yellow is R+G; the only way to convince students of this is to have them try making yellow themselves in lab. More than two colors can be added: R+B+W+W is a pale lavender. Color addition is commutative.

Tell the students we can use Logo to create letters. Here's a program where the turtle draws a T:

HOWTO Draw
  T T
END
HOWTO T
  // Vertical line
  FD 50
  // Horizontal line
  RT 90 BK 20 FD 40
  // Get in position for next letter
  PU FD 30 LT 90 BK 50 PD
END
One interesting feature of this program is that there are three comments, on the lines beginning with //. When the computer sees a //, the rest of the line is ignored. This means we can put in a program comments in English that explain what is happening. This is very handy, because computer programs can be confusing.

The last line of HOWTO T lifts up the pen and moves the turtle into a good position for the next letter. Without this, the turtle wouldn't be able to draw two Ts next to each other.

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 Choose a letter to teach the computer to draw. This will be much easier if you choose a letter made up of straight lines! T and O are already done (see the picture on the right), you can use either of them if you want. Make sure you have a HOWTO Draw that tells the turtle to draw the letter.

  2. Add some color to your program. You can use these commands:
    • PenColor or PC
    • TurtleColor or TC
    • BGColor or BC (for the background)
    For colors, you can use
    • Red or R
    • Green or G
    • Blue or B
    • White or W
    • Black or K
    • Red+Green or R+G to make yellow
    • Red+Blue or R+B to make purple
    • Green+Blue or G+B to make teal (a greenish blue)
    • Red+Blue+Black or R+B+K to make dark purple
    • Red+White or R+W to make pink
    • Is that really pink? Try using two helpings of White: R+W+W
    • What color is Red+Green+Blue or R+G+B ?


Concluding Questions and Answers



Evaluation Activity