Turtle graphics

With turtle graphics, hedgehogs graphics, a picture description language is referred to, in which one imagines that a pin- carrying robot (turtle, engl. " Turtle" ) moves on the plane and, reduce with simple commands, such as lifting pin, forward walk and turn, can be controlled. This idea has been repeatedly realized, for example, as a control language for pen plotter ( HPGL ), as part of the programming for home computers ( BASIC, Pascal on Amiga, Atari ) and as a basic idea of ​​the educational programming language LOGO.

In the school sector turtle graphics are similar graphics systems still often used, because on the one hand promoted as a motivating, playful entry and the geometric idea is better trained than an access using absolute coordinates. Compared with the classic turtle graphics of LOGO, these systems have been partly expanded considerably, so that can be partially real GUI applications create (on school- level ) with it. This is the case for the Python modules xturtle and frog.

In the professional field of the Turtle approach in favor of coordinates based graphic description was dropped again and is now only used primarily for the display of fractals by means of Lindenmayer systems.

Simple commands

The turtle does not have a memory and executes commands immediately.

  • F (x) - moving forward by the length of x, and characterized thereby
  • F (x) - moving forward by the length of x, without drawing
  • (A) - turn to the left, against the clockwise direction by the angle a
  • - (a) - clockwise rotation, in the clockwise direction by the angle a

Advanced commands

It is introduced to store the current state of a respective stack. A state consists of the current position and direction of the turtle.

To this end, there are the characters [ and ] with the following meaning:

  • [- Put the current state on the stack from
  • ] - Remove the top located on the stack state and make it the current state

Within a pair of parentheses so a part of the figure, for example, one ending in the empty branch, are drawn.

407932
de