Functional Problem Solving (CSC 151 2014F) : Reference

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!.)