
Logo. Lesson 1 Logo will involve programming instructions to control
a cursor around an area on the computer screen. |
1. Open MSWLogo, click on Start > Programs. 2. Click OK on the form. 3. Your screen should look like this:
The screen appears in three sections: top section where the object draws for you; middle section which stores your commands; and the thin bottom section where you type in your commands.
|
4.
Some basic commands are:
|
5.
These basic commands have their own shortcut code, see table below: |
6.
To draw pictures you will need to move the object, this needs an instruction forward,
and a number to tell the object how far to move.
|
Try the following
command and see what happens: |
8.
Other really useful commands:
|
9. Try out some of your own designs, or even try to write your own name (this is really tricky).
|
10.
Repeat. Repeat is for when you want the same command repeated a number of times.
If you were drawing a square you would need to type four times: Try it, the repeat will do what is in the brackets as many times as the number you typed in before the brackets.
Note all the instructions are displayed in the middle box. Warning:
because Logo is a programming language you have to type in the commands exactly.
This means using the correct brackets, and leaving a space between the command
and the number.
|
Lesson
2.
|
| to
square (means
make a function called square) repeat 4 [fd 40 rt 90] (this makes a square) end (ends the function) square (this runs the function square) Question:
how would you draw an octogon (8 sides)? How
would you draw a triangle? Hint: the angle would need to be
rt 120. |
| to
polygon :length
(function called polygon, the length is entered later) repeat 6 [fd :length lt division 360 6] (6 sided figure, for any other replace 6) end polygon 30 (this runs the function the length of the sides is 30) Question:
How would you create a circle using this function? |
| to
polygon :length :num (length
and number of repeats entered later) Repeat :num [fd :length lt division 360 :num] end polygon 5 120 (this runs the function you type in the variables: 5 and 120) |
| A
program using a function within a function: to
figure :s :a rotate 20 90 (Try other numbers for other designs). Try to create some
designs of your own. |
Exercises:
TO
PETAL |
Write a functiom for printing six rows of six circles each, as shown in the figure, and call it CIRCLEGRID.
REPEAT
45 [FD 1 RT 8] TO ROWOFCIRCLES REPEAT
6 [SMALLCIRCLE RT 90 PENUP FD 15 LT 90 PENDOWN]
Note: ROWOFCIRCLES
prints a row of six circles and places the turtle on the left edge of the next
row of circles. |