INTRO
THE
BASICS
GOING
FURTHER
ONE KEY
LOGO
3D
LOGO
IDEAS
TIPS &
TRICKS
LOGOSPIN
PROCEDURE
BANK
EXIT

GOING FURTHER WITH LOGO

Circles & Arcs | Randomness | Polygons | Stars | Recursion & Testing | Patterns


Circles and arcs the easy way:

It is valuable, and indeed important, that children realise that rudimentary circles can be drawn with a simple repeat command such as: repeat 360 [fd 1 rt 1]. To speed up development of ideas MSW LOGO offers a powerful way of creating circles and arcs using the arc command:

 

To create a circle with a radius of 80 you would use the command:

arc 360 80

to create a semicircle of the same radius you would alter this to:

arc 180 80

The commands circle and circle2 are also available to create circles of a given radius.

circle 50

creates a circle of radius 50 and with the turtle at the centre.

circle2 50

creates a circle of radius 50 with the turtle at the edge of the circle

How do you think this was made?

By using arc, circle or circle2 it is easy to create accurate LOGO pictures with curved edges. Try these challenges:


Introducing Randomness

One of the best ways of stimulating children in their LOGO work is to introduce the random command. The command random is usually followed by a number. E.g. random 16 would generate a random number between 0 and 16.

Try these procedures to explore the use of random:

repeat 500 [fd random 15 rt random 360] - This would make a line wander around the screen.

After creating a procedure to create a square try this:

repeat 30 [square penup rt random 360 fd random 50 pendown] - This rather long command will draw random squares on the screen, lifting the pen and moving it to a random location before drawing another square.

Try these challenges:


Making any polygon of any size with one procedure:

This very useful procedure introduces "variables." A "variable" is a letter or word that represents another value. When doing algebra with children we may say that X=5. X is a variable. In LOGO, variables can be "attached" to procedure names. In this example two variables are created :sides and :edge. The colon tells LOGO that :sides and :edge are variables rather than procedure names. (be careful not to use LOGO words as variables!)

First edit this procedure - called polygon (Note the divide sum in the second line 360/:sides - it divides 360 by the number of sides in order to calculate the amount the turtle has to turn at each corner)

to polygon :sides :edge
repeat :sides [fd :edge rt 360/:sides]
end

The command to activate it could be:

polygon 8 50 - this would create an octagon with sides 50 long

repeat 36 [polygon 6 40 rt 10] - this command would produce a circular pattern from a hexagon.

Try these challenges:


Making a Star

This procedure creates a simple star shape. Break it down to understand how it functions then try the challenges.

to star
repeat 10 [lt 60 fd 50 rt 120 fd 50 lt 60 rt 36]
end

Type the command star to create this shape:

 

Try these challenges:


Recursion, condition testing and labels

LOGO is an incredibly easy way of demonstrating the ways in which computers can carry out repetitive tasks and comparisons. The following procedure demonstrates two very powerful functions - Recursion and testing:

A procedure called countdown is defined with the variable :number attached to it.
The second line is a condition test. It checks to see if the value of the variable :number is equal to 0. If it is the procedure will stop. Otherwise the test is ignored and the next line is carried out.
The third line includes a label command that prints the value of :number to the screen and then moves the turtle.
The fourth line is very clever it tells LOGO to repeat the procedure countdown from the start, but this time it also reduces the value of :number by 1.

to countdown :number
if :number = 0 [stop]
label :number fd 20 rt 5
countdown :number-1
end

This is the command to start a countdown from 100:

countdown 100

 

 

 

 

 

 

Try these challenges:


Pretty patterns

The following powerful procedure combines variables, recursion and condition testing to create attractive patterns and shapes on screen.

First create the spiral procedure:

to spiral :size :angle
if :size > 400 [stop]
fd :size rt :angle
spiral :size+2 :angle
end

This command will create a neat spiral pattern, stopping when the sides reach 400 long.:

spiral 3 90

Changing the numbers will create some very effective patterns.

Create this pattern by using spiral 3 91

 

Try these challenges:

INTRO
THE
BASICS
GOING
FURTHER
ONE KEY
LOGO
3D
LOGO
IDEAS
TIPS &
TRICKS
LOGOSPIN
PROCEDURE
BANK
EXIT

The content and images within these pages is the copyright (c) of Mark Robinson and the children of Ambleside C.E. Primary School, 1999.