Tips and Tools for Logo Programming

Click below for tips on using different aspects of Terrapin Logo and tools you can incorporate to emphasize various aspects of Logo. If you have a question about Terrapin Logo that could result in a tip that would help others or a suggestion for a useful tool, contact Terrapin. The tip or tool could soon appear on this page! Also check the example and utility procedures that come on the Terrapin Logo CD

 

 

The turtle and its environment

The properties of a Logo turtle, such as pen state, heading, and visibility are well known. A turtle also knows aspects of its environment which may be incorporated into Logo procedures. The Logo Graphics window is a plane defined by cartesian coordinates. XCOR provides the turtle's current X position on the plane and YCOR provides the turtle's current Y position. GETXY provides both the X and Y coordinates in a two-element list.

DOTCOLOR with a two-element list as input returns the color of the specified coordinate on the Graphics screen. DOTCOLOR GETXY or alternatively (DOTCOLOR) returns the color under the first active turtle.

These commands may be used to incorporate "turtle intelligence" into your procedures. The turtle may be used to map the graphics screen or to respond to encountering different colors as it moves.

Does Logo really know what time it is?

Create a clock with the Logo TIME functionMost computers have built in clocks and Logo has access to both the time and the date available from the computer's clock. The Logo TIME command and the DATE command output the current time and date respectively taken from the computer's clock in three element lists. [hour minute second] and [day month year] Information from these commands may be incorporated in Logo programs such as the clock programs in Project Ideas. The time may also be used as a random number or random number seed.

Adding comments to Logo procedures

Add comments with a semi-colonComments are text remarks in a program that are not executed by the computer, but which provide explanation about what the program does. When writing Logo procedures, it is often useful to add comments to help remember what is intended by a particular Logo command line. In Terrapin Logo, anything that follows a semi-colon (;) up until ENTER, is ignored by the computer. This means comments may be added to Logo procedures by preceding them with a semi-colon.

Since comments are not part of a Logo procedure, they are removed from it when a procedure is defined into workspace to maximize available memory. To read comments, a Logo file should be loaded into the editor. To preserve comments, a Logo file should be saved from the editor.

A Bigger, Slower, Bolder Turtle

A Bigger, Bolder TurtleIn some circumstances, especially when working with young children, it is useful to have a bigger, slower, bolder turtle so that its movements can be watched step-by-step. Terrapin Logo allows you to easily adjust both the turtle size and the speed at which it moves when executing commands. In addition you can adjust the width of the line that the turtle draws so it makes bolder drawings.

Adjustments to turtle size, speed, and line width can be made via the Turtle Center dialog box or by commands. You can open the Turtle Center by clicking on the Turtle Tool button or by right-clicking (in Windows) or Control-clicking (on the Mac) the turtle itself. The Control Center offers sliders that can be used to adjust the turtle scale and crawl speed and an edit box to enter an integer to represent the line width (in pixels).

Pairs of commands are also available that allow you to manage turtle size, speed, and line width. TURTLESIZE, SPEED, and WIDTH report the current size, speed, and line width of the first active turtle. SETTURTLESIZE, SETSPEED, and SETWIDTH can be used to adjust these attributes. Consult the Reference Manual, Quick Reference, or on-line Help from within Logo for more information on using these commands.

Consult the Reference Manual section on “Customizing your Logo environment” in the Logo Elements chapter for information on making your changes to turtle size, speed, and line width part of Logo each time you use it.

Starting over

Sometimes it can be useful to start Logo again and eliminate everything from workspace and return the windows to their default positions. This can be accomplished by choosing Restart Logo... from the Debug menu or by using the RESTART command.

Restarting LogoTyping RESTART in the Listener window causes a dialog box to appear asking for confirmation that you want to erase everything and start over. If RESTART is enclosed in parentheses, as in (RESTART), Logo restarts without the confirming dialog box. Use RESTART with care and be sure to save any work you want to keep before starting Logo again.


Logo Version

The Logo VER commands reports the version of Logo that you are currently running along with the date of its compilation. When you have a question or seek help for Terrapin Logo, type the VER command in the Listener window and report the version and date of Terrapin Logo you are using to expedite a response.