logo lesson 1 tbe 540-40 fall 2004 farah fisher. what is logo? a programming language (instructions...

35
Logo Lesson 1 Logo Lesson 1 TBE 540-40 TBE 540-40 Fall 2004 Fall 2004 Farah Fisher Farah Fisher

Upload: josh-peddicord

Post on 02-Apr-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Logo Lesson 1Logo Lesson 1

TBE 540-40TBE 540-40

Fall 2004Fall 2004

Farah FisherFarah Fisher

Page 2: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What is Logo?What is Logo?

A programming language (instructions to the A programming language (instructions to the computer to perform a task)computer to perform a task)

Created at MIT during a study of artificial Created at MIT during a study of artificial intelligence (see intelligence (see http://el.media.mit.edu/logo-foundation/logo/index.http://el.media.mit.edu/logo-foundation/logo/index.htmlhtml))

Can be used by virtually any student - from young Can be used by virtually any student - from young children through engineering studentschildren through engineering students

Can be used to create pictures, display text, or Can be used to create pictures, display text, or perform calculations. Some versions can even perform calculations. Some versions can even make music!make music!

Page 3: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What is Logo?What is Logo?

When Logo is used to create pictures, When Logo is used to create pictures, commands are given to a “robot turtle”.commands are given to a “robot turtle”.

Some samples of the “turtle” shape:Some samples of the “turtle” shape:

Page 4: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What does Logo look like?What does Logo look like?

The simplest form of Logo uses movement The simplest form of Logo uses movement commands to control the “robot turtle”.commands to control the “robot turtle”.

Sample commands:Sample commands: FD (or FORWARD) moves the turtle forwardFD (or FORWARD) moves the turtle forward BK (or BACK) moves the turtle backwardsBK (or BACK) moves the turtle backwards RT (or RIGHT) turns the turtle to the rightRT (or RIGHT) turns the turtle to the right LT (or LEFT) turns the turtle to the leftLT (or LEFT) turns the turtle to the left

Page 5: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What does Logo look like?What does Logo look like?

Each movement command (FD, BK, RT, LT) Each movement command (FD, BK, RT, LT) needs more information.needs more information.

FD and BK both require a number, which indicates FD and BK both require a number, which indicates the “turtle steps” to move (steps are very small).the “turtle steps” to move (steps are very small).

RT and LT both require the number of degrees in RT and LT both require the number of degrees in the turn.the turn.

Examples (notice the space after the command):Examples (notice the space after the command): FD 50 (move forward 50 turtle steps)FD 50 (move forward 50 turtle steps) LT 90 (turn left 90 degrees)LT 90 (turn left 90 degrees)

Page 6: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What does Logo look like?What does Logo look like?

As the turtle moves, it leaves a “trail” on the As the turtle moves, it leaves a “trail” on the screen. screen.

These “trails” make shapes.These “trails” make shapes. Imagine for a moment that you are walking Imagine for a moment that you are walking

around the bases of a baseball diamond, around the bases of a baseball diamond, about 30 steps on each side. Assume that about 30 steps on each side. Assume that you are walking forward from base to base. you are walking forward from base to base. Are you turning left or right?Are you turning left or right?

Go to the next slide when you finish.Go to the next slide when you finish.

Page 7: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What does Logo look like?What does Logo look like? In walking around the baseball diamond in your In walking around the baseball diamond in your

imagination, you probably followed these steps (written imagination, you probably followed these steps (written as they would be in Logo):as they would be in Logo): FD 30 (home to 1st base)FD 30 (home to 1st base) LT 90 (turn toward 2nd base)LT 90 (turn toward 2nd base) FD 30 (1st base to 2nd base)FD 30 (1st base to 2nd base) LT 90 (turn toward 3rd base)LT 90 (turn toward 3rd base) FD 30 (2nd base to 3rd base)FD 30 (2nd base to 3rd base) LT 90 (turn toward home)LT 90 (turn toward home) FD 30 (3rd base to home)FD 30 (3rd base to home)

Imagine that you were dragging a paint brush when you Imagine that you were dragging a paint brush when you walked. What shape would you have drawn?walked. What shape would you have drawn?

Page 8: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What does Logo look like?What does Logo look like?

The commands below would make a The commands below would make a square! square! (turtle shown at the end)(turtle shown at the end)

FD 30 FD 30 LT 90 LT 90 FD 30 FD 30 LT 90 LT 90 FD 30 FD 30 LT 90 LT 90 FD 30 FD 30

Page 9: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What shapes would these make?What shapes would these make?

SHAPE 1SHAPE 1FD 30FD 30

RT 90RT 90

FD 60FD 60

SHAPE 3SHAPE 3FD 50 FD 50

LT 60LT 60

FD 50FD 50

SHAPE 2SHAPE 2RT 90RT 90

FD 50FD 50

LT 90LT 90

FD 50FD 50

SHAPE 4SHAPE 4FD 100FD 100

RT 45RT 45

FD 50FD 50

Try these with pencil and paper. Click to check your answers.

Page 10: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

What shapes would these make?What shapes would these make?

SHAPE 1SHAPE 1FD 30FD 30

RT 90RT 90

FD 60FD 60

SHAPE 3SHAPE 3FD 50 FD 50

LT 60LT 60

FD 50FD 50

SHAPE 2SHAPE 2RT 90RT 90

FD 50FD 50

LT 90LT 90

FD 50FD 50

SHAPE 4SHAPE 4FD 100FD 100

RT 45RT 45

FD 50FD 50

Page 11: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

The REPEAT CommandThe REPEAT Command

When you “walked around the bases”, you may When you “walked around the bases”, you may have noticed that the Logo commands were have noticed that the Logo commands were repeated.repeated.

The REPEAT command is used as a shortcut in The REPEAT command is used as a shortcut in place of writing out repeated commands.place of writing out repeated commands.

Example: REPEAT 2 [FD 50 RT 90] is the Example: REPEAT 2 [FD 50 RT 90] is the equivalent of equivalent of FD 50 RT 90FD 50 RT 90 FD 50 RT 90FD 50 RT 90

Notice that the number of repeats comes first, with Notice that the number of repeats comes first, with the commands to be repeated inside square the commands to be repeated inside square brackets.brackets.

Page 12: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

REPEAT ExampleREPEAT Example

To make a To make a SQUARESQUAREFD 30FD 30

LT 90LT 90

FD 30FD 30

LT 90LT 90

FD 30FD 30

LT 90LT 90

FD 30FD 30

OR…to make a SQUAREOR…to make a SQUAREREPEAT 4 [FD 30 LT 90] REPEAT 4 [FD 30 LT 90]

This version actually adds This version actually adds another LT 90 to the list, but another LT 90 to the list, but does not change the basic does not change the basic shape.shape.

Page 13: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

More about REPEATMore about REPEAT

You have seen that REPEAT 4 [FD 30 LT 90] You have seen that REPEAT 4 [FD 30 LT 90] makes a square. Guess the shapes made by makes a square. Guess the shapes made by the REPEAT commands below. Click to see if the REPEAT commands below. Click to see if you were right.you were right.

REPEAT 3 [FD 30 LT 120]REPEAT 3 [FD 30 LT 120]

REPEAT 6 [FD 30 LT 60]REPEAT 6 [FD 30 LT 60]

REPEAT 8 [FD 30 LT 45]REPEAT 8 [FD 30 LT 45]

REPEAT 5 [FD 30 LT 72]REPEAT 5 [FD 30 LT 72]

Page 14: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

More about REPEATMore about REPEAT

REPEAT 3 [FD 30 RT 120]REPEAT 3 [FD 30 RT 120]

REPEAT 8 [FD 30 LT 45]REPEAT 8 [FD 30 LT 45]

REPEAT 6 [FD 30 LT 60]REPEAT 6 [FD 30 LT 60]

REPEAT 5 [FD 30 LT 72]REPEAT 5 [FD 30 LT 72]

Page 15: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Did you notice a pattern?Did you notice a pattern?

The number after REPEAT is the number of sides.The number after REPEAT is the number of sides. Examine the number of repeats and the number of Examine the number of repeats and the number of

degrees. Try multiplying them together. Example: degrees. Try multiplying them together. Example: 4 (sides) x 90 (turn)4 (sides) x 90 (turn)

The sides x degrees should always be the same The sides x degrees should always be the same number in the samples you tried.number in the samples you tried.

Could you use this information to make a 10-sided Could you use this information to make a 10-sided figure? Click for a possible answer.figure? Click for a possible answer.

Page 16: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Did you notice a pattern?Did you notice a pattern?

REPEAT 10 [FD 30 LT 36] should make a 10-sided figure. REPEAT 10 [FD 30 LT 36] should make a 10-sided figure. Why? Look at the “total turtle turns” below:Why? Look at the “total turtle turns” below:

REPEAT REPEAT 33 [FD 30 LT [FD 30 LT 120120] ] 3 x 120 = 3603 x 120 = 360

REPEAT REPEAT 66 [FD 30 LT [FD 30 LT 6060] ] 6 x 60 = 3606 x 60 = 360

REPEAT REPEAT 88 [FD 30 LT [FD 30 LT 4545] ] 8 x 45 = 3608 x 45 = 360

REPEAT REPEAT 55 [FD 30 LT [FD 30 LT 7272] ] 5 x 72 = 3605 x 72 = 360

REPEAT 10 [FD 30 LT REPEAT 10 [FD 30 LT 3636] ] 10 x 36 = 36010 x 36 = 360

} When the turtle makes a closed figure (no breaks in the When the turtle makes a closed figure (no breaks in the sides), the total turns add up to 360 degrees.sides), the total turns add up to 360 degrees.

Page 17: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Logo and Critical ThinkingLogo and Critical Thinking

You have just seen an example of the use of You have just seen an example of the use of Logo to enhance critical thinking. Logo to enhance critical thinking.

Your students (and you, too) can be Your students (and you, too) can be challenged to write the sequential steps challenged to write the sequential steps needed to make shapes, look for patterns, needed to make shapes, look for patterns, predict outcomes…all part of critical predict outcomes…all part of critical thinking.thinking.

Watch for more examples of critical thinking Watch for more examples of critical thinking as you learn Logo.as you learn Logo.

Page 18: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Changing ThingsChanging Things

Here is another prediction task for you.Here is another prediction task for you. You have seen that to make a square, you You have seen that to make a square, you

can use REPEAT 4 [FD 30 LT 90]can use REPEAT 4 [FD 30 LT 90] Do you think the same commands would Do you think the same commands would

work if you turned RT instead of LT?work if you turned RT instead of LT? How could you make a square larger? What How could you make a square larger? What

would you have to change?would you have to change? After you have made predictions, go to the After you have made predictions, go to the

next slide.next slide.

Page 19: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Were you correct?Were you correct?

REPEAT 4 [FD 30 LT 90]REPEAT 4 [FD 30 LT 90]

REPEAT 4 [FD 30 REPEAT 4 [FD 30 RTRT 90] 90]

REPEAT 4 [FD REPEAT 4 [FD 1010 LT 90] LT 90]

REPEAT 4 [FD REPEAT 4 [FD 5050 LT 90] LT 90]

Page 20: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Controlling the Logo “Pen”Controlling the Logo “Pen”

When the Logo turtle moves, it usually When the Logo turtle moves, it usually draws with a “pen”. draws with a “pen”.

This pen can be “down” (draws a line) or This pen can be “down” (draws a line) or “up” (does not draw a line). If the pen is up, “up” (does not draw a line). If the pen is up, the turtle moves without drawing.the turtle moves without drawing.

The pen can also become an eraser The pen can also become an eraser (remove a line already drawn).(remove a line already drawn).

The pen color abd background can be The pen color abd background can be changed.changed.

Page 21: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Pen Control CommandsPen Control Commands

PU (PENUP) - subsequent movements of PU (PENUP) - subsequent movements of the turtle will not leave a linethe turtle will not leave a line

PD (PENDOWN) - subsequent movements PD (PENDOWN) - subsequent movements of the turtle will leave a lineof the turtle will leave a line

PE (PENERASE) - subsequent movements PE (PENERASE) - subsequent movements of the turtle will erase any line it crossesof the turtle will erase any line it crosses

PPT or PP (PENPAINT) - used by some PPT or PP (PENPAINT) - used by some versions of Logo to “undo” PENERASEversions of Logo to “undo” PENERASE

Page 22: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Logo ChallengeLogo Challenge

How could you use PU and PD to make a How could you use PU and PD to make a dashed line (like the middle of a road)?dashed line (like the middle of a road)?

Think about this problem for awhile, then Think about this problem for awhile, then click for a possible answer.click for a possible answer.

Try making the pattern below (turtle always Try making the pattern below (turtle always starts pointed “up” with the pen down):starts pointed “up” with the pen down):

Page 23: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Logo ChallengeLogo Challenge

Two possible solutions for this shape:Two possible solutions for this shape:

RT 90 FD 25 PU FD 25 PD FD 25 PU FD 25 PDRT 90 FD 25 PU FD 25 PD FD 25 PU FD 25 PDFD 25 PU FD 25 PD FD 25FD 25 PU FD 25 PD FD 25

Alternate using REPEAT:Alternate using REPEAT:RT 90 REPEAT 4 [FD 25 PU FD 25 PD]RT 90 REPEAT 4 [FD 25 PU FD 25 PD]

OR…You could draw a line and go back over it with an OR…You could draw a line and go back over it with an eraser!eraser!

(NOTE: Logo commands can be placed on the same line.)(NOTE: Logo commands can be placed on the same line.)

Page 24: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Logo ColorLogo Color

The Logo command to set the pen color is SETPC The Logo command to set the pen color is SETPC on most versions of Logo.on most versions of Logo.

The Logo commands to set the background color The Logo commands to set the background color is SETBG on most versions of Logo.is SETBG on most versions of Logo.

Each of these commands must be followed by a Each of these commands must be followed by a number (typically from 0 to 15).number (typically from 0 to 15).

The numbers may signify different colors in The numbers may signify different colors in various version of Logo. You will need to various version of Logo. You will need to experiment.experiment.

NOTE: Some versions of Logo use a menu to NOTE: Some versions of Logo use a menu to choose colors.choose colors.

Page 25: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Logo ColorLogo Color

Here are some sample commands using Here are some sample commands using color.color.

SETPC 0 (pen will draw in black)SETPC 0 (pen will draw in black) SETPC 7 (pen will draw in white - probably)SETPC 7 (pen will draw in white - probably) SETBG 3 (screen background will change SETBG 3 (screen background will change

color)color) NOTE: If you set the pen color and the NOTE: If you set the pen color and the

background to the same number, you will background to the same number, you will not see any drawing!not see any drawing!

Page 26: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Suppose you enter these commands (with Suppose you enter these commands (with the turtle starting at “home” in the middle of the turtle starting at “home” in the middle of the screen, pointing up): FD 30 RT 90the screen, pointing up): FD 30 RT 90

Which shape would appear?Which shape would appear?

Page 27: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Suppose you enter these commands (with Suppose you enter these commands (with the turtle starting at “home” in the middle of the turtle starting at “home” in the middle of the screen, pointing up): FD 30 RT 90the screen, pointing up): FD 30 RT 90

Which shape would appear?Which shape would appear?

Page 28: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Which of the following is a Logo shortcut for Which of the following is a Logo shortcut for FD 50 LT 60 FD 50 LT 60 FD 50 LT 60FD 50 LT 60 FD 50 LT 60 FD 50 LT 60

REPEAT 3 (FD 50 LT 60)REPEAT 3 (FD 50 LT 60) REPEAT [LT 60 FD 50]REPEAT [LT 60 FD 50] REPEAT 3 [FD 50 LT 60]REPEAT 3 [FD 50 LT 60] REPEAT [FD 50 LT 60]REPEAT [FD 50 LT 60]

Page 29: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Which of the following is a Logo shortcut for Which of the following is a Logo shortcut for FD 50 LT 60 FD 50 LT 60 FD 50 LT 60FD 50 LT 60 FD 50 LT 60 FD 50 LT 60

REPEAT 3 (FD 50 LT 60)REPEAT 3 (FD 50 LT 60) REPEAT [LT 60 FD 50]REPEAT [LT 60 FD 50] REPEAT 3 [FD 50 LT 60]REPEAT 3 [FD 50 LT 60] REPEAT [FD 50 LT 60]REPEAT [FD 50 LT 60]

Page 30: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Which of the following sets of Logo Which of the following sets of Logo commands will move the turtle 50 steps commands will move the turtle 50 steps without drawing?without drawing?

FD 50 PUFD 50 PU PU FD 50PU FD 50 PE FD 50PE FD 50

Page 31: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Which of the following sets of Logo Which of the following sets of Logo commands will move the turtle 50 steps commands will move the turtle 50 steps without drawing?without drawing?

FD 50 PUFD 50 PU PU FD 50 PU FD 50 {PENUP starts no drawing} {PENUP starts no drawing} OR OR

PE FD 50 PE FD 50 {PENERASE also starts no drawing}{PENERASE also starts no drawing}

Page 32: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Suppose you type these three Logo Suppose you type these three Logo commands: commands: SETBG 0 SETPC 0 FD 100SETBG 0 SETPC 0 FD 100

What will you see on the screen?What will you see on the screen?

Page 33: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Self-Check for Lesson 1Self-Check for Lesson 1

Suppose you type these three Logo Suppose you type these three Logo commands: commands: SETBG 0 SETPC 0 FD 100SETBG 0 SETPC 0 FD 100

What will you see on the screen?What will you see on the screen?

You will see the turtle in a different place, but You will see the turtle in a different place, but no line. You have instructed the turtle to no line. You have instructed the turtle to draw in black on a black background!draw in black on a black background!

Page 34: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Time to Try LogoTime to Try Logo

Use the class CD-ROM to start Logo or Use the class CD-ROM to start Logo or download it from the website at download it from the website at http://www.csudh.edu/fisher/tbe540http://www.csudh.edu/fisher/tbe540

You should see two windows - one for You should see two windows - one for commands and one to show the drawing.commands and one to show the drawing.

FD 50

RT 90

FD 25

Page 35: Logo Lesson 1 TBE 540-40 Fall 2004 Farah Fisher. What is Logo?  A programming language (instructions to the computer to perform a task)  Created at

Time to Try LogoTime to Try Logo

Try the activities from Hands-On Exercise 1. Try the activities from Hands-On Exercise 1. This is not a graded exercise.This is not a graded exercise.

Experiment with the Logo commands listed Experiment with the Logo commands listed on the handout for Week 1.on the handout for Week 1.