This was a lab introducing us to the uses of Classes, while improving our comfort levels with L-Systems.
We had two tasks this week. The first was to create a file and write a function that makes a forest or garden of flowers that includes at least two different multi-rule L-systems with leaves or other ornaments that make use of the color store/restore functionality. We were given specific L-systems for specific tree designs. Here is my required image 1. I was trying to create an effect of peaking through a bush to a distant group of trees.
Our second task was to make two new L-systems. I decided to create two based on ones in the ABOP book. We then had to create an abstract scene using those two L-systems with 2, 3, and 4 iterations. Here is my required image 2.
Before starting my extensions, I was looking back at some Christmas photos. Thus, I made the theme for my extensions with some holiday cheer. I completed the following extensions:
1) Have each tree exhibit some variation by modifying aspects of how it is drawn.
I did this by creating a new type of tree (it is based on a tree from the ABOP book, but altered to make it thicker and more Christmas tree like) and my bushes are different thickness and added color changes. Also I did this extension unintentionally when doing the task for required image one; to create the "peaking through a bush" visual effect I had to rotate the tree in certain positions. Each side of the picture requires a different "for" command.
2)Add leaves, berries, or color to your trees by adding symbols to the rules and cases to your turtle interpreter. For each new symbol, you will need another elif case in your drawString function.
I did this twice. First I added small (I know hard to see sometimes) ornaments on the distant trees. Note that the ornaments have a color that is 100% random. Second, I added berries to the bushes (I guess that is Christmasy). For both of these additions I added a new elif case (one for each because of size and color differences).
3)Get fancy with required images 1 or 2. Note that fancy means using programming structures (functions, loops, conditionals, lists, or math) to make a more interesting scene.
As you can see I did make my required image 1 more "fancy". I added functions for the house and setting. Was trying to add some very complex things, however I failed miserably, see "What I Learned" section.
What I Learned:
I learned that L-systems are a very powerful tool, and when combined with the use of our new skill of Classes (another powerful tool), the possible products are increased exponentially. Furthermore, I learned that that the worst type of problems with programing is when you do not get an error message, instead only getting a disaster product (ask Kyle for details; I emailed him about it). This was a major hurdle and took up a lot of manpower. Also, being overly ambitious I tried two different types of extensions, eventually dumping them: First trying to use a "getMouse()" call to try and have the user "plant" trees, however I have discovered that there are many different places python can put images (windows, screens, shapes themselves) and along with that many other problems. Second, I tried to animate my house to have smoke coming out of it, however I soon ran into a very similar problem (our animation from projection 5 was done in a window, this project is not in a window apparently). While I did spend alot of time and have no image to show for the work I put in, I learned a lot (hopefully I can use that in the next project). I worked with Mike and Toni only during the pre-extension part of the project on small details.