Presentation is loading. Please wait.

Presentation is loading. Please wait.

A SIMPLE COMPUTER LANGUAGE LOGO. LOGO Introduction Logo is the simplest programming language. It.

Similar presentations


Presentation on theme: "A SIMPLE COMPUTER LANGUAGE LOGO. LOGO Introduction Logo is the simplest programming language. It."— Presentation transcript:

1 A SIMPLE COMPUTER LANGUAGE LOGO

2 LOGO Introduction http://pages.intnet.mu/jhbpage/Program/Logo/logo.htm Logo is the simplest programming language. It was developed by Seymour Papert in 1968. It was developed originally as a teaching tool. Though Logo is a complete language it is mainly used for drawing.

3 The Logo Environment

4 Basic Logo Commands InstructionShortcutDescription SHOWTURTLE ST Shows the Turtle on the screen HIDETURTLE HT Hides the Turtle from the screen FORWARDnumber FD Moves the Turtle forward according to the number indicated BACK number BK Moves the Turtle back according to the number indicated RIGHT angle RT Changes the direction of the Turtle by turning it to the right LEFT angle LT Changes the direction of the Turtle by turning it to the left CLEARSCREEN CS Erase the picture before a new picture is drawn

5 How to draw a 100 by 100 square in Logo? Step 1 FORWARD 100 Step 2 RIGHT 90

6 How to draw a 100 by 100 square in Logo? Step 3 FORWARD 100 Step 4 RIGHT 90

7 How to draw a 100 by 100 square in Logo? Step 5 FORWARD 100 Step 6 RIGHT 90

8 How to draw a 100 by 100 square in Logo? Step 7 FORWARD 100 Step 8 HIDETURTLE

9 Procedures A procedure has 3 parts: 1.It must start with the reserved word “TO”, followed by a one word procedure name. 2.The main body is made up of primitives 3.The procedure ends up with word “END”

10 A Scalene Triangle TO scalene CS FD 100 RT 150 FD 50 HOME HT END

11 An Isosceles Triangle TO isosceles CS RT 20 FD 100 RT 140 FD 100 HOME HT END

12 A Pentagon TO pentagon CS FD 100 RT 72 FD 100 RT 72 FD 100 RT 72 FD 100 RT 72 FD 100 RT 72 HT END

13 Looping TO pentagon CS FD 100 RT 72 FD 100 RT 72 FD 100 RT 72 FD 100 RT 72 FD 100 RT 72 HT END TO pentagon CS REPEAT 5 [FD 100 RT 72] HT END

14 A Rectangle TO rectangle CS FD 100 RT 90 FD 50 RT 90 FD 100 RT 90 FD 50 RT 90 HT END

15 A Rectangle TO rectangle CS FD 100 RT 90 FD 50 RT 90 FD 100 RT 90 FD 50 RT 90 HT END TO rectangle CS Repeat 2 [ FD 100 RT 90 FD 50 RT 90] HT END

16 An Equilateral Triangle TO equilateral CS FD 100 REPEAT 2[ RT 120 FD 100] HT END TO equilateral CS FD 100 RT 120 FD 100 RT 120 FD 100 HT END

17 A Kite TO kite CS FD 90 BK 30 RT 90 FD 30 BK 60 LT 45 FD SQRT (2*(30*30)) RT 90 FD SQRT (2*(30*30)) HOME FD 60 LT 90 FD 30 HOME END

18 A Kite TO kite CS FD 90 BK 30 RT 90 FD 30 BK 60 LT 45 FD SQRT (2*(30*30)) RT 90 FD SQRT (2*(30*30)) HOME FD 60 LT 90 FD 30 HOME END

19 Loop and Double Loops Try each of the following: (Reset the screen before each try) 1.FD 50 RT 45 2.REPEAT 4 [ FD 50 RT 45 ] 3.REPEAT 8 [ FD 50 RT 45 ] 4.REPEAT 2 [REPEAT 8 [ FD 50 RT 45 ] RT 45] 5.REPEAT 3 [REPEAT 8 [ FD 50 RT 45 ] RT 45] 6.REPEAT 4 [REPEAT 8 [ FD 50 RT 45 ] RT 45] 7.REPEAT 8 [REPEAT 8 [ FD 50 RT 45 ] RT 45]

20 Double Loops TO N REPEAT 8 [REPEAT 8 [ FD 50 RT 45 ] RT 45] END

21 Loop REPEAT 12 [ FD 100 RT 150 ]

22 Double Loops REPEAT 72 [ REPEAT 360 [ FD 1 RT 1 ] RT 5 ]

23 Double Loops TO C PERSPECTIVE REPEAT 4 [REPEAT 4 [FD 100 RT 90] FD 100 DOWN 90 END

24 Double Loops TO R PERSPECTIVE REPEAT 45 [ REPEAT 360 [ FD 2 RT 2 ] RR 8 ] END

25 Basic Logo Commands InstructionShortcutDescription PU Pen Up PD Pen Down PPT Pen Paint SETXT num1 num2 SETXY Moves the Position X, Y


Download ppt "A SIMPLE COMPUTER LANGUAGE LOGO. LOGO Introduction Logo is the simplest programming language. It."

Similar presentations


Ads by Google