Handout 1

Here are some suggestions to get you started using LOGO. Commands you type into the computer and the computer's textual responses to those commands will be written in this font. Instructions and explanations appear in the normal default font.


Start the UCB Logo program by holding down the mouse button on the apple in the upper left corner of the screen and selecting the LOGO icon from the menu that appears. An empty window appears; type LOGO commands into this window.

At its simplest, the LOGO language moves a "turtle" around on your computer screen. The turtle leaves a trail as it moves, so you and your students can use LOGO to draw pictures. Because LOGO is an interpreted language, you can see its response to your commands right away. This immediate visual feedback should help your students learn quickly.

The commands FORWARD and BACK make the turtle move and leave a trail. They can be abbreviated FD and BK. Try this:

FORWARD 70
BACK 50
The turtle moves forward 70 steps and back 50 steps. You can see that the turtle's final position is different from its starting position.

The commands LEFT and RIGHT (abbreviated LT and RT) turn the turtle some number of degrees to left or right. Experiment with these commands:

RIGHT 70
FORWARD 30
LEFT 20
FORWARD 50
If you want, you can put several commands together on the same line:
RT 90 FD 20 RT 90 FD 30 RT 90 FD 20 RT 90 FD 30

If you make a mistake when typing, LOGO will tell you it doesn't understand your command:

? ROGHT 90

I don't know how   to ROGHT.

If you don't like what's on your screen, you can reset it to its initial blank state with the turtle at the center of the screen using the CLEARSCREEN command (or use CS). Try this now.

If you don't want the turtle to leave a trail as it moves, use the PENUP command (or PU). You can put the pen back down using the PENDOWN command (PD).

FD 40
PENUP
FD 40
PENDOWN
FD 40

When you are done with LOGO you can quit using the command BYE. Try to do the following:

  1. Clear the screen and draw a square.
  2. Draw a triangle.
  3. Write your initials on the computer screen using LOGO. Use only as many commands as needed to make each letter recognizable; this way you will be less frustrated if you make a mistake and have to start over.
The great thing about computers is that they can reliably do the same dull task over and over. In LOGO, the simplest way to do this is to use the REPEAT command. This command requires two arguments -- the number of times to repeat and the thing to repeat. The thing to repeat is enclosed in square brackets. Here's a simple example:
 
REPEAT 4 [FD 90 RT 90]
The thing to be repeated can be typed on several lines if necessary:
REPEAT 4 [
FORWARD 90
RIGHT 90
]

Use the REPEAT, PU and PD to draw a dashed line on your screen.

Now use the repeat command to make a triangle; a five pointed star; a pentagon. What command would you use to make a regular polygon with 7 sides? What about a polygon N sides, where N is some unknown integer? Experiment with making star-like pictures using the REPEAT command. For example, try:

REPEAT 5 [FD 50 BK 50 RT 72]

Mtht420