EZ Programing Demos

Slow motion, step by step, animated demonstrations of basic computer programing techniques

Links to topics:

Current topic:

Turtle graphics - Moving around

Here we will see the basic commands within turtle graphics that aim and move the turtle. We will move the turtle forward and turn it left and right.

 Slow  Medium  Fast 
Click 'Run' to go.

Here are our first three turtle commands:

fd - Means 'forward'. Follow this command with an expression, usually a number. That value represents how far the turtle should move forward.

    Example: fd 5

The above command tells the turtle to move 5 units forward. It does not change the turtle's direction.

 

lt - Means 'left'. Follow this command with an expression, usually a number. That value represents the number of degrees that the turtle should spin toward its left.

    Example: lt 90

The above tells the turtle to spin 90 degrees to its left. It does not move the turtle any distance.

 

rt - Means 'right'. Follow this command with an expression, usually a number. That value represents the number of degrees that the turtle should spin toward its right.

    Example: rt 45

The above tells the turtle to spin 45 degrees to its right. This command does not move the turtle through a distance.

 

Although it is not shown in this demo, turtle graphics systems usually have a 'back' (or bk) command that makes the turtle move in reverse.

Be sure to understand that when the turtle turns, it does not move across the (x, y) graph. It spins to the left or right in place. Therefore, we say it rotates without translating.

Also, when the turtle moves forward or backward across the graph it does not change the direction in which it is pointing. So, we say it translates without rotating.

Combinations of forward and backward movements along with turns to the left and right can be used to make the turtle draw both simple and complicated diagrams.

 

Here's what a flowchart for this turtle demo looks like:

 

An imaginary computer language might put things this way:

    
    fd(4);
    lt(90);
    fd(4);
    rt(90);
    fd(4);
    

 

Suggested next article:

At EZ Math Movie

EZ Math Movie is a site that can help you experiment with and understand many topics in mathematics. Its main feature is an interactive animated (x, y) graph that you control with an actual programing language. There are many examples and tutorials, and EZ Math Movie is crossed referenced with both EZ Programing Demos and Zona Land Education.

 

Zona Land Education is a site with explanations and interactive diagrams covering many topics in physics and mathematics. Zona Land Education is cross referenced with EZ Math Movie, and it contains several animations that use EZ Math Movie's programing language.