2.0 Turtle Graphics and a Coordinate World
2.0 Turtle Graphics and a Coordinate World
The central metaphor in Logo is the “Turtle,” a cursor that moves around the screen and can be instructed to draw lines.
2.1 The Coordinate System
The Drawing Window operates on a two-axis Cartesian (xy) coordinate plane, similar to that used in algebra.
- Origin: The center of the screen is the origin, with coordinates 0 0.
- Boundaries: The coordinate system extends to approximately +250, +250 (northeast), +250, -250 (southeast), -250, -250 (southwest), etc. in its default state.
- Wrap-Around Feature: If the turtle moves off one edge of the screen, it reappears on the opposite side.
- Headings: The turtle’s direction can be controlled with headings corresponding to a compass, where 0 or 360 degrees is straight up and 90 degrees is to the right.
2.2 Fundamental Turtle and Pen Commands
A set of simple commands controls the turtle’s movement, orientation, and drawing status. Many commands have both a full name and an abbreviation.
| Command/Abbreviation | Argument(s) | Description |
| forward / fd | units | Moves the turtle forward by the specified number of steps. |
| backward / bk | units | Moves the turtle backward by the specified number of steps. |
| right / rt | degrees | Rotates the turtle clockwise by the specified angle. |
| left / lt | degrees | Rotates the turtle counter-clockwise by the specified angle. |
| clearscreen / cs | none | Erases all drawings and returns the turtle to the center of the screen. |
| penup / pu | none | Lifts the pen, allowing the turtle to move without drawing. |
| pendown / pd | none | Lowers the pen, causing the turtle to draw as it moves. |
| hideturtle / ht | none | Makes the turtle invisible. |
| showturtle / st | none | Makes the turtle visible. |
| home | none | Returns the turtle to the center of the screen (0 0). |
| setpensize | [width height] | Sets the thickness of the pen. The default is [1 1]. |
2.3 Advanced Positioning Commands
Logo provides commands for precise control over the turtle’s position and heading.
| Command | Purpose |
| setx [value] | Sets the turtle’s x-coordinate without changing the y-coordinate. |
| sety [value] | Sets the turtle’s y-coordinate without changing the x-coordinate. |
| setxy [x] [y] | Moves the turtle to the specified xy-coordinate. |
| setheading / seth | Sets the turtle’s absolute heading in degrees (0 is up). |
| show xcor | Reports the turtle’s current x-coordinate. |
| show ycor | Reports the turtle’s current y-coordinate. |
| label | Prints a word or list of words at the turtle’s current location. |
| cleartext / ct | Clears the text from the Commander window’s history box. |