2. Module 1: Fundamentals of Turtle Graphics
- Module 1: Fundamentals of Turtle Graphics
Turtle Graphics is the interactive heart of the Logo programming environment. By learning the simple commands that control the turtle’s movement, students receive immediate visual feedback, connecting their typed code directly to a tangible outcome on the screen. This direct relationship makes the learning process intuitive, rewarding, and foundational for understanding more complex programming concepts.
2.1. Issuing Basic Commands
The most fundamental interactions in Logo involve moving and turning the turtle. These simple commands, which can be written out in full or as abbreviations, are the building blocks of all drawings.
| Command | Abbreviation | Purpose |
| forward | fd | Moves the turtle forward by a specified distance. |
| backward | bk | Moves the turtle backward by a specified distance. |
| right | rt | Rotates the turtle to its right by a specified angle. |
| left | lt | Rotates the turtle to its left by a specified angle. |
| clearscreen | cs | Erases all drawings and resets the turtle to the center. |
Most commands must be followed by a numeric value, known as an argument, which specifies how the command should be executed.
- The fd and bk commands require an argument that represents units of distance (e.g., fd 100 moves the turtle forward 100 units).
- The rt and lt commands require an argument that represents degrees of an angle (e.g., rt 90 turns the turtle 90 degrees to the right). A rotation of 360 degrees is a full circle. This is a great opportunity to teach students about modular arithmetic in a geometric context; for example, a command like rt 375 is the same as turning a full circle plus 15 degrees, so it has the same result as rt 15.
Logo reads and executes these commands sequentially from left to right. For example, to draw a triangle, a student would issue the following sequence of commands, which Logo processes one after another to produce the final shape:
fd 50 rt 120 fd 50 rt 120 fd 50 rt 120
2.2. Controlling the Pen and Turtle State
Beyond basic movement, students can control the turtle’s drawing tool (the pen) and its visibility on the screen. This allows for the creation of more complex graphics, such as disconnected shapes.
| Command (with Abbreviation) | Function |
| penup (pu) | Lifts the pen, allowing the turtle to move without drawing. |
| pendown (pd) | Puts the pen down, causing the turtle to draw as it moves. |
| hideturtle (ht) | Hides the turtle icon from the screen to allow for a clear view of the final drawing. |
| showturtle (st, dt) | Makes the turtle icon visible again. |
| setpensize | Changes the thickness of the line drawn by the turtle. The default size is [1 1]. |
2.3. Navigating the Turtle World
The drawing window operates on a standard two-axis coordinate plane, with the origin (0, 0) located at the center of the screen. A unique feature of the Logo environment is its “wrap-around” behavior; if the turtle moves off one edge of the screen, it automatically reappears on the opposite edge to continue its path. The following commands allow for precise control over the turtle’s position and orientation.
Educator’s Note: The “wrap-around” screen is a fun and important concept. Challenge students to predict where the turtle will reappear after going off the top, bottom, left, or right edge. This helps build spatial reasoning and an intuitive understanding of a toroidal coordinate system.
| Command | Purpose |
| home | Returns the turtle to the center of the screen (0, 0). |
| setxy | Moves the turtle to a specific X and Y coordinate. |
| setx | Moves the turtle horizontally to a specific X coordinate. |
| sety | Moves the turtle vertically to a specific Y coordinate. |
| show xcor | Reports the turtle’s current X-coordinate. |
| show ycor | Reports the turtle’s current Y-coordinate. |
| setheading (seth) | Sets the turtle’s orientation: 0 is up, 90 is right, 180 is down, and 270 is left. |
| label | Prints text on the drawing window at the turtle’s current location (e.g., label “Start or label [Hello World]). |
Having mastered manual command entry, students are now prepared to transition to the more powerful concept of automating command sequences through repetition.