In this project we continued to learn about and design L-systems. We started by adding new symbols to our turtle interpreter, so we could building more fun and intricate models. Then I created a scene layout to display 2 types of L-systems. Finally, I created two of my own L-systems and displayed with 3, 4 and 5 intervals.
I started by adding new symbols to the turtle_interpreter.py file. This was fairly straight forward as i already had the Drawstring function in place. The first two symbols i added we for saving color data, so i could change the color of individual parts of the system, like leafs, then reset the color. The < symbols added the current color of the turtle to a new list I created, colorstack. Then > would change the color back to the original by calling the list with .pop() function. The code below shows how the color is added and taken off the list.
After I created symbols for color. These elif statements were straight forward as they checked for a symbol x, and if x, the color is simply changed with the pencolor(0.15, 0.5, 0.2) function.
Next I created the arrangement.py file. This program starts by reading in l-system files. It references the Lsystem function in the lsystem file to split the words and store the values in a variable tree. Next I created variables to store x and y values of the display window and a value to determine the amount of iterations of the coming for loop. This for loop picks random locations within the window to place the l-systems, and randomly picks the amount of iterations on the domain [3,5]. Within this loop the trees are created and placed on the screen with given base colors at the random location within your given screen.
This is the display of the two L-systems in the given window.
For part three of the project I created two of my own l-systems in the Growth.py file. This Scene is called The Fern Meadow.
For The Growth.py file, I used the same basic structure of the for loop. For my two L-systems, I followed the basic guide line for the tree L-system. The rules added height, branches, color and leafs to the l-system. The first L-system file creates a tall narrow tree. This system used a basic layout with only two rules, one for basic structure and leaves, and one rule of extra height and width. The second l-system i created was more complex. It contained three rules to create structure, height and leaves, then more complex pollen like extensions.
Extensions: I added new colors to my turtle_interpreter file, and the second L-system i created has two types of 'leaves' coming off it.
In the project i became much better at reading and interpreting l-systems on my own. While creating my own systems, I had to visualize the outcomes of my symbol sequences I created. I also became more familiar with using the random package, and am now more aware of its power. This project was also helpful in gaining more familiarity with reading files.
I worked with TA Will and Tori.