Kevin Bennett

The after all of the changes that we made in lab, the only thing left to do before beginning the tasks was to write the _str_ method in the Lsystem class. To do this, I started by assigning to the variable "string", self.base + '\n'. I then looped through the rules in self.rules, and for each, added the original character, an arrow, then the replacement character (with a '\n' at the end) to "string". Outside of the loop, I called for the method to return "string".

After seeing what I would have to do but before starting to work on the tasks, I added color, penwidth, and text parameters to the drawString method in the Interpreter class, with initial values of 'black', 1, and an empty string respectively.

The first task was to create a simple scene with at least two multi-rule l-systems and include the text created by the _str_ method below each. I used the given systemC, one of the trees from the ABoP (which I called systemF), and Koch snowflakes to add some extra element to the scene. I added the symbol "L" to drawString that draws a semicircle of a random color of green for a leaf (different than my project 7 "leaves"). I then added an "L" at the end of each of the branches of systems C and F. I also added a "T" in the drawString loop that writes text using the turtle.write function. I placed the two trees next to each other using my newly defined place method, created snowflakes in a "for" loop, and positioned the text with the new goto method. Here is the picture from the first task:

The second task was to create a forest. I used the systemC code and the systemD code (which I rewrote as another ABoP tree l-system) for the majority of the trees, adding leaves to both and apples to the systemD trees by adding a "B" symbol to drawString that creates a circle of a random shade of red. I created 9 of each in a for loop and situated them in a gaussian distribution using random.gauss, centered around a mother tree (standard deviation-150), which used the systemE code. To get that right, I had to add an "f" symbol to drawString that moves the turtle forward 1.7 times the normal distance and a "!" symbol which reduces the pen width by 1. I also had to add an append and pop line to "[" and "]", saving and restoring, respectively, the turtle's pen width when the heading and position are saved and restored. Here is the picture for task 2:

The final task was to make a new l-system and draw it with 2, 3, and 4 iterations. I created a simple one: Jack's beanstalk. Here it is:

It almost has a Super Mario feel to it.

From this assignment, I just generally grew more comfortable with the drawString method. I feel like I could do more complicated things with it if necessary, which I'm not sure I felt after the last assignment.