WINLOGO � lesson 1
What is "Winlogo"?
Winlogo is a programming language. You can create paths and shapes by typing in a set of instructions. When you open Winlogo there are three windows as shown below.
Some basic commands
(Note: you must leave a gap between the direction instruction and the number, e.g. FD 50. It does not matter if you use lower or upper case letters)
fd 50 forward 50 units
bk 100 backward 100 units
rt 90 right turn of 90�
lt 67 left turn of 67�
pu pen up (the turtle will not draw)
pd pen down (the turtle is ready to draw again)
penerase the pen now becomes a rubber
setpc 10 set pen colour (this allows you to alter the colour of the pen)
ht hide turtle (the turtle becomes invisible)
st
show turtle (brings the turtle back from invisibility!)fill
when the turtle moves inside a closed outline, the enclosed area can be coloured using the fill commandcs clear screen (this clears the graphics window)
home returns the turtle to its starting position and orientation
Demonstration of the commands in use
Open Winlogo � your teacher will explain how.
In the Work window, type the following exactly as it is shown below:
load "demos
Now type:
demo.comm1Watch the demonstration.
When you are asked if you wish to view another demonstration, type:
y
(return)demo.comm2
Repeat this for
demo.comm3.Are you ready to have a go at programming the turtle?
If not, watch the demonstrations again or ask your teacher for help.
Activity
Type:
load "targetsYou now have a choice of activities. To access an activity, you only need to type its name e.g. home1 � note there is no space between the name and the number.
The activity choices are:
home1 home2 home3 home4
target1 track1 track2 track3
goal2 goal2
Plenary questions
What use could you make of Winlogo in your school work?
How might Winlogo be used outside of school, say, in industry?
List as many possible uses as you can think of.
Homework
Imagine a simple pattern made up of 5 or 6 straight lines. Try to make your pattern interesting by using different sizes of turns (i.e. not just turns of 90�).
Use a ruler and protractor to make a scale drawing of your pattern. Use a scale of 1cm to 10 units.
Now list the Winlogo instructions you would need to create your pattern on the computer.
WINLOGO � lesson 2
What is a "procedure"?
A procedure is a set of instructions that have been given a name. The turtle recognises the name of the procedure and follows the instructions contained within the procedure.
For example, a procedure called
squ might contain the following instructions:fd 50 rt 90
fd 50 rt 90
fd 50 rt 90
fd 50 rt 90
To get the turtle to draw a square you just need to type in
squ instead of the whole list of instructions.How do you write a procedure?
To begin with Winlogo does not understand the instruction
squ or any other procedure name. You have to �teach� it the list of instructions you want your procedure to mean.Here is a set of instructions that can be used to teach Winlogo to draw a rectangle:
Demonstration
Type:
load "demosThen choose:
demo.procActivity
Type:
load "7tasksTask1 looks like this:
Use a procedure to help you to generate instructions for this shape. Start your procedure like this:
To tee
fd 100
rt 90
� �
� �
end
Use procedures to help you to draw the required shapes in task1 � task10.
Plenary questions
Imagine the outline of a simple house. Which shapes would you need to create a picture of the house? How could you use procedures to make it easier for you to programme Winlogo to create the picture?
Look at the demonstration
demo.super (you may need to type load "demos first).Super procedures allow you to break pictures down into smaller parts and then put these parts back together to create the overall design.
Did you notice that in some designs you needed to repeat certain instructions?
Here is the procedure
rect that we created earlier:
Homework
Design a picture or pattern that can be broken down into smaller parts. List the procedures you would need to create the picture. Write out instructions for your procedures making them as short and efficient as possible.
WINLOGO � lesson 3
Reviewing Procedures
(Look back at the notes in lesson 2 as a reminder on writing, using and editing procedures)
Here is a procedure for a shape:
to patt
repeat 4 [fd 50 rt 90]
end
What is the first line
to patt for?Explain what the instructions on the second line mean.
What is the third line
end for?What shape will be drawn when you use this procedure?
Type the procedure into Winlogo.
Now edit the procedure to produce:
Activity
Type:
load "8tasksUsing procedures, work through task1 to task8. Whilst tackling these tasks, try to identify when you could use the REPEAT command to make your procedures more efficient.
Plenary questions
This procedure produces a rectangle:
To quad
repeat 2 [fd 50 rt 90 fd 100 rt90]
end
Homework
Consider some rectangular tiles that are twice as long as they are wide.
How many different tessellations can you make with these tiles? How can Winlogo be used to produce these tessellations using the computer?
WINLOGO � lesson 4
Introducing variables
Imagine you are trying to describe this pattern to someone over the telephone:
How would you describe it as simply as possible?
You might have mentioned that the pattern basically involves 5 squares of different sizes. If you were to use a �square� procedure to generate this pattern using a computer you would need five different procedures, one for each size of square.
Alternatively, you could introduce a variable into your procedure.
Type the following into Winlogo:
to squ :s
rt 90
repeat 4 [fd :s lt 90]
fd :s lt 90
end
Now type:
squ 20
squ 30
squ 40
squ 50
Observe what happens to the size of the squares.
Here is another procedure with a variable:
to star :n
repeat :n [fd 50 bk 50 rt 360/ :n]
end
Type in the procedure and try to discover what the variable is this time.
Activity
Load "8tasks
Do task9 and task10.
Load "polygons
Choose poly1 if you feel you need further practise with basic procedures.
Choose poly2 for an exercise with procedures involving simple variables.
Choose poly3 for an exercise involving harder procedures.
Plenary questions
Load "debugs (Be patient whilst it loads!)
Can you find errors in the procedures? Try debug1, debug3, then debug2.
(You can maximise the Work window to see all of the instructions for each procedure.)
How does using procedures help you to create an accurate and efficient set of instructions?
Homework
This tiling pattern can be found in the Alhambra Palace in Granada, Spain.
How would you describe the pattern over the telephone to someone who has never seen it?
The pattern can be made using these two tiles.
Suggest how to construct them using Winlogo.
What other patterns can you make with these two tiles?
WINLOGO � lesson 5 & 6
Using Winlogo in a mathematical investigation
You are going to use Winlogo to investigate the link between a sequence of numbers and the �spirolateral� they produce.
In carrying out your investigation, you will have to decide what use you can make of Winlogo. You should aim to use Winlogo as effectively and efficiently as possible. You will have up to two lessons using the computer to carry out your investigation. Following the computer lessons, you will be asked to evaluate your work.
In the evaluation you will be asked to explain what use you have made of Winlogo and how successful, effective and efficient your programming was. You will find it helpful to note down any problems you experience during the activity and how you overcome these.
What is a Spirolateral?
A spirolateral is a pattern that is generated by drawing round and round using steps that are identified by a sequence of numbers. For example, this spirolateral is based on the sequence (2, 3, 1).
The first 7 steps are shown below (starting at the red dot).
Investigate�
What happens when you use a different sequence of numbers, eg (3, 2, 4), (3, 6, 2)�? What if you used longer sequences of numbers, e.g. (3, 4, 1, 2)� (4, 5, 1, 3, 1)�? How many different patterns can you make? Which sequences lead to closed patterns? Which lead to open patterns? Can you predict the pattern given a sequence of numbers?
What happens if you change the rules? For example, how will the pattern be changed if you alter the angle of the turns?
Homework
Continue your investigation. For example, you could decide which sequences of numbers you will use and write sets of instructions based on these numbers. Alternatively, you could write up what you have discovered about sequences of numbers and the patterns they generate.
(Remember - use your homework time sensibly as you will have to write an evaluation of your investigation and how you have used Winlogo in carrying it out.)
You will need to make
a copy of your procedures to hand in with your evaluation.
WINLOGO � lesson 7
Reviewing efficient procedures
Here is a procedure for a shape:
to quad
fd 50 lt 60 fd 50 lt 120
fd 50 lt 60 fd 50 lt 120
end
What do you think this procedure draws? How can you make it more efficient?
Type your efficient procedure into Winlogo.
Now try this:
to pattern
repeat 8 [rt 45 quad]
end
What is the order of rotational symmetry of the pattern? How can you edit this procedure to produce a shape with rotational symmetry of order: 4, 6, 10�
Here is another procedure:
to big :s
repeat 6 [fd :s rt 60]
end
What is the
:s in the first line for?Explain what the instruction
fd :s on the second line means.What shape will be drawn when you type
big 50? big 30? �(If you need more reminders about variables, look back at lesson 4.)
Activity
Load "9tasks or "starters - your teacher will tell you which file you need.
Use procedures and, where appropriate, variables to produce the shapes in task1-task8 (or starter1-starter10).
Plenary questions
The procedure on the right will produce squares of
differing sizes and colours.
Who might use this procedure? When?
Why would it be better to use a Winlogo procedure
rather than another drawing application?
How could you add another variable so that your procedure can be used to draw other regular polygons? Is there more than one way to do this? What type of variable would you add to give the most efficient procedure?
Homework (S/C)
Here is a sketch of a different solid.
Name the solid.
Draw a diagram to show a suitable net for this solid.
Now write a list of instructions to produce your net using Winlogo.
Homework (C/E)
WINLOGO � lesson 8
Introducing a user-interface
Imagine you wanted to create an
abstract pattern such as this
using Winlogo.
You will notice that the pattern
is made up of equilateral triangles
of different sizes and colours.
This procedure can be used to
draw a triangle of any size and any colour:
to tri :s :c
setpc :c
repeat 3 [fd :s rt 120]
end
tri 100 231
produces a triangle of size 100 units and colour lavender.A user-interface sets up a series of questions for the user to answer in order to perform the same task in different ways.
Often, especially when you are working with several procedures, you will forget how many variables to enter and what they are for. The interface will remind you.
We are going to change the procedure
tri :s :c so that it is easier to use.to tri
print [How big do you want the triangle?]
make "s rw
print [What colour would you like the triangle?]
setpc rw
repeat 3 [fd :s rt 120]
end
Activity
Now edit the procedure so that it produces solid (filled in) triangles.
Further Winlogo activities
Load "9tasks and do task9 and task10.
Plenary questions
to star
repeat 8 [fd 60 bk 60 rt 45]
end
to spiral
repeat 90 [star rt 4 fd 5]
end
spiral
These sets of instructions produce the spiral shown above.
Suggest ways that we could adapt these instructions so that they produce a greater variety of spirals, such as those shown below.