In this post, I would like to write about MSW Logo. This is a programming tool for beginners like me.
LOGO stands for Language of Graphics Oriented. It is specially created programming language so that we can have fun and learn the art of the programming. With Logo we can draw, design and perform calculation.
How to go to logo?
Windows 7
Click Start—->All Program—->MSW Logo.
Windows 10
Click Windows button—->Type MSW Logo—->Click MSW Logo.
What is a turtle?
A turtle is a triangle which draws on the Logo Graphics Window according the Logo commands those we enter. The centre of the Graphics screen is the home of the Turtle.
These commands are also known as Primitives. Primitive are entered in the bar called Command Input Box.
The basic logo Primitives are shown below.
Primitives | Meaning | Action |
FD | FORWARD | To move the turtle forward. |
BK | BACK | To move the turtle backwards. |
RT | RIGHT | To move the turtle to the right. |
LT | LEFT | To move the turtle to the left. |
HT | HIDE TURTLE | To hide the turtle. |
ST | SHOW TURTLE | To show the turtle. |
CS | CLEAR SCREEN | To clear the screen and send the turtle to the Home position. |
CT | CLEAR TEXT | To clear all the commands in the Recall list box. |
SETH | To rotate the turtle to its orginal positon. | |
HOME | To bring the turtle to its Home position. | |
To write. | ||
SUM | To add two numbers. | |
BYE | The shortcut primitive to exit from logo. | |
DIFFERENCE | To subract one number to another. | |
PRODUCT | To multiply to number. | |
QUOTIENT | To display the quotient of two numbers. | |
REMAINDER | To display the remainder of two numbers. | |
CLEAN | To erase all graphics in the graphics window. |
PENUP or PU Primitive
Use the PENUP (PU) to lift the turtle’s pen. After you have given the PU primitive, the turtle moves without line.
PENDOWN or PD Primitive
Use the PENDWN (PD) after the PENUP primitive. It puts the pen down,and starts drawing again.
Example
FD 40 – The turtle draw a line of 40 steps.
PU – The pen is lifted.
FD 40 – The turtle moves up 40 steps without drawing.
PD – The turtle’s pen is down.
FD 20 – The turtle draw a line of 20 steps.
All commands given in LOGO must be followed by the key “Enter”.
PENERASE or PE Primitive
Penerase (PE) is a primitive that act like an eraser.
Example
FD 50 – The turtle moves 50 step forward (FD)
PE – The PENERASE (PE) primitive will be active.
BK 25 – The turtle erases 25 step by moving backward (BK).
SET PEN COLOR or SETPC Primitive
The SET PEN COLOR or SETPC primitive is programmed as to change the color of the turtle’s pen. Colors are represented by numbers given below:
No | Color |
0 | Black |
1 | Blue |
2 | Green |
3 | Cyan |
4 | Red |
5 | Violet |
6 | Brown |
7 | Light Gray |
8 | Dark Grey |
9 | Light Blue |
10 | Light Green |
11 | Light Cyan |
12 | Light Red |
13 | Magenta |
14 | Yellow |
15 | White |
Example
REPEAT primitive
Use the REPEAT primitive to make the computer do a certain task repeatedly. The REPEAT primitive saves a lot of time and effort.
Instead of writing the same command again and again we just write the repeat primitive and the number we should repeat. Repeat primitive is used for looping.
Consider this example –
FD 60 RT 90 FD 60 RT 90 FD 60 RT 90 FD 60 RT 90 (Enter)
This will draw a square.
We can type command as below:
REPEAT 4 [FD 60 RT 90] (Enter)
Let us use REPEAT primitive to draw different shape by trying these example.
Drawing a circle using REPEAT primitive
REPEAT 360 [FD 1 RT 1] (Enter)
Drawing a semicircle
REPEAT 180 [FD 1 RT 1] (Enter)
Drawing an arc
REPEAT 90 [FD 1 RT 1] (Enter)
Drawing a pentagon
REPEAT 5 [FD 50 RT 360/5] (Enter)
Drawing an octagon
REPEAT 8 [FD 50 RT 360/8] (Enter)
Drawing a hexagon
REPEAT 6 [FD 50 RT 360/6] (Enter)
Drawing a triangle
REPEAT 3 [FD 50 RT 360/3] (Enter)
Nested REPEAT
When one REPEAT encloses another REPEAT, it is called a nested REPEAT.
Now let us try out nested REPEAT to draw the following shapes.
1. To draw a star
HT REPEAT 25 [REPEAT 5 [FD 210 RT 114]] (Enter)
2.To Draw a fan
REPEAT 6 [REPEAT 3 [FD 90 RT 120 FD 30 RT 90]] (Enter)
More to learn in MSW logo
1. Zoom- To zoom, we should click the zoom button and it will be asking you In, Out, Normal you choose in it will be zoomed.
2. To change the your Pen size- To change the your Pen size you should click the set button and click pensize. You can choose which size you want and click OK.
3. To save- To save, click the file button and click save as. It will ask where to save, you give the location where to save and click where to save.
The end.
Download logo: http://fmslogo.sourceforge.net/