MSW Logo Programming

 MSW Logo Programming

********************************************************************************

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 1-15



Determines pen color according to:

SETPC 4 = Red

SETPC 2 = Green

SETPC 1 = Blue



-


-



SOUND  [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



-




 



 **************************************************************************



 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>



 



 



 ********************************************************************************



 




















aDDING COLOURS TO MSWLOGO




 


 



Pen Color and Screen Color



You can change the color
of the lines that the turtle draws with the SETPENCOLOR command. You can change
the color of the screen (or background) with the SETSCREENCOLOR command.




















Command



Example



What Happens



SETPENCOLOR color



SETPENCOLOR 2



Sets the color that
the turtle draws to green.



SETSCREENCOLOR color



SETSCREENCOLOR 2



Fills the entire
screen with green. Anything on the screen will be erased. The turtle is not
moved.




Color Index



The easy way to change
the color of the turtle's pen is to give SETPENCOLOR a number from 0 - 15. Each
number will set the turtle's pen to a different color, given in the table
below. The number is called the "color index".











































































































Color Index



Color Name



[R G B]



Color



0



black



[0 0 0]



 



1



blue



[0 0 255]



 



2



green



[0 255 0]



 



3



cyan (light blue)



[0 255 255]



 



4



red



[255 0 0]



 



5



magenta (reddish
purple)



[255 0 255]



 



6



yellow



[255 255 0]



 



7



white



[255 255 255]



 



8



brown



[155 96 59]



 



9



light brown



[197 136 18]



 



10



dark green



[100 162 64]



 



11



darkish blue



[120 187 187]



 



12



tan



[255 149 119]



 



13



plum (purplish)



[144 113 208]



 



14



orange



[255 163 0]



 



15



gray



[183 183 183]



 




 



 



SETSCREENCOLOR 5



SETPENCOLOR 7



FD 100  <Press Enter>



RT 90 <Press Enter>



FD 100 <Press Enter>



RT 90 <Press Enter>



FD 100 <Press Enter>



RT90 <Press Enter>



RT 90 <Press Enter>



FD 100 <Press Enter>



 



 



 



 



 
















REPCOUNT     COMMMAND




 


 






 



REPEAT COMMAND



Repeated
pattern created using a square:




  • Repeat 10 [square rt 36]

  • Repeat 12 [square rt 30]

  • Repeat 30 [square rt 12]

  • Repeat 36 [square rt 10]





Repeated
pattern created using a hexagon:




  • Repeat 10 [hexagon rt 36]

  • Repeat 12 [hexagon rt 30]

  • Repeat 30 [hexagon rt 12]

  • Repeat 36 [hexagon rt 10]



 



  



 



 



 


Post a Comment

0 Comments