What is Logo?
Logo is an online programming software where you input instructions to make the turtle move around the screen. As he moves he leaves a line, showing you how he has moved. This can therefore be used to design and draw patterns and make shapes. Below you will see a table of instructions you can input to make the turtle move. Note that these instructions can be typed together to get the turtle to complete all the instructions in one go, or be input individually to make the turtle do each action separately. The turtle is based on coordinates (linking clearly to the mathematics curriculum), therefore it would be a good idea to get children to start by using Bee-Bots and getting it to move to a coordinate by inputting the instructions. This will allow children to understand the basics of Logo before even moving onto the program.
|
Alternatively, create a large grid on the playground and get children to give each other instructions to get to certain point on the grid. This can be done in a mathematics lesson (using coordinates, position, direction, angles and rotation) but will develop children’s computing and coding abilities. When you start the program the turtle will always start on the coordinates (0,0).
How does it work?
Command
Forward 50 / Fd 50 back 100 / bk 100 Right 90 / rt 90 Left 90 / lt 90 rt 180 Penup / pu Pendown / pd clearscreen / cs hideturtle showturtle repeat 100 […] print pos print xcor print ycor print heading towards list 0 0 seth (enter angle here) home setx 100 sety 100 setxy 50 20 arc 90 60 label “turtle setlabelheight 30 seth 90 label “turtle repeat 9 [penup fd 8 pendown repeat 4 [fd 5 lt 90] fd 5]. repeat 20 [fd 50 bk 50 rt 18] repeat 36 [rt 10 repeat 8 [fd 50 lt 45]] repeat 4 [fd 100 rt 90] repeat 3 [fd 100 rt 120] repeat 5 [fd 100 rt 72] repeat 6 [fd 100 rt 60] repeat 7 [fd 100 rt 60] repeat 8 [fd 100 rt 45] repeat 9 [fd 100 rt 40] repeat 10 [fd 100 rt 36] To ……. End This is called a procedure. setwidth (input number here) To square repeat 4 [fd 100 rt 90] end setcolor 8 (note the American spelling) print “hello random print random 16 setcolor random 16 To logocolour setcolor random 16 end repeat 4 [logocolour fd 100 rt 90] Make “p 3 print :p print sum (input two numbers here) make “x sum 4 6 print sum :x :p make “z difference :x :p print :Z to polygon :edges repeat :edges [fd 100 rt 360/:edges] end for [i 1 10 1] [print :i] for [i 10 100 10] [fd :i rt 90] for [i 20 100 20] [repeat 4 [fd :i lt 90]] to advance :thesize fd :thesize end to square :size repeat 4 [ fd :size rt 90] end to square :size if :size > 90 [stop] repeat 4 [ fd :size rt 90] square :size + 20 end to spiral :size if :size > 30 [stop] fd :size rt 15 spiral :size *1.02 end make "mylist (list "hi "hello) print first :mylist print second :mylist print last :mylist setcolor “red fill filled "yellow [repeat 4 [fd 100 rt 90]] readword make "name (readword [Please type your name]) do.while[ COMMANDS ]condition make "number sum random 99 1 do.while [ make "answer ( readword [choose a number between 1- 100] ) if :answer > :number [ print [ number too big ] ] if :answer < :number [ print [ number too small ] ] ] :answer <> :number print [ good job] |
What it does
The turtle will move 50 spaces in the direction it is facing. You can either write ‘forward’ or just use the letters fd. This command will make the turtle go backwards 100. You can either write ‘back’ or use the letters bk. You can input any number. The turtle will turn 90 degrees to the right. You can input whatever number you like and the turtle will turn that amount of degrees to the right. Just the letters rt is the same as writing ‘right’ and will work the same. The turtle will turn 90 degrees to the left. You can input whatever number you like and the turtle will turn that amount of degrees to the left. Just the letters lt is the same as writing ‘left’ and will work the same. The turtle will turn 180 degrees. This will lift the turtle from the page and he will no longer draw a lone when he moves. He will still be viable on screen. This allows you to move the turtle without drawing, and start elsewhere. The turtle will now continue to draw a line as he moves. Clear screen. This returns the turtle back to the beginning position, and you can start again. This will hide the turtle from the screen, but will not stop the line being drawn. It is harder this way to see which way he is facing. The turtle will reappear on the screen at the point where you finished the previous instruction. The turtle will repeat the actions typed in the square brackets 100 times. For example, if [rt 17 fd 33] was placed after the repeat 100, the turtle would continuously turn right and move forward 33 spaces, 100 times, but would do so all in one go. To find out the coordinates the turtle is currently at, enter this and they will display on the top left hand side of the screen. If you only want to know the x axis coordinate the turtle is currently at, enter this and it will display on the top, left hand side of the screen. If you only want to know the y axis coordinate the turtle is currently at, enter this and it will display on the top, left hand side of the screen. This will show the direction (angle) the turtle is currently facing on the top, left hand side of the screen. This will display the angle the turtle needs to tur to face the coordinates 0 0. You can enter any two numbers (instead of 0 0) to find out the angle the turtle needs to turn to face those coordinates. Once you know the angle you need to turn (see above box) to get to the inputted coordinates. Enter seth (set head), followed by the angle displayed in the top, left corner, after following the instructions in the previous box. The turtle will then face towards where that angle would be on a protractor. It will remain in the same place, but will pivot on the spot. The turtle will return to the starting point. The turtle will always start at coordinates (0,0), unless you set it otherwise (see instructions below). This will reset the starting coordinate on the x axis to 100. You can enter any number rather than 100. E.g setx 45 will start the turtle on coordinates (45,0) – if you have not changed the y axis. This will reset the starting coordinate on the y axis to 100. You can enter any number rather than 100. E.g sety 45 will start the turtle on coordinates (0,45) – if you have not changed the x axis. Setxy allows you to move the turtle to the given coordinates. If you do not command a penup first the turtle will draw a line from wherever it was to the new position. This will then set these coordinates as the starting ones. You can input whatever numbers you like, but in the given example the turtle would move to 50 on the x axis and 20 on the y axis. This will create an arc around the point at which the turtle is stationary. The first number tells you how much of the protractor the arc will cover. For example, here it is displaying 90, therefore the arc will cover 90 degrees. The second number indicates the radius (distance from the turtle to the arc). These can be any numbers you choose. Therefore, if you, for example set it to arc 360 100, this would create a circle around the turtle, at a distance away of 100. This command will write the word following the “ in the direction the turtle is facing. The turtle will remain in the same position. This will set the size of the writing (see above command) to the font size corresponding to the number you input. Therefore, here the font would change to size 30. Once this is done, the all following inputted text will be this size, until you change it again. This command will change the turtle to face the 90 degrees’ mark on the invisible protractor and then write the word turtle at that given angle. This is a nested loop – a loop inside a loop. Here you will create 9 squares in a column, each square is a distance of 8 away from each other and has lengths of size 5. You can put any commands inside nested loops. This command will create a star pattern as the turtle is going backwards anf forwards, and turning the small angle create an asterisk or star shape. You can input any length (here 50 has been used) and any number of time (here 20 has been used). In this example the star will have 20 lines/points. To calculate the angle of each movement (here is it 18) divide 360 by the number of lines you want. E.g 360 divided by 20 is 18. This command will create 36 octagons in a circle. The turtle will pivot 10 degrees 36 times, and within that draw an octagon (8 sides) with a length of 50. This will create a geometric shape/pattern. Any numbers can be inputted, however you need to ensure, mathematically, they work, or the shape may look strange. This will draw a square with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 4 is 90. This will draw a triangle with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 3 is 120. This will draw a pentagon with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 5 is 72. This will draw a hexagon with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 6 is 60. This will draw a heptagon with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 7 is 52 (rounded up). This will draw an octagon with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 8 is 45. This will draw a nonagon with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 9 is 40. This will draw a decagon with 100 length sides. To calculate the angle, you work out 360 divided by the number of sides. Therefore, 360 divided by 10 is 36. This allows you to teach the turtle a command for the time in between the To and End. For example if you want to create a line of dashes you need to input dashline in between To and End as it is a new command the turtle doesn’t already know. This will make ‘dashline’ a new command. This would need to be inputted as: To dashline repeat 5 [setwidth 1 fd 10 setwidth 3 fd 10] end. You can input whatever numbers you like, depsnding on what you want the length and width to be. This will mean that the small part of the line has a width of 1 and the thicker part a width of 10, forming a dash like pattern, both with a length of 10 each time. This will be the same each time, so now when you type dashline, as a command, a dash line will appear in the length set in the previous loop. This allows you to set the width of the line you are drawing. Input a number to tell the turtle how thick or thin you want the line. This will tell the turtle that if you type square you want it to draw a square with side lengths of 100. From then on whenever you type this new command, a square the imputed size will be made. This can be done for any shape or new command you want to make. Just choose the name of your new command and input how you want it to be drawn in the loop. The turtle can draw in 15 different colours. To change the colour, use this command, followed by the number of the colour you want it to change to. Using the print command followed by the “ will display the word inputted after the “ in the top, left hand corner of the screen. This tells the turtle you want it to select random something from the choice given (see box below) This will tell the turtle to generate a random number between 0 and 16. This will instruct the turtle to choose a new pen colour at random. This will set the command ‘logocolour’ to pick a random colour for the turtle to draw with. This will instruct the turtle to draw a square with randomised coloured sides. You must set logocolour as an instruction as a command (see above box). A variable can remember the value set to it, use this command, inputting whatever name you want your variable to have instead of y and the number you want its value to be instead of the 3. This will show the value of the variable you have created (in this instance p) in the top left hand corner of the screen. The colon is crucial here for it to show the variable rather that the letter. This command followed by two numbers will give you the total displayed in the top left hand corner of the screen. This will create a variable that states x is the sum of 4 and 6. Therefore x has a value of 10. Input any name and number in place of x and the 4 and 6. This command will add together the two variables x and y and display their total in the top left hand corner of the screen. In this example x was set as the sum of 4 and 6 (10) and p was set as 3. Therefore the total shown after this command was 13 (10 + 3). This command will set z to be a variable that is the difference between the value of x and the value of p. As Z was set as a variable to show the difference between x and p, this command will show this difference in the top left hand corner of the screen. This allows you to set a shape using a formula. Here we are telling the turtle to create a polygon where the edges repeat and the edges are of 100 length with an angle of 360 divided by the number of edges. This is the same process as before, just demonstrated in a different way. This command is another way to create a loop. Here we are saying that i (variable name) has an initial value of 1, and an end value of 10, going up in 1’s. Then telling the turtle to display what i is on the screen at the top left hand side. Alternatively, if the second 1 in [i 1 10 1] was a 2, it would display every other number in the sequence. This can form a pattern. This command will create a square spiral. Here we are telling the turtle that I start at ten and ends at 100 moving in 10’s. We are also telling it that each time i is completed the turtle then needs to turn right 90 degrees before continuing. It will stop once it reaches the end number. You can input any numbers in to this command. This command will create a range of squares, as here we are telling the turtle that i starts at 20 and ends at 100, moving in 20’s. Then it will repeat 4 times that It will move forward depending on where it is in the sequence of I and turn 90 degrees left in between each side of the square. This command will tell the turtle that the new command ‘advance’ will tell him how far he can advance (his perimeters). When the advance command is used followed by a number, he will move that number of spaces forward. This will create a new command square. The :size is determined at a later date, when you input the command followed by a number. Meaning the turtle will make a shape that is of the commanded size, with 4 sides, of the commanded length, turning 90 degrees in between each line. :size determines the perimeter of the square you want to create. Meaning when you then give the turtle the command of square 40, it will draw a square with a perimeter of 40. This command is an example of a recursion. Basically this is saying that you want the turtle to create a square, however, if the size is greater than 90 you want it to stop (it will not perform the action). However if it is less than 90 (such as square 50) it will create squares, adding 20 each time, until it goes over 90. This command will set the word ‘spiral’ as a new command. Here we are telling the turtle that if the size entered after the command is greater than 30 it should stop and not complete the action. If it is less than 30 is will move forward whatever the size given was, then rotate 15 degrees. The 1.02 determines the distance between the spiral lines. This command will set mylist to be a command involving the two words following “ in the brackets. When print :mylist is then commanded, the words will appear in the top left hand corner of the screen. This will make the first word in the commanded list (see above box) appear in the left, top corner of the screen. This will make the second word in the commanded list appear in the left, top corner of the screen. This will make the last word in the commanded list appear in the left, top corner of the screen. Once you have created a shape, make sure the turtle is inside the shape you want to fill (make sure you lift the pen up so it doesn’t draw a line and put it down again once it is in the shape), then enter this command. Change the ‘red’ t be any colour of your choice and your shape will change to that colour. If the turtle is not inside the shape, it will change the background to that colour, instead of the shape. This command will create a square (as it has 4 sides and a rotation of 90 degrees) that has sides of 100 in length and is filled in yellow. This command allows you to type a word into the programme. Therefore, if you input make “name readword, then type in your name into the box that pops up. When you then type print :name, your typed name will show on the screen. This command will create a box that pops up, asking the user to enter their name – like you would find at the beginning of a video game. This command allows you to input information in the space where COMMANDS is and the conditions. This will result in the command running until asked to stop. This can be used in game situations where the gamer continues to do something until a certain point. This command creates a game where the computer generates a random number, which needs to be guessed by the player. If the inputted number is too big, a message will say so, and similarly if the number is too small. Once the correct number is guessed, the game will end and the turtle will display a good job message. |
References
Turtle Academy (2017) [Online] Available at: https://turtleacademy.com/. (Accessed: 24.4.2017)
Screenshot image. [Online] Available at: https://turtleacademy.com/. (Accessed: 24.4.2017)
All other images copyright free, accessed via Pixabay.com
The authors are not taking ownership of any images or videos on this website, unless stated otherwise on the respective pages, and therefore have attempted to make contact with all owners of images and videos used on this website.
Screenshot image. [Online] Available at: https://turtleacademy.com/. (Accessed: 24.4.2017)
All other images copyright free, accessed via Pixabay.com
The authors are not taking ownership of any images or videos on this website, unless stated otherwise on the respective pages, and therefore have attempted to make contact with all owners of images and videos used on this website.