CS 206 - Introduction to Data Structures

Assignment 8: Due 11:59PM Thursday April 9, 11:59pm

Part 1 -- Making better trees

Watch the video on Moodle, "Java Graphics -- Trees" and get my code for drawing Trees. (This code is also available /home/gtowell/Public206/a8/Tree.java.) The challenge is to make a better looking tree than mine.

I encourage you to experiment with colors, and with drawing shapes other than just lines. For instance, you might replace the simple line drawer of random thickness and color with code that draw lines of different thickness (and colors) depending on the distance from the trunk. There are lots of other options for drawing that you can try in java.awt.Graphics2D. https://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html and lots of on-line documentation and suggestions for its use. Moving in a different direction, you might experiment with making trees that distinctly different from the default. For instance, can you make a christmas tree like tree? Or even more extreme, can you make a dendritic tree in the brain?

Rules for better trees.

  1. Limbs must be, and can only be added, recursively.
  2. You may use randomness anywhere
  3. You may do things before starting to draw your tree -- for instance to create a background.
  4. You may draw more than one tree (make a forest?)
  5. You may add things to you tree (leaves) but only at the end of branches. That is the only time you can do anything other than add a limb is at the base case of the recursion.
  6. YOu can modify the base case of the recursion in any way that suits you. For instance, you could add a base case that essentially disallows downward pointing limbs.

After this assignment is complete, I will make up a video showing everyone's tree. I will then create a panopto vote for your top 3 favorites. A part of your grade will be based on that vote.

If you are really not connecting with trees (ouch) you may try to make snowflakes or any other fractally defined structure.

Electronic Submissions

Your program will be graded based on how it runs on the department’s Linux server, not how it runs on your computer. The submission should include the following items: DO NOT INCLUDE:
Data files that are read from the class site.

The following steps for submission assume you are using Eclipse, and that you created a project named AssignmentN in the directory /home/YOU/cs206/

  1. For this assignment N=8
  2. Put the README file into the project directory and your maze (/home/YOU/cs206/AssignmentN)
  3. Go to the directory /home/YOU/cs206
  4. Enter submit -c 206 -p N -d AssignmentN

For more on using the submit script click here