Logolab 1
Logolab 1
A turtle appears in the center of the screen; a flashing square appears at the bottom of the screen (called a
cursor).
Now move the turtle move around the screen. After each line hit the enter key and see what the turtle does:
forward 50
right 45
forward 30
left 90
back 100
cg (an abbreviation for "clear graphics")
If you make a typo (type the wrong letters) the computer will give you an error message. Be sure to write
down any error message you get so we can talk about it later.
This table tells you some short cuts so you don't have to type an entire command each time you use it.
II. Problems
_____________________________________________________________________________
(b) Clear the screen again (cg). Now type rt 30 fd 250. Describe the computer screen.
______________________________________________________________________________
(c) Draw a square on the screen. Write down the commands you used to get the square.
_____________________________________________________________________________
(d) Draw the letter H on the screen. Record the commands you used to get it:
_____________________________________________________________________________
_____________________________________________________________________________
III. penup, pendown, repeat
Suppose you wanted to draw an H and X on screen with a space in between the letters. You can accomplish
this by using the penup (pu for short) command. Type
fd 25
pu
fd 25
To get the turtle to draw again, type pendown (pd).
pd
fd 25
The last command to be introduced in this lesson is the most powerful. The repeat command will allow you
to produce beautiful patterns on screen with ease. Let's type in some examples to see what repeat can do.
First let's use repeat to draw a square
cg pd (we type pd to make sure the turtle will draw!)
repeat 4 [fd 50 rt 90]
After the word repeat came the number 4. What ever occurs inside the brackets [ ] will get repeated 4 times.
So 4 times the turtle went forward 50 and right 90.
IV. Problems
(a) Repeat, penup and pendown can be used to draw a dashed line.
Will the pen be up or down after this line is entered into the computer? (Test by telling the turtle to move
(b) Repeat can be used to make other regular pentagons; for example:
Example Try these; the angle may take some guessing.
repeat 3 [fd 50 rt 120] Octagon Pentagon
draws a Triangle
If you get these figures, try to draw, a heptagon (seven sides), decagon and dodecagon.
Also, ask Mr. O'Roark for extra credit work.