MSW Logo

 

 Book One 

Rose Bay High School

 

In most applications, the 'turtle' is reduced to an object in the centre of the screen, sometimes in the shape of a turtle, more often, simply a triangle.

The user enters English-like commands such as FORWARD, REVERSE, PENDOWN, PENUP, RIGHT, LEFT and so on. If the turtle's 'pen' is "down", it draws on the screen as it moves!

Entering MSW Logo Commands

 

Commands are entered in the Input Box in the Commander window at the bottom of the screen.

 

 

Commands are executed, after being entered in the Input Box, by either pressing the Return key, or clicking on the Execute button. Each command is recorded in the Output/Command-Recall List Box above the Input Box.

 

Turtle Basics

The turtle looks like a little triangle in the middle of the screen. The head shows you which direction he is facing. When the turtle moves he draws a line behind him.

 

 

 

You can turn the turtle by telling him to turn RIGHT or LEFT. This picture shows how to make the turtle turn in different directions. Instead of typing out RIGHT and LEFT I use the smaller words RT and LT, which mean the same thing to the turtle.

 


To get the turtle to draw a line, just tell him to move FORWARD a number of steps (turtles take small steps, so you need to tell him to move FORWARD many steps, like 100, to get him to move enough to see). I like to use the smaller word FD instead of typing FORWARD. Both work the same way.

 

To get the turtle to draw a shape, like a square, you can give him the instructions he needs to "walk" around the shape of a square.

 

      

 

                A Typical Logo Program                                                    Screen Dimensions

 

 

To exit MSW Logo enter BYE in the Input Box, or select Exit from the File menu.

 

Activity 1

 

1.              Open MSWlogo on your computer.

·        Go to the START button.

·        Go to PROGRAMS.

·        Go to MICROSOFT WINDOWS LOGO.

·        Click on MSWlogo.

2.              Click on Help then click on Demo to run the demonstration.

3.             Click on Help then click on Tutorial and run the tutorial.

4.              Click on the Input Box and enter the typical logo program above.

5.              Clear the screen using the command CS and explore with different commands.
(The commands are shown on the next page)

 

Summary of Selected MSW Logo Commands

 

Command

Action

Short Version

FORWARD 100

Turtle moves forward the specified number of units.  

FD 100

BACK 50

Turtle moves back the specified number of units. 

BK 50

RIGHT 90

Turtle turns clockwise the number of degrees specified. 

RT 90

LEFT 45

Turtle turns counterclockwise the angle specified.

LT 45

PENUP

Turtle's pen is up. (Doesn't draw as it moves.)

PU

PENDOWN

Turtle's pen is in the down position.

PD

PENERASE

Turtle erases as it moves.

PE

HIDETURTLE

Removes the Turtle 'triangle' from the screen.

HT

SHOWTURTLE

Makes the Turtle visible again.

ST

CLEARSCREEN

Erases the screen and returns the Turtle to its "home" position in the centre of the drawing screen.

CS

HOME

Returns the Turtle to the "home" position without erasing the screen. (Issue a PU command before HOME to prevent it drawing its return path as it goes.)

HOME

LABEL [HELLO WORLD]

Displays text at the Turtle location.

SETPENCOLOR SETPC followed by a number from 0 to 15.

Determines pen color according to:

SETPC 4 = Red

SETPC 2 = Green

SETPC 1 = Blue

OUND  [1000 200]

SOUND [<frequency> <duration>] where “frequency” is in cps and “duration” is in 1000ths of a second.

 

SETPENSIZE [10 10]

Sets width and height of the drawing pen. MSW Logo uses only the second value. Set them both the same.

BYE

Exits MSW Logo

 Screen Effects

Clearscreen

Type cs to clear the screen. You will see a small turtle in the center of the screen.

BOUNDARIES

The boundaries of the screen are controlled by the commands WRAP, FENCE and WINDOW.

Activity 2

Find out the difference between these by typing:

cs wrap fd 900

cs fence fd 900

cs window fd 900

PEN COLOURS

The colour of the pen is controlled by SETPENCOLOR. For example to draw in blue you would type SETPENCOLOR  1 or SETPC 1. Try it!

To see a description of this command, look in the help/index and search for pencolor.

 PEN SIZE

The width of the pen is defined by SETPENSIZE followed by two numbers in square brackets. Make sure the numbers are the same eg  SETPENSIZE [20 20].

Set ScreenColor Command

This command allows you to select the screen color.  You can also select the screen color with the Logo command SETSCREENCOLOR and obtain it with the Logo command

SCREENCOLOR.

 

Activity 3

A SCREEN SAVER

Type the following into the input box and see what happens.

WRAP REPEAT 2000 [ SETPC RANDOM 16 SETPENSIZE  [20 20] FD RANDOM 100 RT RANDOM 360 ]

 

 Activity 4

 Drawing Shapes and Importing Pictures

 

1.      Open MSW Logo.

 

2.      Click in the Input Box.

 

3.      Type in the following:

           home           <Press Enter>

          FD 100        <Press Enter>

          RT 90          <Press Enter>

          FD 100        <Press Enter>

          RT 90          <Press Enter>

          FD 100        <Press Enter>

          RT 90          <Press Enter>

          FD 100        <Press Enter>

 

NOTE: The "<" and ">" symbols contain instructions. Whenever they are used in these sheets, ignore them! Don't type them in!

  

4.       Type in the following:

 

          home                                        <Press Enter>

          repeat 4 [fd 100  rt  90]             <Press Enter>

 

5.       Type in the following:

 

          to square                                  <Press Enter>

          cs                                            <Press Enter>

          repeat 4 [fd  100  rt  90]            <Press Enter>

          end                                           <Press Enter>

 

6.       Type:

 

          home           <Press Enter>

          square         <Press Enter>

 

The method used in steps 5 and 6 is called writing a "procedure". All Logo procedures begin with "to" and end with "end".

 

 Writing Procedures in the Editor Window:

 

If you define a procedure via the Input Box by typing in: to box, the input dialogue window appears where you enter one line at a time followed by <Enter>. You are prompted to type in “End” to end the procedure.

 A better approach for editing is to use the built-in Editor window…

 Activity 5

 

1.       Go to the File/Edit menu



2.       Type in a suitable procedure name (Box) and click the OK button. The Editor window appears…
 

 

 

 

 

 

3.                 Type the following instructions


to Box

cs
repeat 2 [fd 100 rt 90 fd 300 rt 90]
end

 

You can type in commands, edit them, cut and paste, just like a conventional word processor.

 

4.       When you have finished defining the procedure go to File/Exit and click the Yes button to save your work.

 Remember that nothing has been saved to disk until you do a File/Save.

 

 Saving Your Work in MSW Logo:

 

The File/Save and File/Save As… menus can be used to save logo files in the usual way, BUT this will only save work that has been defined as procedures. MSW Logo will save ALL of the procedures you defined during the ‘session’ as a file with the extension .LGO. The programme does NOT save individual procedures as separate files. All the procedures you created will be saved. You will lose all of the commands typed directly into the Input Box that were not defined as part of a procedure. (Another great reason for using procedures!)

Activity 6

 

1.    Write the procedure below in MSWlogo’s editor.

 

To wow

CS HT

REPEAT 100 [FD 10 RT REPCOUNT]

END

 

2.    Save your work to your user directory.

·       Click on File/Save as

·       Find your user directory on U: drive.

 

 

Loading Previously Saved Sessions:

 

The File/Load menu allows you to reload procedures you have previously defined. Only those files with a “.LGO” extension will listed in the dialogue box. If you want to load a file created with a text editor and saved without the .LGO extension select All Files (*.*) from the Files of Type: box.

 

 

WARNING: Loading a file will overwrite any procedures from the current session of the same name. ie If you have just defined a procedure called MyPicture and the file you load also has a procedure called MyPicture, the current one will be overwritten by the one contained in the file and you will lose all of the commands defined within the current version.

 

 Activity 7

1.    Close MSWlogo

2.    Open MSWlogo

3.    Load the work you saved in Activity 8.

·  Click on File/Load.

·  Find your user directory and click on the filed you saved.

·  Run the procedure wow

 ******To Print Your Work Click On BITMAP/PRINT******

 

 Activity 8

 1.       Construct a procedure to draw an equilateral (equal-sided) triangle of side-length 100 units.

 

2.       Construct a shape consisting of three equilateral triangles and a square.

 

3.       Save your work onto your user directory called <**EXER6>
NOTE: Put in your initials instead of the asterisks!! eg <FBEXER6>

4.       Use the "Label" function to add a title at the top of your screen.

 

                   eg label  [This is my Drawing]

 

 Activity 9

 1.                 Use the process described below to place a picture on your screen.

 

2.                 Open a drawing package and create a drawing.

 ·        Go to START/PROGRAMS/ACCESSORIES/PAINT

 

3.                  Save the image to your user directory in .BMP format

 

4.                 Go to the Bitmap menu in MSWlogo and select Load

 

5.                 Locate the bitmap image in your user directory and load it into MSW Logo

 ·        To see the image you may have to minimize the Commander Window.

 

6.                 Close MSW Logo

 

EXTRA

 Create a scene (such as a golf course) and use the direction commands in MSW Logo to ‘play’ your way around the course. 

Have a competition with someone else in your class to see who can complete the course in the lowest number of ‘stokes’.

 Activity 10

 

Procedures within Procedures:

 

Drawing a house …

 

1.     Type the following into the editor in MSWlogo. (Remember you can use cut and paste from the Intranet version of this document).

 

to base
  
home
  
lt 90
  
fd 20
  
lt 90
  
fd 80
  
lt 90
  
fd 80
  
lt 90
  
fd 80
end

 to roof
  
home
  
HT
  
lt 90
  
fd 50
  
rt 135
  
fd 100
  
rt 90

  
fd 100

  
rt 135
  
fd 100
end

 to house
  
cs
  
base
  
roof

end

 

2. Now draw the house by typing house in the INPUT BOX. Write your own procedures to add to the drawing.

Activity 11

Cut and paste each of the following into the editor and run the procedure.

 

to triangle 

repeat 3[fd 100 lt 120]

end

 to square

repeat 4[fd 100 rt 90]

end

to circle1

repeat 36[fd 10 lt 360/36]

end

                                                                                                                        

to decagon 

  repeat 10[fd 50 lt 360/10]

end

 to shape1

repeat 25[circle1 triangle lt 90]

end

                                                                                                                                                                                       

  to shape2  

repeat 50[square rt 10]

end

 to shape3

repeat 60[triangle rt 10]

end