Turtle graphics
In computer graphics, turtle graphics are a kind of vector graphics. They use a cursor called the "turtle" that moves across a Cartesian plane, which has x and y axes.
Turtle graphics is a key feature of the Logo programming language.
It is also a simple and helpful way of learning about moving frames.
Overview
The turtle has three parts: a location, a direction, and a pen. The pen also has a color, a width, and an on or off state (also called down and up). The turtle moves using commands based on its own position, such as "move forward 10 spaces" or "turn left 90 degrees." You can also control the pen by turning it on, changing its color, or changing its width. A student can understand and predict the turtle's movement by imagining what they would do if they were the turtle. Seymour Papert called this "body syntonic" reasoning.
A full turtle graphics system needs control flow, procedures, and recursion, and many turtle drawing programs do not have all of these. With these building blocks, you can make more complex shapes like squares, triangles, circles, and other combined figures. The idea of turtle graphics is useful in a Lindenmayer system for creating fractals. Turtle geometry is also sometimes used in graphics environments as an alternative to a system that uses exact coordinates.
History
Turtle graphics are often linked with the Logo programming language. Seymour Papert added turtle graphics to Logo in the late 1960s to work with his version of the turtle robot, a simple robot controlled from a computer. The robot drew with a small pen that could be pulled in and out of its body. Turtle geometry works differently from Cartesian geometry, since it is mostly vector-based, describing a direction and distance from a starting point. This matches how the turtle robot actually moved. The turtle is usually shown as a triangle or a turtle icon, though any icon can be used.
Today, the Python programming language includes a turtle graphics module, and programmers can use it to control one or more turtles on a flat surface. Because it works together with Python's usual commands and data structures, turtle has become a popular way for people learning Python to practice the basics.
Extension to three dimensions
The ideas behind turtle graphics can be extended to three-dimensional space by using one of several coordinate models. A common setup is the cartesian-rotational model, as with the original 2D turtle. It adds an "up" direction, called a normal vector, that chooses the flat plane in which the turtle's 2D "forward" direction turns. The "up" direction also turns around the "forward" direction, so the turtle has two heading angles: one within the plane and one that sets the plane's angle. Usually, changing the plane's angle does not move the turtle, which follows the traditional setup. Verhoeff (2010) uses this two-vector approach with a "roll" command that turns the "up" direction around the "forward" direction. The article also shows that a "dive" command is really a shortcut for a turn, a roll, and another turn.
Cheloniidae Turtle Graphics is a 3D turtle library for Java. It has a "bank" command (the same as "roll") and a "pitch" command (the same as "dive") in its "Rotational Cartesian Turtle." Other coordinate models, including non-Euclidean geometry, are allowed but not included.
Code example
The following Python code uses the turtle module to create a rainbow spiral. The turtle moves forward, turns, and changes color over and over, so the lines slowly spread out into a spiral of rainbow colors.

Quiz time!
5 questions about Turtle graphics
What three parts does the turtle have?
Pictures
Keep exploring
This article is a child-friendly adaptation of the Wikipedia article on Turtle graphics, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.