For this project, we made classes for the L system and the turtle interpreter files. A class is a collection of functions (or "methods", when inside a class) that takes information in, and in its "init" part, which is automatically invoked, runs the methods on it for some result. In this case, we passed in a text file to the L system class program, and it built new string that could then be passed into the turtle interpreter class to actually draw.

For task 1, we just added more elif statements to the turtle interpreter program's drawString function. In other words, we wanted the text in the text files to mean more, so if "g" was in one, the turtle would change its color to green without us having to manually ask it to in the main function we are using. The color of individual parts of the trees could be changed by placing the appropriate characters in the text file at the appropriate spots. The image below shows the result of following this method. As you can see, green, brown, red, and yellow are used independently of each other.


Task 2 was to assemble a scene composed of several trees with leaves and/or berries added. I used systems DL, GL, and FL to make six trees with leaves on them and scattered around them, in random spots.The text files had "L"s in them, which were where the leaves would go. To make the arrangement show the leaves, it was a simple matter of adding another elif statement to the turtle interpreter, which is shown below: 


If the text file contained an "L", the turtle would change to a dark green color, turn on the fill, and draw a circle with a scaled size. The image of the result is the one shown before.
Task 3 was to create two new (or modified versions of existing) L systems. I made one new L system and modified systemC for another. System C's original is on the right below, while my modification is on the left. 


For this task, we also had to make a program that would show each new L system with three different numbers of iterations. In my case, I chose 1,2, and 3 iterations. First, as usual, I had a list of filenames, a list of iterations, and lists of x coordinates and y coordinates. Each list had 6 items, and their order was in reverse from what needed to be called first (except the files), since the pop() method was being used to take items out of the lists. I looped over the files, and for each file, I read them into the l system to be transcribed for turtle reading, then called them to be read into the turtle interpreter and drawn. I also had if statements checking the index of the file in the file list, and deciding that certain indexes would get certain colors, like blue or green. To decided how many of each file would be drawn, I called the turtle drawString method to draw the L system N (adjustable variable) times. My image for this task is below:

I did extension 3, which was to make the terminal display text showing not what the turtle was reading, but what the file contained in the first place regarding a base and rule(s). I first made a method in the L system, which would call a string to be created and slowly fill it with the necessary information. It would get the base of the text, which was already defined, and would skip a line, and would join all the rules with lines between after. The first index of rule, 0, would contain the thing to be changed, so I chose that, then an arrow, then the rest of the rule to print. It would also return the string at the end. The code is shown below. In the main function for the L system test, the terminal would print the information.


Next, I added a process to the turtle interpreter class, which would, as it drew the L system itself, also draw the text at specified coordinates using the turtle.write() function. I needed the filename to be passed in to the information so it would read, so I gave the turtle interpreter an optional filename argument. In the main function for growth and such programs, this would be passed in if the text would need to be displayed. The code and image are below:


In this project, I learned a lot about how information is passed into classes and where to retrieve it from. I also learned how L systems work and how they interact with the turtle interpreter, since I had to modify/make my own. 
Worked with: Prof. Taylor, Prof. Maxwell