Natalie's CS151 Project 9
Skip to end of metadata
Go to start of metadata

Title and Abstract: Project 9- Unique Trees and Shapes. The goal of this project was to continue making shape classes and to utilize inheritance. I started by making a tree class which is a child class of Shape. my tree class had parameter (shapes.Shape) and therefore inherited everything necessary from the Shape class.

The first task was to create a Tree class and draw three trees. I used systemH.txt, systemI.txt, and systemJ.txt for each of my three trees. Within the Tree class, I had to make some changes as to override things from the parent class Shape as a tree is a more complex shape than a square.

For the second task, I created classes for a couple more complex shapes, derived from the parent Shape class. In order to make each shape, I changed the angles and strings in each _init_ function. Below are my hexagon, pentagon, and rectangle shapes. I wrote code to make them appear more complex by making a for loop and adjusting the orientation for each loop.

For the third task, I made the outdoor scene of my apartment building in Chicago, IL. I live right next to Navy Pier, so I used the complex pentagon shape to make the ferris wheel structure. I did not have to import turtle, because I only needed by Shape and Tree classes which already had the turtle interpreter. This allowed me to write pretty simple code for a complex scene. I created the road and building using my rectangles shape, with varying scale and orientations. I used the lsystems for the trees and finally a triangle for the base of the ferris wheel.

For the fourth task, I created a mosaic. I first created code for a single tile. My tile is a filled in square, with a different color hexagon and triangle within it. I then wrote code with a nested for loop to create the mosaic. I made a rectangle mosaic 4x5 as per the task and utilized the height and width variables to evenly space out the tiles.

What I learned: I learned how inheritance works and how by using classes in my code, I can write significantly simpler code. I understood more so how inheritance works and got practice in utilizing it by making different shapes.

Collaborators: I worked in lab and received help from Emmett Burns on how to call classes from different files, and I worked with my tutor Andrew Turley. 

 

 

 

 

Labels