Navigating the world of programming can often feel like learning a new language, and for many, the journey began with LOGO. This iconic programming language, designed for educational purposes in the late 1960s by Seymour Papert and Wally Feurzeig, introduced countless learners to fundamental computational concepts through an engaging visual metaphor: the turtle. The core of LOGO’s appeal lies in its simplicity and immediate feedback, allowing users to draw graphics by issuing commands to a virtual “turtle” on the screen. If you’ve ever wondered, “How do I move the turtle in LOGO?”, you’re tapping into the very essence of its interactive learning experience. Understanding these basic commands is your first step towards unlocking the creative potential of turtle graphics and grasping foundational programming principles.
Understanding the LOGO Turtle and Its Environment
The LOGO turtle is more than just a cursor; it’s a programmable agent that responds to your instructions, drawing lines as it moves across a virtual canvas. Imagine a tiny robot on a piece of paper, holding a pen. When you tell it to move forward, it moves and draws a line. When you tell it to turn, it pivots. This intuitive model makes complex geometric concepts accessible and tangible. The turtle starts at the center of the screen, facing upwards (or ’north’, at 0 degrees), ready to execute your commands.
The LOGO environment itself is typically a simple window displaying the drawing area and a command input line. As you type commands like FD 100 (Forward 100 steps) or RT 90 (Right Turn 90 degrees), the turtle responds instantly, providing immediate visual feedback. This direct manipulation helps solidify the link between code and outcome, a crucial aspect of learning programming fundamentals. The screen can be thought of as a Cartesian coordinate system, with the turtle’s starting point at (0,0), though you rarely need to explicitly use coordinates yourself; the turtle handles the geometry.
One of the beauties of LOGO is its low barrier to entry. You don’t need to understand complex syntax or data structures to begin; you simply need to know a few basic LOGO commands to start moving the turtle and drawing shapes. This makes it an excellent tool for introducing computational thinking, problem-solving, and geometry to beginners of all ages, fostering an experimental and playful approach to learning. As Seymour Papert famously stated, “The computer is the Proteus of machines. Its essence is its universality, its capacity to imitate.”
Essential LOGO Commands for Movement
To move the turtle in LOGO, you’ll primarily use a set of simple, yet powerful, commands. These instructions dictate the turtle’s direction, distance, and orientation on the screen. Mastering these commands is the cornerstone of creating any graphic design or animation within the LOGO environment.
For instance, to make the turtle move forward, you use the FORWARD command, often abbreviated as FD, followed by a number indicating the distance in “turtle steps.” Similarly, BACKWARD (or BK) moves the turtle in reverse. To change the turtle’s direction without moving, you use RIGHT (RT) or LEFT (LT), followed by a number representing the angle in degrees. These rotational commands are crucial for drawing polygons and intricate patterns.
Here are some of the most fundamental movement commands:
FD [number]: Moves the turtle forward by the specified number of steps.BK [number]: Moves the turtle backward by the specified number of steps.RT [angle]: Turns the turtle right by the specified angle in degrees.LT [angle]: Turns the turtle left by the specified angle in degrees.HOME: Returns the turtle to its starting position (center of the screen) and original heading (facing up), without clearing the drawing.CS(Clear Screen): Clears the entire drawing screen and resets the turtle to its HOME position and heading. This is often used to start a new drawing.CLEAN: Clears the drawing screen but leaves the turtle in its current position and heading.
Basic Steps to Move the Turtle
Let’s walk through a simple sequence to illustrate how these commands work together to draw a basic line or shape:
- Open your LOGO interpreter: Launch your chosen LOGO software (e.g., MSWLogo, UCBLogo).
- Issue a forward command: Type
FD 100and press Enter. The turtle will move forward 100 steps, drawing a line. - Turn the turtle: Type
RT 90and press Enter. The turtle will turn 90 degrees to its right. - Move forward again: Type
FD 100and press Enter. The turtle moves forward again, completing a corner of a square. - Clear the screen (optional): Type
CSand press Enter to clear the drawing and reset the turtle for a new drawing.
This simple sequence demonstrates the iterative nature of LOGO programming, where complex drawings are built up from many small, precise instructions. The immediate visual feedback makes it easy to debug and experiment, encouraging a hands-on approach to learning.
Controlling the Pen: Drawing and Lifting
While movement commands dictate where the turtle goes, the pen commands determine whether it draws a line or not. Imagine the turtle holding a pen that can be lifted off the paper or placed down to draw. This functionality allows for disconnected lines, jumps, and more intricate designs, moving beyond simple continuous strokes.
The two primary pen control commands are PENUP and PENDOWN. When the turtle is in PENDOWN mode (which is its default state), any movement command will result in a line being drawn. Conversely, when the turtle is in PENUP mode, it will move without leaving a trace. This is incredibly useful for repositioning the turtle to a new starting point for a different part of your drawing, or for creating dashed lines and complex patterns that require lifting the “pen.”
Consider drawing a dotted line or moving the turtle to a new location without drawing. You would use PU before the move command, and then PD when you want it to resume drawing. This capability significantly expands the range of graphics you can create, enabling more sophisticated designs than just simple geometric shapes. It’s a fundamental concept in graphics programming: separating the act of moving from the act of drawing.
Key pen control commands:
-
PU(PENUP): Lifts the turtle’s pen, so it moves without drawing. -
PD(PENDOWN): Puts the turtle’s pen down, so it draws lines as it moves. -
PE(PENERASE): Changes the pen mode to erase, allowing the turtle to erase existing lines as it moves. -
PXQuestion & Answer :How do I move the [turtle](http://en.wikipedia.org/wiki/Turtle_graphics) in [LOGO](http://en.wikipedia.org/wiki/Logo_(programming_language))?// MOVE FORWARD FD 75 // TURN RIGHT RT 54 // TURN LEFT LT 21 // MOVE BACKWARD BK 17Check out some other turtle commands found here…
Turtle Commands
-
BACK ## [BK]- Move turtle back -
BACKGROUND ## [BG]- Set Background color (0-15)- 0 - Black
- 1 - White
- 2 - Red
- 3 - Cyan
- 4 - Purple
- 5 - Green
- 6 - Blue
- 7 - Yellow
- 8 - Orange
- 9 - Brown
- 10 - Light Red
- 11 - Grey 1
- 12 - Grey 2
- 13 - Light Green
- 14 - Light Blue
- 15 - Grey 3
-
CLEARSCREEN [CS]- Clear Screen without moving turtle -
DRAW- Clear Screen and take turtle home -
EACH- Tell several sprites, whose numbers are in a list, to accept commands in a second list, e.g.EACH [1 2] [SQUARE 10] -
FORWARD ## [FD]- Move turtle forward -
FULLSCREEN- Full graphics screen (same as pressing F5) -
HEADING- Output turtle heading as a number (0-359) -
HIDETURTLE [HT]- Make turtle invisible -
HOME- Move turtle to center of screen pointing up -
LEFT [LT]- Turn turtle left -
NODRAW [ND]- Enter text mode with clear screen -
NOWRAP- Prevent drawings from wrapping around screen -
PENCOLOR [PC]- Change pen color -
PENDOWN [PD]- Turtle leaves trail -
PENUP [PU]- Turtle ceases to leave trail -
RIGHT ## [RT]- Turn turtle right -
SETHEADING [SETH]- Set turtle heading, e.g.SETH 180 -
SETSHAPE- Set the current sprite shape (0-7) -
SETXMove the turtle to the specified x co-ordinates e.g.SETX 50 -
SETXYMove the turtle to the specified x, y co-ordinates Eg.SETXY 50 50 -
SETYMove the turtle to the specified y co-ordinate, e.g.SETY 50 -
SHAPE- Output number of current sprite’s shape -
SHOWTURTLE [ST]- Make turtle visible -
SPLITSCREEN- Mixed graphics and text screen (same as pressing F3) -
STAMPCHAR- Make the turtle stamp a character at the current location, e.g.STAMPCHAR "A -
TELL- Tell designated sprite to receive commands, e.g.TELL 2 -
TEXTSCREEN- Use whole screen for text (same as pressing F1) -
TOWARDS- Output heading for turtle to face an X,Y coordinate, e.g.TOWARDS 0 0 -
WRAP- Make turtle drawings wrap around the screen -
XCOR- Output current x co-ordinate of turtle -
YCOR- Output current y co-ordinate of turtle -
ASPECT- Set verticle screen scale factor, default is 0.76
Samples taken directly from website: http://gaza.freehosting.net/logo/index.html
-