|
[top.htm] |
|
|
LOGO
LOGO is a computer language that lets the user move a turtle around the
screen. It is designed for kids and has easy to use commands. You have to
figure out how to draw, color, and move shapes.
Students may purchase a home version of MicroWorlds
EX Logo for $35,
CD-ROM for Windows or Macintosh. Doane College RoboOlympics Textbook for class: none (see below for commands and instructions) Homework: about once a week
LOGO - Seventh Grade - Mr. Price LOGO is a computer programming language developed for kids!
LOGO can use capital letters or small letters, it doesn't matter! Command center Everything is all on one page! The command center is the bottom left-hand corner. The actual drawing screen takes up the most room, and the procedures page is to the right (where you actually make your programs). LOGO commands The toughest thing about LOGO is understanding the angles and how to turn! fd 10 - moves the turtle forward in the direction it is pointing (turtle steps) bk 10 - moves the turtle backwards the number turtle steps Guess what bk -20 will actually do? Move it forward! rt 90 - will turn the turtle so many degrees to the right of its current direction. Example: rt 90 will turn the turtle 90 degrees (a square corner) to the turtle's right. This does not mean you will end up pointed to your right! If you are walking north and take a right, you will be facing east. However, if you are walking south and take a right, you will be facing west! lt 90 - will turn the turtle so many degrees to the left of the direction it is now pointed. Example: lt 90 will turn the turtle 90 more degrees to its left. repeat - lets the turtle do many commands over. Probably the most powerful LOGO command. Example: repeat 8 [ fd 100 rt 45] will go forward one hundred steps, then turn right forty-five degrees, and do that eight times in a row to make an octagon. repeat 8 [ fd 100 rt 90] will not make an octagon (can you figure out why?). home - will return the turtle to the center of the screen, no matter where it is currently. pu - pen up, means that you won't draw anything (but you can still move) The pen will remain up until you put it down. The turtle always starts with its pen up.pd - pen down, resumes drawing again. When they first made LOGO, they actually had a "turtle" robot that had a real pen to draw on the floor. pe - pen erase if you type in pe, then go back over your last command, the turtle will erase what you just drew. cg - clears graphics, clears the screen and brings the turtle back to the center. cc - clears commands, erases commands from the command center ht - hide turtle, makes the turtle disappear st - show turtle, makes the turtle reappear Writing a new program On the procedures page, begin a program with the word to , then a name for the program (doesn't matter what it's called as long as it's appropriate). Hit ENTER, and start putting the commands into the program. When you are done, you must put end on the last line. NOTE: You may put more than one command on a line. Example: to square This is a program that is called "square" and will make a square because the commands are to go forward 10 steps, turn 90 degrees (4 times in a row). To run the program, go back to the command center and type square. You do not use "to" at the command center, only "square" because that is a now a command that the computer will recognize. Now try this: to amazing How to save a program Use your mouse to go to the File menu and Save the program. Save it to your Z-drive. Click and hold on the downward arrow just to the right of the folder you are currently in. Select your account on the Z-drive and type in a recognizable name for your file. Size of the screen The turtle screen has approximately the following dimensions: 400 turtle steps wide * 700 turtle steps long. Number of turtles You can have lots and lots of turtles. newturtle "bob will create a new
turtle with a name of bob. Every command after that will now be directed
to "bob". If you want to go back to the original turtle, you need to
type in t1, to get the attention of the first
turtle (t1). If you run the program a second time, you will get an error
message because you can't make a new turtle "bob" if there is already a turtle
named "bob". Mathematical operations - Every time you add (+), subtract (-) , multiply (*), or divide (/), you need to have a space before and after each math operation command. How to make color On the top menu bar, find the icon that is the color palette (yellow with a paint brush). Click on the icon and a set of colors should pop up on the right side. setc - to change the color that the turtle draws with, you use setcolor, abbreviated to setc and then a number. The number can be seen on the color tool palette by holding the mouse on that color for a while. Or, if you know the name of the color you want, just type in setc "red (do not put quotation marks at the end, though). setbg - sets the background color for the entire screen (setbg 12)How to "FILL" - Follow the following steps to fill in a figure with all one color.1. Make a shape (rectangle, square, triangle, etc.)| How to make a circle of a specific size To make a circle, you could just type repeat 360 [ fd 1 rt 1 ] , but you wouldn't know how big that circle is! A better way is to do some math! Make sure you put a space in between any multiplying, dividing, adding, or subtracting. Repeat 360 [ fd 40 * 3.14 / 360 rt 1] (makes a circle exactly 40 steps across) Repeat 360 [ fd 50 * 3.14 / 360 rt 1 ] (makes a circle exactly 50 steps across) Circumference - distance around a circle Diameter - distance across a circle C = p dHow to make a half circle or quarter circle The only change you have to make is on the first 360! half circle -> repeat 180 [ fd 40 * 3.14 / 360 rt 1] notice that everything inside the brackets is still the same! quarter circle -> repeat 90 [ fd 40 * 3.14 / 360 rt 1 ] How to make shapes Click on color palette on the top menu bar. There are some "singles" by clicking on the sunflower, or there are some "multiples" by clicking on the people. Click on a shape, then click on the turtle. If you want to make your own, double click on the shape and then fill in the pixels. In order to control it with commands, you must first open the backpack of the turtle (right click) and drag-and-drop the shape into the backpack.setsh changes your turtle into that shape number. setsh 17 will turn the turtle into the shape number 17. Animation If you have two or three shapes that are very similar (like the horses), you can make them look like they are running! The basic idea is to change the turtle into a shape, wait a little bit, move a little bit, change it to another shape, and do all the same things! It will look like it"s a movie! repeat 100[ setsh 16 wait 1 fd 1 setsh 17 wait 1 fd 1 setsh 18 wait 1 fd 1] How to copy commands from one side to another Use your mouse to highlight commands (on the flip side or at the command center). Cut and paste just like in a word processing package. Under the Edit command in the menu at the top of the screen, copy or cut the highlighted portion. When you get to where you want, use the paste command to transfer those commands. Rule of 360 - In order to make a complete figure, the turtle must travel a total of 360 degrees.For example: repeat 5 [ fd 50 rt 72 ] makes a pentagon (5 sides) or just type repeat 5 [fd 50 rt 360 / 5] because 360 / 5 is 72 degrees .How to use a variable LOGO lets you use a variable in case you want one program to make several things of different (variable) sizes.The first step is to "declare" a variable in the title of the program. Notice that the colon (:) is right next to the "x", there is no space between them. to main :x
(but at the command center
you type "main 10") How to move the turtle around the screen SETH 0 - points the turtle straight up, set heading SETPOS - Logo command that lets you put the turtle anywhere on the screen. You must have two numbers in the brackets. The two numbers tell a certain position on the screen. The first number goes left and right, then the second number goes up and down (just like in math!) SETPOS [ 0 0 ] - puts the turtle directly in the middle of the screen SETPOS [ 140 -80 ] - puts the turtle in the bottom right hand corner of the screen SETPOS [ -140 -80 ] - puts the turtle in the bottom left hand
corner of the screen You can instantly move your turtle to any point, even making it look like it is magically popping up all over the place. If you use different shapes, you can make animals (or whatever) appear/disappear in the snap of your finger. How to tell where you are at! show pos - will show the specific location you are currently at. The two numbers that the computer returns will be your location on the grid (like latitude and longitude). In math, it's called the Cartesian coordinate system (x,y).show heading - will show the current angle you are pointed. The computer will tell you your heading. Backgrounds Pages to cool (last updated 2-29-08) |