Turtles


Building Turtles

(turtle-new image)
MediaScheme Turtle Constructor. Build a new turtle that draws on image.
(turtle-clone turtle)
MediaScheme Turtle Constructor. Make a clone of turtle (same position, direction, color, brush, etc.).

Moving Turtles

(turtle-forward! turtle distance)
MediaScheme Turtle Procedure. Moves turtle forward by the specified distance.
(turtle-teleport! turtle col row)
MediaScheme Turtle Procedure. Move turtle to (col,row). Do not draw along the way.
(turtle-face! turtle angle)
MediaScheme Turtle Procedure. Make turtle face the direction specified by angle (clockwise from right).
(turtle-turn! turtle angle)
MediaScheme Turtle Procedure. Rotate turtle clockwise by angle degrees.

Drawing with Turtles

(turtle-down! turtle)
MediaScheme Turtle Procedure. Put turtle's brush down. When the turtle moves forward, it draws with the brush.
(turtle-up! turtle)
MediaScheme Turtle Procedure. Lifts turtle's brush. When turtle moves forward, it will not draw.
(turtle-set-brush! turtle brush)
MediaScheme Turtle Procedure. Set the brush that turtle draws with.
(turtle-set-brush! turtle brush size)
MediaScheme Turtle Procedure. Set the brush (including the brush size) that turtle draws with. The brush must be one of the resizable brushes.
(turtle-set-color! turtle color)
MediaScheme Turtle Procedure. Set the color in which turtle draws.

Getting Information About Turtles

(turtle-angle turtle)
MediaScheme Turtle Procedure. Get the angle that the turtle faces.
(turtle-point turtle)
MediaScheme Turtle Procedure. Get the point at which the turtle resides.
(turtle-row turtle)
MediaScheme Turtle Procedure. Get the row of the point at which the turtle resides.
(turtle-world turtle)
MediaScheme Turtle Procedure. Determine the world on which turtle resides.
(turtle-brush turtle)
MediaScheme Turtle Procedure. Get the brush the turtle uses to draw.
(turtle-brush-size turtle)
MediaScheme Turtle Procedure. Get the size of the brush that the turtle uses to draw.
(turtle-color turtle)
MediaScheme Turtle Procedure. Get the color of the brush that the turtle uses to draw.

Miscellaneous Turtle Procedures

(turtle-show! turtle angle)
MediaScheme Turtle Procedure. Make turtle visible, so that it is displayed after each call to turtle-forward!, turtle-turn!, turtle-teleport!, and turtle-face!. Visible turtles are generally much slower. Useful primarily for novices and for generating interesting patterns.
(turtle-hide! turtle angle)
MediaScheme Turtle Procedure. Make turtle invisible, so that it is not displayed. (That is, undoes turtle-show!.)

Jerod Weinman

Copyright 2007-2014 Janet Davis, Matthew Kluber, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials copyright by John David Stone and Henry Walker and used by permission.)

This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License .