Separate speaker notes to accompany presentation on logo:

 

Slide #1:

This presentation uses a version of Logo called StarLogo available through MIT.  It can be downloaded for free and installed on your home computer.

Slide #2:

In later slides, we will reduce the number of turtles to 1, but for now it is fun to create patterns with 30 turtles!

Slide #3:

FD is the command for forward.  You follow it with a number that specifies how many steps each turtle should move forward.

Note that the command can be given in upper or lower case.

Slide #4:

Note again that the command can be given in upper or lower case.  My first command used fd and the next command used FD.

What I have done is used the sequence structure - each turtle followed the first command and then the second command.

Slide #5:

Pendown is the PD command and penup is the PU command.  Pendown means that the turtles draw as they step.  PU means they just move.  Notice that when we start the pen is up.

Slide #6:

The box on the slide shows the sequence of commands that have been executed so far.

Slide #7:

I can save my projects for use in the future.

Note that I can then close the project and later reopen it.  To clear the code that I wrote in the Turtle Command Center, I can use Edit/Clear.

Slide #8:

I have started a new project here and am moving the turtles and turning them as well.  RT means take a right turn RT 90 means turn right 90 degrees.

Slide #9:

The turtle command center can be used to control the activity of the turtles.  When I want to change the number of turtles and things like that, I switch (using the tabs) to the Observer Command Center.  In this example, I then clear the number of turtles and then establish that there will only be one turtle.

When you start a new project, if you do not want the default of 30 turtles, you must set the CT and CRT.  I am doing CT and CRT 1 to get one turtle.

Slide #10:

I pasted the sequence of commands to give a more readable copy. 

To make the picture I made it is important to execute in exactly the same sequence I did.  If a step forward or a turn or a color setting were in a different position, the results would be different.

Note the new commands LT for left turn and SETC to set a color.  Logo only recognizes the words for standard colors like black, blue, brown, cyan, gray, green, lime, magenta, orange, pink, red, sky, turquoise, white, yellow.

Slide #11:

The new command here is BK which means go back.  BK 5 means backup 5 steps.

Note here that I too the PU, moved forward and then put the pen down.  This can also be done with JUMP (see next slide).

Slide #12:

The new command here is JUMP you can see how it works in the example on this slide.

Note that again I have pasted a copy of the commands into the white space for readability.

Slide #13:

In this example, I instructed the turtle to create a square.  I put the pen down (PD) and then had it go forward 10 and then take a right run of 10 and then go forward 10 and take a right run of 10 until it had created the square.

Note that in all of these where there is only one turtle, the observer control contains CT, CRT1 to clear turtles and then create 1 turtle.  When you start a new project, you must set the CT and CRT in the observer control center.

Note also that the default color is red.  When I start a new project, the color will get set to red.

Slide #14:

The REPEAT command does whatever is enclosed in the square brackets the number of times indicated.

REPEAT 4 means repeat the commands 4 times.  The commands are to go forward 10 and then make a right turn of 90. When this is done 4 times, I make a square and end up facing in the same direction as when I started.

Slide #15:

In this example I used the repeat to draw the three lines of a triangle and then draw the four lines of a square.  See the flowchart on the following page.

Slide #16:

This shows the logic of the code shown.  I set the color to lime and then I do the code in the loop until I have done it 3 times. Then I turn 180 degrees, set the color to pink and do the code in the next loop until I have done it 4 times.

Slide #17:

Now I am back to using thirty turtles (the default).  Be careful of the spacing when you type the commands, logo wants spaces as indicated when I typed the command.  The syntax is reasonably strict.

The syntax for the if is:

if condition [list of commands]

The condition is COLOR = PINK

I only used one command, FD 10.  I could have added other commands which I will do on the next slide.

Slide #18:

Now I have the results of executing two IF statements.  The second one said if the turtle was yellow, I wanted to put the pen down and then move forward 5 which draws a line.

Slide #19:

Finally, I added the IF command that said if the turtle was BLUE, I wanted to move forward 15, put the pen down, make a right turn of 90 and then move forward 5.

This is one of those cases where there is a little flexibility in writing the command.  I could have said move forward 15 and then right turn of 90 and then put the pen down before moving forward 5.  In other words, it does not matter whether I put the pen down before or after I make the right turn of 90.  It does matter that I get the pen down before I go forward 5 or I will not get the effect shown.

Slide #20:

The IFELSE has the following syntax:

IFELSE condition [list of commands1] [list of commands2]

Which translates as if the conditions is true execute the list of commands1 which is in the first set of brackets.  If the condition is not true execute the list of commands 2 which is in the following set of square brackets.  See flowchart on next slide.

Slide #21:

If the color is pink step forward 10 else step forward 5.

Slide #22:

I have a series of IF statements that are executed in sequence and sent turtles forward and back depending on whether they meet the color specified in the condition.

Slide #23:

In this example, if the color is either pink or lime the turtle moves forward 10 else the turtle moves forward 5.  See the flowchart on the next slide.

Slide #24:

If the color is either pink or lime you want to move forward by 10 steps else you want to move forward by 5 steps.

Slide #25:

HT means hide turtle and ST means show turtle

SHOWN? tests to see if the turtle is shown or visible. 

Note that I put parenthesis around the whole condition on the first IFELSE and did not put parenthesis around the whole condition on the second IFELSE.  They both worked proving that the parentheses are optional.