Preston Decker's 11th CS151 Homework Preston Decker's 11th CS151 Homework

Explanations

  • 1.Our task was to create a Crayon class that would allow us to draw our stochastic L systems using a crayon-like outline..

    2.If we were to create an additional paintbrush class, we would first need obviously to write up the class just like we did with crayon. After that, we would want to add an additional field called ipaintrush into the z turtle class and set its starting value to None. We would then add an else statement, after the icrayon if statement,in the forward method in the zturtle class that would set ipaintbrush to true, just like we did with icrayon. We could simply copy and paste the code for drawing the line that we used after setting icrayon to true. Finally, we would want to create a method called paintbrush, just like we did with crayon, give it a parameter, and set the ipaintbrush field to this parameter's value. The last step would be to call this within the finalpic.py file just like we did with the Crayon class.

    3.Inheriting the values of the AggregateBase class allows for quicker writing of our code, and also would allow for us to create additional code and classes other than crayon, such as a possible paintbrush field, without wasting time writing up new base classes that allow this to work.

    4.We want to overrule setWidth because the Zturtle setWidth gives us a definite value, whereas in Crayon we are looking for a randomly generated value.

    5.The final scene was pretty easy to create and just involved making a call to crayon within the l system for loop in the finalpic file. I used the same lsystems as last week. As before the other building in the picture is Robin's, I began using this last week as we could not find a building function of mine that would work without modification with the code that had been created. Finally, I don't think it counts as an extension, but the TA recommended that multiplying random by a number would increase the uniqueness of renditions, and I did so.

    6.Thanks to Robin for the building from last week and the help he gave me with the week 10 hw, as well as the TA Bryce for the majority of help with this week's project.