Turtle graphics draws through commands interpreted relative to a moving cursor's position and heading. A forward command moves along the current heading, a turn changes it, and pen state determines whether motion leaves a mark. The picture is the trace of a sequence of state changes, making geometric reasoning executable.[ref]
In Logo, repeat 4 [forward 100 right 90] draws a square and returns to the original heading and position. For a regular -sided polygon, each exterior turn is degrees, so the total turning is one full revolution. The same procedure works from a different initial position or heading, illustrating how local commands avoid specifying every absolute coordinate.

Articles by others on the same topic (0)

There are currently no matching articles.