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


The purpose of this project was to get us acquainted with using more complicated L-systems, and enabling more complicated codes that allows us to draw these L-systems. In the past, we have used L-systems to strictly draw tree like objects and complicated patterns. Now, we are starting to use L-systems to draw basic shapes, such as squares, rectangles and triangles. First, we started off in lab by adjusting our drawString method. Below is the key change that we made:

Here what we did was add an important character to turtle interpreter. This character allows the turtle to read in L-systems that have this bracket, and start and stop filling the object when told. You will see that this shows up a lot in this project. 
Task 1: 
Our first task was to create a tree class that reads in L-systems from texts files, and draws them using python and the turtle. These L-systems that we are now using have certain spaces within the characters. This leads to the interpreter randomly choosing which line to use. This leads to us creating a different tree every time, with the same exact L-system. Below are the first three trees that I made:

These three trees all used the same L-system. I even called these three trees the exact same way, just changing their position. Because of the new L-systems we are using, the branching on each one of them is different.
Task 2:
Our second task was to create shapes using our shape class. These shapes used simple L-systems. This is the first time that we will see the new character, the curly brackets, being used. For this task, I create shapes such as squares, rectangles, triangles, octagons and crosses. I did create three new shapes outside of the square and triangle, however I still decided to call these shapes in task 2. Below is my output for the second task:

The top shapes are not filled. Those L-systems do not have the curly brackets. However the bottom shapes are filled, and I used the curly brackets to correctly fill these shapes. I set the base distance for the forward portions of these shapes as 50, but can easily change that when I call each shape. 
Task 3:

The third task asked us to create an indoor scene using our shapes that we created in our shapes file. This indoor scene needed to include indoor features, such as couches and tables, and include a painting or window that displayed our L-system trees. I decided to create a modern indoor house that has modern furniture, including couches and tables. The main piece in this scene is the painting of two trees. Below is my indoor scene:

As you can see, I called the same exact tree twice, however they showed up looking different. This is again because of the new L-systems that allow every one of our trees to be different.
Task 4:

Our last task required us to make a mosaic art piece looking like tiling. My tile is made out of shapes from my shape library. I used four squares, two different colors, and a cross to make my tile. I called this a bunch of times to make it bigger. Below is my mosaic art piece:


1.) For my first extension, I made a mosaic tile piece that does not involve squares. For this extension, I made tiling out of 4 crosses. It looks very cool. I coded it so that unlike my task four, every single one of the crosses is a different color. Below is my first extension:

2.) For my second extension, I created another mosaic tile piece. This time, instead of squares or crosses, I created the bulk of the tiling to be triangles. The four main triangles are four different shades of green, and the octagon, that adds another layer to this piece, is steel blue. Below is my second extension:

3.) For my last extension I again created another mosaic tile piece. I was really enjoying seeing what types of different mosaic pieces I could come up with. This last one is made up of strictly octagons. Below is my final mosaic piece:

What I learned:
During this project I learned how to use L-systems with spaces and random branching. We also learned how to use L-systems to draw others things outside of trees and patterns. With this new knowledge, I am able to make any shape I want with L-systems. I am also able to color them in.
Acknowledgments: Prof. Taylor, Prof. Li, Riley Janeway, Holli Olsen