$studentName Project $projectNumber
The project consists of a shape library and various functions parametrized and colored that could be replicated at different sizes around the page. In addition, they made use of the random package and loop functions in order to replicate curves and numerous objects within a set parameter. The work was inspired by a landscape of Giovanni Caravaggio, and followed a heavy desert theme that persisted throughout most of the project. In addition, the project briefly makes use of if-statements.
I began by creating a folder titled "CS151", and a series of folders within for the next few projects, and used terminal to change into it.
Using my vast coding skills, I made a chartreuse rectangle, which was the best rectangle that there ever did was. I used a loop function to cut down on 4 lines of code, and a fill function to either fill the shape described by the turtle or to not.
The shapes I added were both a cloud and a series of circles, though only the cloud makes use of the loop function in order to make semi-circles without overlapping lines. Additionally, I imported the random package in order to achieve random placement in the number of shapes drawn, as well as the placement of said shapes. Though the problem requested the use of the fill function, I did not include it, not for want of time, but because I believe the usage of this parameter to be redundant, and I'd rather simply use a color parameter without any aid from a redundant function that requires my permission to do what I'm coding it to do in the first place. While I acknowledge the usefulness of the if/then statements, I do not see their use in these shapes, and therefore did not see it fit to include them in the rest of the shapes.
The aggregate shapes I designed were both a tree and a sun in the sky. I could never figure out how to stop the excluded spaces from the fill function without composing the whole thing from a series of separate triangles, though this way it looks somewhat like a jewel, and I appreciate that very much. I believe that the way to fix it might be to separate the two shapes out as different functions, though together they make for an interesting aggregate shape.
I made a scene using the tree and sun functions, adding in a red landscape to make it seem more like a drought-riddled or desert area. The trees are randomly generated along the left-hand side, and there is a red base for the sake of posterity.
I began by inserting a size parameter into most of the lines of code, in the adjustments made to x and y, into the distance moved, and into the goto functions. Everywhere. This allowed for me to set up the scene into separate modular spaces and position it wherever.
I figured that no dead forest would be complete without some brown leaves, so I added a few in a random formation following each of the trees in the scene and a few of the clouds from earlier, generated randomly along a set x.
I figured that if all I had to do was maybe change a few colors around, that I could switch up the leaves and the sun to make it a lil funky.
I felt bad after making so many dismal landscapes that I made a summery one with greens and healthy bark. Hopefully, we'll see a spring like this in the near future.
- What is a command-line argument, and why are they useful?
A command-line argument is a parameter you can access from outside the function, possibly from another file or function that changes the interior structure of the function.
- What does an if-statement do?
An if-statement allows you to essentially switch off parts of your function when certain conditions are met, or vice-versa.
- What is the difference between = and == in Python?
The difference is that = gives a value to something, and == compares and links the two things.
- Within a function, how would you control the number of times a for loop executes using a function parameter? Give an example.
You can define the function with a placeholder in the range parentheses of the loop, and replace it with a real number when you call back to the function.
- Which artwork(s)/artist(s) did you choose as inspiration? Why?
I was inspired by Giovanni Caravaggio, and his work "Surrealist landscape with a human skull and lizard," and was drawn to the barren desert theme. I liked the idea of using just the trunk and branches of a tree.
I learned how to adequately use the random package, and while I faced a few problems involving parametrizing the functions, I worked it out in the end. Additionally, while I learned about the uses of if statements, I found them annoying and overrated for usage in such a simple drawing.
Hannah Wolfe, Bruce Maxwell