# Pages CS 151 Computational Thinking Fall 2012 Kyle McGadney Project 2

The goal of this project was to further our skills with basic functions such as defining functions turtle and to introduce new skills and tools such as the import function, random function, and for loop function.

Our task this week was to create two different desert scenes. For my two scenes, I decided to create a day desert scene and a night desert scene. I created two shape functions. A cactus and a rock. The rock function was built from a hexagon with triangles inside, while the cactus was built from multiple blocks. I utilized the color function in turtle to color the rocks different shades grey and the cactus green.

For the day scene, I wanted to mimic an open desert with a few scattered cacti and rocks. I set the canvas background to a light yellow color to mimic the desert floor and created a blue sky. Then I utilized the random function and had 15 rocks and 5 cacti placed randomly around the landscape. I added a hexagon on the blue background colored yellow like a sun.

For the night scene, I used the same program but changed the colors of the background to darker shades in order to mimic a night landscape. I also changed the color of the sun to mimic that of a moon and included a function that would randomly place stars in the sky.

For my extension, I wanted to create a colorful creature, but I also wanted to have python randomly pick the colors of the creature. In order to do this, I had to utilize lists. With the help of Professor Layton, I was successfully able to incorporate lists into my program. I used the lists to have the “scales” of my snake (made entirely of hexagons) multicolored. I also used lists when making the rocks in desert1() and desert2()

During this project, I learned how to create for loops, more ways of controlling turtle, how to use the random function to diversify my program,  and how to utilize lists. A special thanks to professor Layton for not only teaching me how to use lists but for also helping me with scaling errors that I had.

Labels