Package turtle

Interface Turtle

All Known Implementing Classes:
DrawableTurtle

public interface Turtle
Turtle interface. Defines the interface that any turtle must implement. Note that the standard directions/rotations use Logo semantics: initial heading of zero is 'up', and positive angles rotate the turtle clockwise.

PS0 instructions: do NOT change this interface.

  • Method Summary

    Modifier and Type Method Description
    void color​(PenColor color)
    Change the turtle's current pen color.
    void draw()
    Draw the image created by this turtle.
    void forward​(int units)
    Move the turtle forward a number of steps.
    void turn​(double degrees)
    Change the turtle's heading by a number of degrees clockwise.
  • Method Details

    • forward

      void forward​(int units)
      Move the turtle forward a number of steps.
      Parameters:
      units - number of steps to move in the current direction; must be positive
    • turn

      void turn​(double degrees)
      Change the turtle's heading by a number of degrees clockwise.
      Parameters:
      degrees - amount of change in angle, in degrees, with positive being clockwise
    • color

      void color​(PenColor color)
      Change the turtle's current pen color.
      Parameters:
      color - new pen color
    • draw

      void draw()
      Draw the image created by this turtle.