CS Lab 2 Writeup
Skip to end of metadata
Go to start of metadata

Rebecca Levenson

Lab 2 Writeup

The task was to first create a program that would call definition of different shapes, such as a block or a house, from a different file. Then, with these called definitions, the new program would create an outdoor scene.

My solutions to these tasks were these. I created definitions in the file shapes.py that created a block, a bunch of blocks, a triangle, a hexagon, a rudimentary house, and a representative of a palm tree. Then, in the program main.py, I used these definitions to create an outdoor scene. The first scene was not really a scene as much as it was an outdoor object. I drew a flower with the shapes I had created in the shapes.py program.

Scene 2 was a more normal outdoor scene with houses and palm trees. A special thing I did in the program for the palm tree to make it more usable was when I was creating my palm tree representation, I was able to create a uniformity in the way it got represented by using goto( x+10, y ) instead of having it go to a specific point. This allowed for the ability for the program to adapt to given instructions reliably.

The extension I undertook was allowing the outdoor scene to be created at random. I did this by calling for random.random for each of the values needed to create the objects in the scene.

I learned that you don't have to define everything in the same program that you use it in. You can call for definitions that you've already written in different files.

Labels