Ibrahim Riaz CS151 Project 4
Skip to end of metadata
Go to start of metadata

Ibrahim Riaz.  Project 4


This project was one that introduced us to another field of artwork, Realism and leveraging the tools of lists and graphicsPlus we were asked to replicate an advanced version of what we had been accomplishing in the previous project. We were to create a surrealist scene using efficient code, reuse shapes that were complex in nature but could also be made at different sizes and locations per will.


Task 1:

My first task was essentially just creating a scene in paper. This scene for me was a simple realistic landscape that was essentially, a river with a clocktower in front of a forest with the nice skies in the background and a boat to make things fun.

Task 2

The second task was the hard part. I had to create everything I just came up with. This was hard as coding objects on canvas is much harder than on paper. Everything was about scales, knowing how big your window is and making sure your numbers didn't exceed the canvas space. For the second task, we had to come up with three complex shapes or objects. We had to demonstrate them in different positions and sizes. For me these were a tree, which later became a forest, a ship and a clocktower.


It is important to mention that I can draw these functions using hardcoded numbers or I can use one value and use loops to increment x, y and scale which is what I did because it demonstrates my control over my program.

Task 3

This was the hardest part, I had to create a scene which was complex and cool. For this, I created my scene which was simple and inspired by a painting I saw online.

I use a command line argument to determine the background but I will elaborate more on my command line argument under extensions as it was modified to create a much much much cooler scene.

Extensions Were Mostly Incorporated in Main Base Project.

Extension 1:

Using probability, randomization in complex for loops to create a much nicer forest to give me project a more natural look.

By using loops, I was able to recall my list multiple times to create the following. I was also able to adjust the height and placement of trees making it appear more realistic as I didn't like the very basic straight line in which trees were present.


As you can see my first extension makes this look so much cooler and natural.

Extension 2+3

Skies the limit

For my second extension, I wanted to make my sky look much uniform and realistic and also sorta create two different modes, one for night and one for morning. For that I created a list of colors which we were not taught and then I call those colors in small rectangles and uniform increments using loops to create a unified sky just like I create a unified sea which darkens with depth to make my project more realistic.

User have the ability to manipulate the command line argument with 3 options, if they enter 1 digit, they get morning, with 2 they get night sky and with 3 they get a night sky with stars. As you can see the command line argument gets reimagined if you create multiple lists and options



Night Sky without Stars



Night Sky with Stars

Extension 4 

For my fourth extension, I add two more shapes one of which is a complex polygon the stars and the other is a rocket. I don't just stop there. I then proceed to add animation to my project by making my ships sail, my rocket take off and my stars move in order to signify time and try out functions we haven't really learnt yet.


See how the stars move, upon execution the ships and rockets also move.


The ships nearly left the scene.


Prepare for take off.


  1. What is your understanding of what an object is (e.g. a gr.Rectangle, gr.Point, or gr.Circle)?
    An object is a set of functions that takes in variables in the form of coordinates or radii.
  2. If the variable box holds a gr.Rectangle object, how do you set its fill color?
  3. What parameters does object.draw(...) take? Why would a computer need that parameter?
    it takes the parameter win or your window to understand and create its object on the canvas you have designated.
    1. Which artwork/artist did you choose as inspiration? Why?
      Railroad Sunset because I really like the sky.


This project was definitely a challenge for me especially as it took time to figure out how to build complex shapes using rectangles and circles and then scaling them multiple time within and outside of functions for various purposes. I think the most important lesson was the importance of understanding how you start with a foundation and build upon it to construct complexity using simple tools. This project honestly made me think a lot in a different structure than I am accustomed to in a nice comp sci logical way.


Bruce Maxwell

  • No labels