cs151s20project2
Skip to end of metadata
Go to start of metadata

Karl Hick Project 2

Abstract:

Using the lab functions we defined in a file under the name of shapeLib.py, I created several scenes in another file, with the first consisting of simple shapes, and the second made up of several more shapes that loosely resembled a rocket.  In my third scene, the work based on Sol Lewitt was based on his wall drawing 792 and was composed of irregular blocks in vertical columns.  After adding more and more shapes as time went on, I compiled the shapes in order to form my extension, a wizard.  Through much trial and error, I managed to get the code to work after running into many problems regarding the presence of top-level codes that essentially trapped my turtle on the first file.

Task 1:

Task 1 consisted of setting up my code library as a file so I could call back to it from later files.  This is where I ran into the majority of my problems, as I delayed for a period of time by leftover top-level code in this file.

Task 2:

For step 2 I needed to add more shapes to my shape library, so I made the addition of a circle and an nth sided shape.  Using "for" loops (and the turtle circle function), I created defined these shapes using the goto function in order to allow for easy placement alongside a size parameter that allowed for me to control their size.

Task 3:

For step 3 I needed to add more shapes to my shape library, so I chose the humble trapezoid, which took a good while to construct properly, and no small amount of outside math.  I planned on building a house but later decided on a rocket after switching the rectangle and the 'roof' by accident.  I found it to be easy to control the size, though the trapezoid presented a fair amount of difficulty concerning the size of the bottom and sides while scaled.

Task 4:

I found "Wall Drawing 792" to be interesting as it played with regular distances between shapes, but chose irregular lengths and widths for the shapes themselves.  This required extensive use of the block function from the shape library.

Task 5:

I had a horrible time with this one, since the text editor I was using decided that I couldn't use tab to set my code over, and it saw a problem with every line.  I got my idea for this problem from the idea of combining shapes, so I decided to combine my triangle and my nth sided shape to form an nth sided star since I was having many difficulties in getting a formula for such a thing up in the first place.  This essentially is a loop that describes a pattern that goes forward only to loop backwards on itself in a triangular fashion, then continue forward to complete the shape.

Extensions:

Extension 1:

Wizard at work


I wanted to make something fun for my extension, so I chose a wizard after accidentally setting my human just a little too high above the ground.  I spent quite a while trying to orient his various limbs and body parts, as well as his happy lil wizard hat.  I used the simple shapes defined within the shape library to construct my person.

Questions:

  1. Does breaking a scene into pieces make it easier to create?
    Sometimes!  For my nth sided star, no, but for most things, assuming that I didn't have to orient them too much, yes!
  2. What is a for loop and why are they useful?
    They are useful for repeating instructions so as to avoid mistakes, or to loop for a varied number of iterations.
  3. What is the difference between using "from turtle import *" and "import turtle"? Explain from both a practical use point of view and how they differentially affect the global symbol table.
    Import turtle simply imports the turtle package, whereas from turtle import * imports all the files from within turtle, allowing you to call each one up and use it within the program, instead of simply coding in turtle.  This allows for you to use multiple languages/packages without overlap.
  4. Which Sol Lewitt work did you choose as inspiration? Why?
    I chose the "Wall Drawing 792" as I found it to be interesting as it played with regular distances between shapes, but chose irregular lengths and widths for the shapes themselves.

Conclusion:

I learned how to import commands and defined functions from other files, and how to better use parameters and spacing.  I found this project to be stimulating in the way that it forced me to use simple shapes to complete (semi) complex structures.

Acknowledgements:

Bruce Maxwell, Bruce Maxwell, Bruce Maxwell

https://docs.python.org/3.3/library/turtle.html#turtle.forward 

https://en.wikipedia.org/wiki/Star_polygon 

https://massmoca.org/event/walldrawing792/

Labels
  • No labels