# Pages Larry's CS151 Project 1

These are the tools we used.

Summary:

Our task for project 1 was to simplely become aquianted with the basics of computational thinking. In order to achomplish this, we first got aquianted with terminal and its basic functions (math and folder locating). Next we were introduced to Python through the importation of a "drawing" Turtle. By practicing giving demands, we are able to attain beginners skills and understanding how computers process commands.

1) Design a shape under the name "shapeA.py".

I decided to challenge my skills and draw a face, specifically a smilely face. At the the time I didn't know that there was a circle command already programed into Turtle, so I used "i for in range()" instead to create a repeating command, resulting in a curved path for the turtle. When one completes 360 degrees (number of times repeated multipled by the right() command must equal 360), a circle is created. I then adjusted the forward length with the "i for in range()" to make two smaller circles for eyes, all the way making sure to lift my "pen" and adjusting the turtles postion. Finally, for the mouth I made the line only complete a fraction of a complete circle. I did this by having the "i for in range()" number multipled by the "right()" number equal less than 360.

2) Design a second shape under the name "shapeB.py".

For my second shape I decided to have some fun with the "i for in range()" command. Already knowing that I can use this to create curved lines, I now wanted to change all the "right()" commands to "left()" without lifting the pen or adjusting the turtle. This resulted in an interesting image where the pen curves back and forth. I then had it meet it's starting point at the begining by repeating the commands. My last addition was the dot in the center, which is purely for complexity/visual appeal. It did take some time lining up the dot in the center of the curved cross design.

3) Within a seperate TextWrangler page, define shapeA and shapeB and have the program execute these definitions.

This was simple for I just overlaped the designs. I did however need to line them up which took simple additions of some turns and forwards to the end of the program.

4) Design a new shape, and make it possible to enable the caller to specify the size of the shape.

First, I decided to take it easy with the shape design on this one to get better focus on the use of inserting a "sideLength" option. The shape I created was a hexagon and I made three shapes. I was very interested in this newly learned ability and decided to pursue it further in an extentsion.

Extensions:

1) Write a function that will draw an N-gon. It should take in the distance of a side and the number of sides.
I completed this by using my knowledge of the "for i in range" command and the "sideLength" option. We already were taught through project instructions how to make a perticular shape with different sizes by entering in "sideLength" in the def(), however the hang up here is how to make the shape different based on another number. To do this one must use the following line of code: def nGon(side,sideLength). this gives us the possiblity of two variables. Entering this below the "for i in range(side)" command will make it repeat the number of sides you want. Also, the second trick in this extension was firguring out that the degrees the turtle must go to the right is 360/side. See the .py doc for more specific coding.

2) Build a hierarchy of functions.

I achomplished this by simplely taking the circle command (which i used to repleace clustered "for i in range()" commands), and made a multi-staged defintion program. I made it 3 levels deep and at the end I had it make the same massive design again, however turned 40 degrees, to create a flowering optical illusion. I messed with the color and background to add artistic effect.

What I Learned:

I learned how to use terminal, python, and Turtle fairly well. I also learned that I enjoy computer sciences.

Labels