The project this week is to continue to make shape classes, making use of inheritance, starting with a tree class.
Because we use an L-system to generate the string to draw, a Tree object must contain an L-system, which means it must have a field that holds an L-system object.
Because a Tree is a Shape, it must be a child of the Shape class. That lets it use the parent functions for setting color, distance, and angle, among other things.
To make our Tree class, start by creating a file called tree.py. Import your lsystem and shape modules. The Tree class should be derived from the Shape class, but you'll need to override some of the methods because of the special nature of a Tree: it needs more fields than a simple Shape, and it has to dynamically create the string it will draw using an L-system.
The methods you'll need to override or create for the Tree class include:
Once you've written the tree class, make a test function for the class and try it out. This function should take in an L-System filename, create a Tree object, and then use the Tree object's draw method to draw at least 3 trees. Use an L-system with multiple replacements for at least one rule and show the three trees are different.
The output of your tree.py test function is required image 1.
The output of your shapes.py test method is required image 2.
The indoor scene with a painting is required image 3.
Then make a function mosaic(x, y, scale, Nx, Ny) that draws a 2D array of tiles Nx by Ny, where each tile is of size scale by scale, and the lower left corner of the mosaic is at (x, y). So if scale is 10, Nx is 3 and Ny is 4, the function should draw twelve 10x10 tiles three across and four down.
An image of at least 20 tiles (5 x 4) is required image 4.
Each assignment will have a set of suggested extensions. The required tasks constitute about 85% of the assignment, and if you do only the required tasks and do them well you will earn a B+. To earn a higher grade, you need to undertake one or more extensions. The difficulty and quality of the extension or extensions will determine your final grade for the assignment. One complex extension, done well, or 2-3 simple extensions are typical.
Before handing in your code, double check that it is well-styled:
Make a new wiki page for your assignment. Put the label cs151s14project9 on the page. Each of you needs to make your own writeup.
In addition to making the wiki page writeup, put the python files you wrote on the Academics server in your private handin directory.
In general, your writeup should follow the outline below.