CS111 Lab 6

Wednesday, March 6 2002

Objectives

Part 1 -- Brief introduction to TurtleWorld

Turtle drawing primitives include the following:
   public void fd (double n)
   Move the turtle forward n steps. 
   
   public void bd (double n); 
   Move the turtle backward n steps.
   
      public void lt (double angle);
   Turn the turtle to the left angle degrees.  
   
   public void rt (double angle);
   Turn the turtle to the right angle degrees. 
   
   public void pu (); 
   Raise the turtle's pen up.
   
      public void pd (); 
   Lower the turtle's pen down.
Additionally, there are also versions of fd, bd, lt, and rt that take int parameters, so you can invoke these methods with either an integer or double floating-point value.

You should not need to use any other Turtle primitives other than those listed above. In fact, many solutions use only a subset of the primitives listed above.

Test your definition by specifying levels and side in the parameter window and then clicking on the Run button in the TurtleWorld window. The Reset button will clear the screen. Good parameter values are in the ranges [0 ... 8] for levels and [100 ... 400] for side. If your program hangs, you may need to "force quit" it by depressing the option, apple, and escape keys all at the same time.

Part 2 -- Exercises

Most of the programming problems for this lab take place in extensions of TurtleWorld. The code is in the lab6_programs folder within the /cs111/download directory on cs111.wellesley.edu. The problems are arranged in order of difficulty with the easiest problem first. The last problem is a BuggleWorld recursion problem.

  1. BoomerangWorld
  2. EiffelWorld
  3. InvertedTrianglesWorld
  4. NestedWindowWorld
  5. NestedPolygonWorld
  6. ConcentricRugWorld

Working samples of the above worlds are available in the test folder which is included in the lab6_programs folder.