Ibrahim Riaz Project Number 3
This project was more about organization that creativity for me as I lack an artistic sense. For me this project was more about encapsulating a set of functions within one another and scaling them thereby utilizing loops with different parameters and conditionals to help us construct basic shapes, aggregate shapes and complex shapes which eventually ended up making a scene within a scene within a scene within a scene.
For task 1, I improved my block function to create a conditional statement whereby, the parameter entered by user was true then the block would be filled. This was achieved through
if fill == True: and relied on the boolean value being entered by the user. I did however also add a default value which is true. Once I improved the block function, I took a bunch of functions and improved them to include the fill parameter. As an additional effort, I added both pen color and fill color as parameters for my shapes. Lastly I created aggregate shapes like the star tree and door using block, circle, star, etc
These tasks were labelled in the project report as tasks 1- 3.
For task 1, I had to make an image with multiple copies of my scene. Having imported a set of basic shapes and improved some of them to use the fill function, I started to create shapes and objects out of shapes to create a scene that could be moved anywhere and drawn at different sizes while maintaining image integrity.
As shown below, I created a starter which isn't that visible on the wiki but was pretty cool as it can be seen through the door and scalable.
For task 3, I had to incorporate the initial image above into another scene that was parameterized. For this, I thought adding extra images in my scenes as I went about creating the encapsulation effect would help me get points so I added a truck to the mix and then scaled that to create a further scene.
For my fourth task, I had to create a second scene incorporating the first. For this, I thought it would be fun to try scaling this picture to see how complex and deep my scales would work. I ended up with the image below which essentially laid the basis for my extensions. For this I created a poster for trucks and although my art wasn't as good, my code worked perfectly. Moreover, the best part was that my pensive increased thereby giving more definition to my trucks as the got scaled down
For my final task I created this scene that essentially drew on the previous scene and created a TV show remodel of one of my favorite childhood shows the Little Red Engine. As I remembered the engines, steam pip, I gave the image some C02 emissions.
For my last task, I added variation by using the sys.argv (command line argument to control the background color).
Below is the impact of entering python3 p3.py Red in terminal.
This extension was essentially creating more scenes using an original scene, I stopped because the details were getting smudgy although the placement and scaling were perfect.
Complex conditionals using controlled randomization/Also used range in conjunction with conditionals to create more controlled impact.
For my clouds, I used circles. In order to create the appearance of clouds in later pictures, I needed a degree of randomness. Therefore I programmed the x and y coordinates to have statistical probabilities determining whether they we up or down, backwards of forwards. I used the same idea with my trees to create the impression of a natural forest. This created scattered patterns which I liked.
One possible output.
Another possible output.
The downward motion of things is supposed to create a feeling of worry, mayhem and chaos which I thought was a feature in many of the paintings under the surrealism ambit.
- What is a command-line argument, and why are they useful?
Command Line Arguments are parameters entered by the user in terminal before execution. They eliminate the need to change code every time you want to change parameters. They're also cool to understand as a concept.
- What does an if-statement do?
An if statement provides a conditional barrier or rather pathway. It only performs an action if the given condition is true, else it may lead to a different alternative.
- What is the difference between = and == in Python?
= is used to assign. == is used to compare values. == is more common for us when using bool comparisons.
- Within a function, how would you control the number of times a for loop executes using a function parameter? Give an example.
for I in range(numofsims):
Print("I love Cs")
This loop essentially takes my parameter numb sims to decide how many times it will repeat the command to print an I love Cs statement. In this case the parameter input 5 means that it prints the statement 5 times.]
5. Which artwork(s)/artist(s) did you choose as inspiration? Why?
My inspiration was stack overflow because I don't have a strong background in art. I went through the list of artworks in the shortlist but I didn't find them interesting.
My biggest takeaway was the importance of writing neat code and the importance of understanding loops and conditionals. Often I would misuse parameters or enter more or less than required. I tried to make everything changeable but I realized that some components in my paintings had to be hardcoded and that was an important lesson.
Another lesson was learning outside of class. I spent a significant amount trying and failing at making ovals and text and randomizing stuff but I think in the end, I learnt more from my errors an ddebugging than from the script given to us. I honestly enjoyed this project despite pulling an all nighter. Oh and having neat code is very very very important.
A list of people you worked with, including TAs and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.
A list of any resources that you used. This includes textbooks, lecture notes, python documentation, library documentation or forums. If you used a specific website, please link to it.
Put the label cs151s20project# on your wiki page.