Programming a screen turtle
Today we started our new computing topic – Repetition in Shapes.
We each used a version of computer programming tool Logo, called Turtle Academy, and learnt to use basic computer commands to control a screen turtle. By inputting basic text-based commands accurately, we were all able to direct the turtle where he needed to go. We created our own working computer code!
Programming Letters
Using our learning in the previous lesson, we created algorithms and wrote them as Logo commands to draw a letter on the computer. Some children in the class even managed to draw very complicated letters, like X and W. Whilst competing our letters, we had to debug our computer code – fixing any mistakes we make as we go along.
Patterns and Repeats
Can you see the pattern? Which part is repeated? How many times is it repeated?
We have been looking at repeating patterns and how we can write instructions for them.
These are our instructions for drawing a square:
We learnt that we can use the word 'repeat' in our instructions so that we don't need to keep saying/writing the same thing over and over.
Therefore, we discovered that we can use a repeat command in a count-controlled For loop. For example:
REPEAT 4 [FD 100 RT 90]
Breaking things down
We learnt to use a procedure in a program.
A procedure is a named code snippet that can be run multiple times.
We can create a procedure so that we will save time later on - as we will run the whole code snippet by just typing the one word that we used as a procedure name.
We can create a procedure to make a square:
To write a procedure for a square:
TO square
repeat 4 [fd 100 rt 90]
END
To run a procedure type its name e.g.
square
We used this method for a hexagon, a pentagon and a triangle, too.