![]() |
| home geometry ASA2 curriculum puzzles articles books download about us try a short tour | MathsNet.com |
|
|
|
The things you need to know about logo are
summarised here, with particular reference to WinLogo, though note that much of what is written for
WinLogo will apply to most other "Windows" logo programs as well.
- A -ArithmeticSee Functions- B -- C -CommandsSee also Turtle commandsThese are the common basic commands in Logo.
Common errorsSee Errors- D -- E -EditingWhenever you need to alter something you've typed in, this is called editing. Once words, numbers or any other instructions have been entered in the Work window, you can move back to them using the mouse to click where you need to be. You can use the Delete key or the backspace key (marked ) to remove numbers or letters. You can also scroll up and down the Work window using the scroll bar to its right to get to things you wrote a while ago. Remember that everything you type in is kept in the Work window until you delete it (by using clw "Work for example). If you need to alter a procedure, then, after making your changes, you should move to the line that says simply End, click on this word and press Enter. This will register your edits with Win-Logo so that you can go on to use the edited procedure. ErrorsHere are listed the most common errors encountered when using logo.
- F -FunctionsIn logo you can use mathematical functions. Besides the four operators +, - / and *, you will usually find SUM, DIFFERENCE, PRODUCT AND DIVISION, together with SIN, COS, TAN and many others.- G -GeometryLogo is sometimes refered to as "Turtle Geometry". The turtle exists in a 2D (or maybe 3D) world, with geometric attributes such as position and heading and it can be controlled so as to produce geometric shapes. Turtle geometry is to be viewed from the turtle's own viewpoint. For example, a procedure to draw an equilateral triangle is: TO triangle The angle involved is not the 60 degrees given by each internal angle of the triangle, but instead the 120 degrees through which the turtle has to turn in drawing the triangle. - H -HeadingSee Turtle attributes- I -InformationYou can get information about some aspects of your current Win-Logo work using the following primitives:
InterpretA procedure is created in logo by typing instructions like these:TO SQUARE REPEAT 4 [RT 90 FD 50] END The computer must then "learn" or interpret this prodecure in order that when you subsequently type in SQUARE it automatically draws the square. In WinLogo, once text has been typed into the Work window or loaded into the Work window using File... Load (Windows... Load in Dos version), it can be interpreted in two ways:
- J -- K -- L -ListsMany versions of logo include "list-processing" procedures, ie., procedures that will work on a list of letters or words. WinLogo includes BUTLAST, BUTFIRST, FPUT, LPUT, FDIRST, LAST SENTENCE, LIST and others too. A detailed desciptions of lists is not included here, but as an example:BUTFIRST [a b c d] will look at the list [a b c d] and return all of the list apart from the first item, ie., [b c d]. LoadingLoading files previously saved to disk can be achieved in two different ways. Suppose the file is called fred.log: 1. In the Work window. Type load "fred. This will load the contents of the file into memory and "interpret" them so that any procedures defined will be available for use. Use this method if you want to load files and run them immediately. 2. Using the Menus. Click on File... Load
(Windows... Load in Dos version) and select fred.log from the
list shown. This will load the file into the Work window. They have not been
loaded into Win-Logo memory however, and so are not available at this moment to
run. To load them into memory, your procedures need to be "interpreted". (See
Interpret above for how to do this) Use this method if you want to load
files and continue editing them. LoopsSee Recursion- M -- N -NamesVariable namesIn all versions of Logo, variables can be used when creating procedures. WinLogo uses the symbol : (colon) whenever referring to variable names. For example TO SQUARE :side The colon is used when introducing the name of a variable and when using the value of the variable. Constant namesThe primitive MAKE is used to give a constant a value, for example MAKE "size 20. Note the " symbol. When the value of the constant is used, the colon should appear instead: FD :size - O -OperationsSee FunctionsOutputA common logo primitive is OUTPUT or OP, which is used to determine the result of a procedure, for example: TO ADDUP :x :y The result of applying ADDUP to two numbers is to add them up. However, if, having defined ADDUP, you enter ADDUP 5 6, you will not get 11 as logo's answer. Instead logo will say something like "I do not know what to do with 11". You have to tell logo what to do with that output, so something like this will work better: TO ADDUP :x :y - P -PrimitivesA primitive is a procedure provided in your version of logo, for example TO or FD or SETPOS.PrintingTo print the graphics, click in the Graphics window and then select File... Print. To print the procedures, click in the Work window and then select File... Print. ProceduresSee also Names and InterpretingA procedure is a set of instructions beginning with TO and ending with END which logo can interpret and then carry out. Here is a simple procedure: TO SHIFT Whenever SHIFT is entered, the turtle moves forward 10 steps. - Q -- R -RecursionIn many programming languages it is possible to introduce "loops", that is, a way of making the program repeat endlessly - or a given number of times - a set of instructions. Logo is an excellent means of introducing the concept of a loop. Here is a simple example: TO SQUARELOOP This procedure will make the turtle turn right 90 degrees then draw a square, then turn 90 degrees and draw a square, and so on, and on, until the ESC key is pressed. The example shown is sometimes called "tail recursion", due to the loop being placed at the end of the procedure. - S -SavingSaving files to disk can be achieved in two different ways. It is essential that you understand these differences. Suppose the file is to be saved as fred.log: 1. In the Work window. Type save "fred procedures. This will save all procedures (and only procedures) currently in memory into the file fred.log. Use this method if all you want to save are the procedures you've written and nothing else. 2. Using the Menus. Click on File... Save (Windows... Save in Dos version) and enter fred in the space next to Filename, overwriting *.log. This will save everything currently in the Work window - and nothing else! - in the file fred.log. Win-Logo will save an exact copy of the Work window contents. Before you save your work, make sure you clearly understand
what each method will achieve, and then choose the appropriate one. - T -Three dimensionsA few versions of logo have commands for controlling the turtle in three dimensions. The complete set of 3D WinLogo procedures is:
Turtle attributesSee also Turtle commandsThe turtle, the object that your logo instructions command, has two important attributes, its heading (ie., the direction it is pointing) and its position (as a pair of coordinates). Both of these are controllable, by using LT, RT, FD, BK or SETPOS. The turtle may have other attributes too, like its colour, whether the pen is up or down (which determines whether or not the turtle will draw a line when it moves), its shape or its name. Turtle commandsMost versions of Logo have the same set oif commands for controlling the turtle itself.
Multiple turtlesMany versions of logo allow more than one turtle on the screen simultaneously. WinLogo allows up to 12 turtles. They are numbered 1 to 12.
- U -- V -VariablesSee Names- W -- X -- Y -- Z - |
|
|
| Go to MathsNet.com to purchase mathematics resources | |