Example: air traffic controller

MSW Logo – Workbook 1 - AMK Premier High School

Page 8 MSW logo Workbook 1 A FEW MORE COMMANDS The boundaries of your screen are controlled by the commands WRAP, FENCE and WINDOW. WRAP If the turtle is asked to move past the boundary of the graphics window, it will "wrap around" and reappear at the opposite edge of the window FENCE if the turtle is asked to move past the boundary of the graphics window, it will move as far as it can and then stop at the edge with an "out of bounds" error message WINDOW if the turtle is asked to move past the boundary of the graphics window, it will move off screen.

Page 4 MSW Logo – Workbook 1 Command What it does PU Turtle’s pen is up (so it doesn’t draw as it moves) PD Turtle’s pen is down (so it does draw as it moves) PE Turtle erases as it moves. HT Hide turtle (removes turtle triangle from screen) ST Show turtle (makes turtle triangle visible again) HOME Returns Turtle to the “home” position in

Tags:

  Logo, Workbook, Msw logo workbook 1

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of MSW Logo – Workbook 1 - AMK Premier High School

1 Page 8 MSW logo Workbook 1 A FEW MORE COMMANDS The boundaries of your screen are controlled by the commands WRAP, FENCE and WINDOW. WRAP If the turtle is asked to move past the boundary of the graphics window, it will "wrap around" and reappear at the opposite edge of the window FENCE if the turtle is asked to move past the boundary of the graphics window, it will move as far as it can and then stop at the edge with an "out of bounds" error message WINDOW if the turtle is asked to move past the boundary of the graphics window, it will move off screen.

2 The visible graphics window is considered as just part of an infinite graphics plane; the turtle can be anywhere on the plane. You can find out the difference between them by typing these codes. CS WRAP FD 900 CS FENCE FD 900 CS WINDOW FD 900 RANDOM [n] Produces a random number that is less than the number n Now, try and work out what this piece of code will produce CS WRAP REPEAT 2000 [SETPC RANDOM 16 SETPENSIZE [20 20] FD RANDOM 100 RT RANDOM 360] Think about it first and then see whether it turns out as you expected. MSW logo Workbook One YEAR 7 Highgate Wood School Page 2 MSW logo Workbook 1 Using the Basic logo Commands draw out the shapes you expect to get with these instructions.

3 1) CS FD 10 RT 90 FD 10 RT 90 FD 10 RT 90 FD 10 2) CS FD 10 RT 120 FD 10 RT 120 FD 10 Basic logo Commands 3) CS FD 10 LT 60 FD 10 RT 60 FD 10 4) CS FD 10 LT 90 BK 10 RT 60 FD 10 5) CS FD10 LT30 (n = the number you type in) FD n Cursor moves forward n units BK n Cursor moves backward n units RT n Cursor turns right by n degrees LT n Cursor turns left by n degrees CS Clears screen There must be a space between the command and the number Page 7 MSW logo Workbook 1 TA S K Look back on the commands that you already know and use them to control the movement of the turtle on screen to create a range of interesting shapes.

4 You can put your name on them by using the command: LABEL [Your name] Try and keep a record of screenshots of the programming that you have done. Extra credit will be given for those who show evidence of them finding errors in their programming which they then correct. Most of the time errors occur because you forget to leave a space between the command and the argument. But things also go wrong when you don t spell a command correctly. If it is not exactly a command that MSWLogo recognises it will not be able to do anything and just return an error message LEARNING What are you doing this for?

5 Putting instructions in sequence is one of the most important aspects of ICT. Working through lines of code in a logical and thoughtful way working out what they mean and why they might not be giving the results that you had expected is a vital When you are working with MSW logo try not to just type in the examples you are given. Try and think about what you want the turtle to do on screen first and then think of the instructions you should give. It is fine to make mistakes. It is probably the best way to learn programming! Page 6 MSW logo Workbook 1 Now that you know the repeat function you can create some procedures much more quickly and efficiently.

6 For example, to draw a square: REPEAT 4 [FD 40 RT90] To draw a triangle: REPEAT 3 [FD 50 RT 120] To draw an octagon: REPEAT 8 [FD 50 RT 45] To draw a circle: REPEAT 360 [FD 20 RT 1] Try and create all these shapes. Change the arguments, so they are larger or smaller. You can change the Commands too. What will happen if you replace FD with BK or RT with LT? You might also want to change things like the Pen Colour. Experiment with using the REPEAT command until you are confident that you can do it, and correct the errors you might make You are now ready to make many more interesting shapes. You can use the REPEAT command more than once. What do you think you would get with the following set of instructions: REPEAT 100 [REPEAT 3 [FD 50 RT 120] RT 10] Test it out!

7 This shape was created using REPEAT 40 [REPEAT 360 [FD 1 RT 1] RT 10] Finding errors and correcting them is more important than anything . Page 3 MSW logo Workbook 1 Now that you have launched MSW logo you should go through the earlier procedures and see if your answers were right. Carry on using the basic commands with MSW logo until you are confident that you can do it. The most common error is to forget to put a space between the Command and the Argument. Command What to do Argument By how much Return (Enter ) Do it! Main logo Screen Input your instructions in the Input Box of the commander window This is the main MSW logo screen where the results of your instructions to the turtle are shown There are useful functions on the toolbar with short cuts to changing the colour, the ability to save the screen image and lots of Help files Buttons on the Commander Window allow you a variety of options, including the Halt function which stops the procedure that is running If you want the turtle to return to its original position simply type in the Command HOME.

8 Page 4 MSW logo Workbook 1 Command What it does PU Turtle s pen is up (so it doesn t draw as it moves) PD Turtle s pen is down (so it does draw as it moves) PE Turtle erases as it moves. HT Hide turtle (removes turtle triangle from screen) ST Show turtle (makes turtle triangle visible again) HOME Returns Turtle to the home position in the centre of the screen (you should issue a PU command to prevent it drawing its return path)

9 LABEL [word] Displays the text you have written at the Turtle s location. SETPC [n] Sets the pen colour depending on the number you have written (between 0 and 15). [4 is red, 2 is green and 1 is blue] SETPENSIZE [n n] Sets width and height of the drawing pen. MSW logo uses only the second value. SETSC [n n n] Sets screen colour (the numbers are the intensity of red, blue and green and can be between 0 and 255) BYE Exits MSW logo MORE MSW logo COMMANDS Page 5 MSW logo Workbook 1 Practise using these new explore what happens.

10 Don t worry if you make a mistake, simply type CS to clear the screen and then start again. Program logo to draw a red box, and then a blue triangle. There are different ways of saving your work from logo . If you press the Prt Sc key you will have take a snapshot of your screen and you will be able to paste that into Word and then save it. Alternatively you could save the work on your MSW logo screen as a picture by clicking on Bitmap in the toolbar and then saving it under an appropriate name in your user area. Finally you can also click on File and save the work as a logo file (*.lgo) in your user area. MAIN TASK SAVING YOUR WORK FROM MSW logo QUESTION What shape would you get with the instructions FD 10, RT 1, FD 10, RT 1.


Related search queries