Pages CS 151 Computational Thinking Fall 2012 Assignment 3

You are viewing an old version of this page. View the current version.

Version 1

For this assignment, we were asked to use our codes and depictions from last week to make another scene, and to use the range function, so that we can control how big our images are, and so that we can place them multiple places on the screen, in different locations, and with different sizing.

My scenes last week were of a row of houses, and of fish. For the lab this week, I worked on programming my house code so that they were all dependent on the same scale, allowing me to change the sizing of the whole row at once.

def rowofhouses(x,y,scale):
turtle.color (.408,.30,.91)
shapes2.house(x-150,y, scale)
turtle.color (.71,0,.450)
shapes2.house(x-100,y,scale)
turtle.color (.91,.41,.60)
shapes2.house(x-50,y,scale)
turtle.color (.341,.80,.21)
shapes2.house(x,y,scale)

I made the houses all the same size, and then played around with scaling and distance between one another, in order to complete task1.

rowofhouses(3,50,5)
rowofhouses(-40,-200,25)
rowofhouses(250,320,10)

I then shrunk them, so that they would fit into my "indoor scene" of a fishbowl.

def house(x0,y0,scale):
base(x0,y0,2*scale,4*scale)
roof(x0,y0+4*scale, 2*scale)

I decided to turn my houses into homes for my fish, and combined my two scenes from last week into one, and drew a circular fishbowl around them, and added a table for the bowl to lie upon. I played around with a lot of different ideas, but found that a fishbowl incorperated my ideas the best for task2. Drawing a circle proved difficult, but I finally figured out how to draw it, and then decided to add color. It took a lot of testing and failing, when the turtle would trace a line of blue across my page, and I couldn't figure out why turtle.seth(0) wouldn't work. I finally figured out I needed to use the turtle.up() command, to not reset the turtle, but instead simply lift it off the page.

I decided not to make my images into pictures or window scenes, simply because I thought it would be cooler to combine them into one scene together, and the fishbowl seemed to work perfectly.

I learned quite a lot in this lab, such as how to control whether the shapes are filled or merely outlined with color, how to have shapes correspond to parameters, which I think is really useful and cool. I also learned how to scale objects, and how to call things in different order, so that certain object will appear to be behind other ones. I realized with this lab how much you can do with computers, and how much more fun it is to write codes to draw pictures, rather than using paint or some other program. I look forward to learning more, and to continue becoming more comfortable with programing and computer science as a whole.

Labels
• No labels