The purpose of this lab was to continue our work with drawing l-systems from last week, but this time using objective programming. Objects allow us make more complex scenes with l-systems we can now make manipulations to each tree after it is drawn. It would be possible to make each tree its own object and then continue changing it long after it is drawn. My classes in this project were the turtle interpreter and the l-system. I would make an instance of l-system to read an l-system file and to create an l-string, and then a instance of turtle interpreter to draw out the l-string. The code of these two classes was much the same as my code from last week, only restructured into classes with methods instead of files with functions.
I also used more complex l systems than last time, and also introduced more commands into my interpreter to draw leaves and different colors. I made this scene using a for loop and some randomization in the number of iterations:
Next I drew some different l systems I found in the algorithmic botany book, which I modified to change colors and they drew. I programmed them to draw in a random chain where each square is accent to either the bottom or the right edge of the last.
In this project I learned how to use objects in python. I also learned more on how to use randomization to model the natural world.
Andrew Fletcher helped me find a bug that was preventing my l-system class from reading multiple replacement rules. In my code for make_image2.py I used some code from lab8Test1.py, namely the randomization to space out the trees nicely .