MSW LOGO 2 MSW LOGO is a programming language that lets you store a series of instructions on the computer. You can write routines based on the commands you have learnt earlier (refer to MS Logo 1). 1
You can write an abbreviation rather than the full command. COMMAND ABBREVIATION FUNCTION FORWARD FD Moves the pen forward BACK BK Moves the pen backwards LEFT LT Turns the pen left RIGHT RT Turns the pen right PENUP PU Lifts then pen up so that does not draw a line PENDOWN PD Puts the pen down again Repeat REPEAT will draw a square, equilateral triangle, a hexagon & octagon. You can make some amazing patterns and you can have a repeat within a repeat. Angle to turn 360 no. of sides of the shape. The REPEAT command can also be used for patterns To draw a star - REPEAT 8 [FD 100 RT 135] You can draw shapes on shapes and change colours or the length. Try others a repeating pattern using an angle less than 90 a repeating pattern using an angle between 90 and 180 2
Saving files MSW logo is not Microsoft so you cannot go to File, Save as you would in Word. Instead it is under Bitmap, SaveAs When you save the file it will be as a type of logo file with a prefix of.lgo. To see this as an image file you must SaveAs a file type of.bmp A.BMP file is a high resolution image file and can be viewed in thumbnails or in image manipulation software such as Paint or Photoshop. (Note don t try to save it as a GIF file it won t work). 3
Loading a background Provided that an image is a.bmp file you can load it as a background and draw over it. You need to select Bitmap, Load then get the file. The file must be big. (Note if you set the screen colour after loading the file it will write over it) Once you have a background you can draw shapes on it. A star would be repeat 8[fd 100 rt 135]. Note if you make the pensize wider it becomes a flower. 4
ROUTINES & PROGRAMS IN LOGO For example a routine or program to create a square in the Endall box: You then File, save and exit. Note that you must write end on a new line. Using the Commander you then type in square. 5
The principle is the same for other equilateral shapes and also can be used for repeated patterns. For instance star. You can also draw a star by turning an angle of 150. And if you make the pensize bigger it will draw a flower and not a star. Moving the pen There are coordinates for places on the screen x & y. You can make the pen go move to a random place by placing coordinate values. Note these are round brackets to randomplace penup setx (random 600) - 300 sety (random 300) - 150 pendown end Note you can have several commands in an Endall program provided you differentiate with to & end 6
Programming the attributes (set) screen and pen attributes The MSW LOGO commander will let you give instructions to the pen and screen but you cam program commands to change the attributes in the commander and in Endall. You don t use Set on the tool bar but in the code. Pen colour Setpc n (where n is a number) will set the pen to a colour that has a value of a number. Setpc 4 - will set the colour of the pen to blue Other colour values are (1 is blue, 2 is green, 4 is red, 5 is purple ) Screen colour In the same way you can set the screen colour so: Setsc 4 - will set the screen colour to blue You can incorporate these into the Endall statements. For instance you can create a shape with different colours out of text using the label command. 7
Using several commands to create random effects In Endall write two routines (hello & place) as follows: to hello repeat 4[pu fd 150 label "hello_i_am_random" rt 76.89236472868 fd 50 pd] end to place pu setx (random 457) - 298 sety (random 120) - 222 fd 40 rt 94.234234 end save & exit hten type in the commander repeat 1000[place setpc (random 255) +1 hello] In the commander you can also make the scrren colour change repeat 1000[place setpc (random 255) +1 setsc (random 255) +1 hello] 8
Saving files Remember to save these files as BMP using the Bitmap, Save As. You can then view these as image files. Printing files Best to save them then print them with image manipulation software such as Photoshop or Paint but you can Bitmap, Print Useful Web sites http://davidlongman.com/logo/logo_resources.htm http://www.bfoit.org/itp/csls_introtorecursion.html You tube basics to advanced http://www.youtube.com/watch?v=r-nkmptjktw http://www.youtube.com/watch?annotation_id=annotation_565025& feature=iv&src_vid=wfyygpzctce&v=xnmpgfs1gyu 9