Ibrahim Riaz Project 9
Skip to end of metadata
Go to start of metadata

$Ibrahim Riaz / Project 9


In this project, we take our understanding of data access further. We write more efficient code by using class inheritance and in the process upgrade our turtle interpreter and system files. We also create a bunch of new files such as tree, shapes, mosaic and scene which we will elaborate on later. This project is similar to project 8 except it relies on dictionaries as opposed to strings and lists. In the end we created a scene, a mosaic and a bunch of different shapes using only class methods.

Task 1:

Make a Tree class

For task 1, I created a tree class that inherits from the shape class to first construct a string and then draw it. Using this, I create SystemJ.txt in multiple locations throughout the screen.

My Tree overwrites the parameters of the shape class to draw the trees and allow greater control over the imaging.

Task 2:

For my second task, I created three more shapes in the shape class. I create a diamond, a hexagon and a cube. For each class, I gave the init function parameters: self, distance, and color (with defaults), and called the Shape class's init function, changing the specific angle and string for each shape.. I used '{' and '}' to fill my rectangle, hexagons, cubes and diamonds. For my second task, i got creative and created a math equation of sorts.


Task 3:


For my next scene, I had to create a scene of the outdoor. Here I employed some extensions that I will elaborate on later. I call a bunch of different trees, with hexagons filled with brown to create the soil and flowers(triangles) of different colors. My scene titled "My field" depicts the traditional woodland scenery.

Task 4:


For my last task, I had to create a grid of tiles inspired by Islamic tradition and Escher Mosaics. I use double loops with trees, hexagons and square to create a 5 x 5 grid.


Extension 1:

Additional Tile Grid with more detail.

Extension 2:

My second extension is incorporated in different parts of my project. From the get go, I use large amounts of randomization for variety, Firstly, I create a list of different filesystems, CL, GLEDIT etc in my tree.py file. I then proceed to call trees randomly throughout my outdoor scene for greater variety. Secondly I use randomization of these trees in tiles and also fill my shapes like flowers and hexagon linkers with random colors using additional instructions for turtle interpreter by using "i" in the lsystem strings.


  1. What is inheritance?
    Inheritance is a property of classes that allows one class to take or "inherit" all of the data from another class.
  2. What does it mean for a child class to override a method?
    A child class can overwrite a method by reassigning different values to existing parameters with the same name. This way, when a method is called, the data funneled through the child class takes precedence over any pre-existing information.
  3. What is a class variable or class global variable?
    It is a variable that exists outside the init function accessible to all objects and methods in said class.
  4. What is a field of an object?
    The field of an object is the data and information it holds stored in the object's init function.
  5. Which image or artwork did you choose as inspiration? Why?
    I found my inspiration in a bunch of different pieces from Islamic mosaics and Study of tile designs from Ravello. As a muslim, i think i was biased to choose these pieces somehow.


This project taught me how to work with dictionaries and pass data through inheritance as well as familiarity with over riding pre-existing variables. I also learn to work with l-systems more so than before and was able to see the usefulness of classes. I found that the tasks helped me practice linking different pieces of code and remembering the recent weeks techniques better than usual.


A list of people you worked with, including TAs and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.

A list of any resources that you used.  This includes textbooks, lecture notes, python documentation, library documentation or forums.  If you used a specific website, please link to it.

Put the label cs151s20project# on your wiki page.

  • No labels