Sierpinski
CSSE 221 – Fundamentals of Software Development Honors
Fall 2008–2009

Work on this exercise individually. Get help only from your instructor or student assistants -- that will maximize your learning experience on this project.

Goals

The goals of this exercise are to apply and hence reinforce your understanding of:

Overview

You will write the recursive method of a project that displays Sierpinski triangles like these:

  Link to Sierpinski level 5 picture
Level of detail: 0 1 2 3 5

We supply all of the project except the implementation of the recursive method drawSierpinski -- you will write that method, per the instructions below.

Instructions

  1. In Eclipse, checkout the Sierpinski project from your individual repository.
  2. Run the project. You should see a single triangle (the Sierpinski triangle whose level of detail is zero). Pressing the buttons has no effect (yet), because you have not implemented the drawSierpinski method (yet -- see next step of instructions).
  3. Read ALL of this step of the instructions before doing any of this step.

    Complete the project by doing ONLY the following -- NO OTHER CHANGES ARE PERMITTED (e.g. NO ADDITIONAL FIELDS):

    1. Add parameters as needed to the drawSierpinski method in SierpinskiPanel.
      • Keep the two parameters that drawSierpinski already has -- you will need to add more parameters for the method to become recursive.
    2. Change the call to drawSierpinski at lines 69-70 of SierpinskiPanel to have whatever additional arguments it needs.
      • Keep the two existing arguments.
    3. Write the code for drawSierpinski -- it MUST be recursive (else no credit).

    You may find the following geometric/graphical facts helpful (READ CAREFULLY):

  4. Turn in your work by commiting your project to your individual repository.