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.
- Limbs must be, and can only be added, recursively.
- You may use randomness anywhere
- You may do things before starting to draw your tree -- for instance to create a background.
- You may draw more than one tree (make a forest?)
- 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.
- 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:
- README: This file should follow the format of this sample README (https://cs.brynmawr.edu/cs206/README.txt)
- Within the README file, include a brief (max 1 paragraph) reflection on what went well and/or poorly and why
- Instructions for making your "best" tree. The instructions may be as simple as "execute the class XXX ". If you have command line parameters or take input from the user be sure to say what that is.
- Source files: Every .java file used in the final version of every part of your project (including the imported files)
- Unique Data files used: If any (you might have a leaf image?)
- An image of your best tree. Perhaps the simplest way of doing so is to just take a picture of the screen. There are better ways.
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/
- For this assignment N=8
- Put the README file into the project directory and your maze (/home/YOU/cs206/AssignmentN)
- Go to the directory /home/YOU/cs206
- Enter submit -c 206 -p N -d AssignmentN
For more on using the submit script click here