Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Your name: Rachel Kisken and Drew Chasse
- # Your username: rkisken and dchasse
- # ps03quilt.py
- # Submission date: 25 September 2017
- from picture import *
- # PART ONE: DEFINING HELPER FUNCTIONS
- def patch2x2 (c) :
- '''creates a patch of all the same color split in four sections'''
- return fourPics(patch (c), patch (c),
- patch (c), patch (c))
- def triangles2x2 (c1, c2):
- '''creates a patch of two tone triangles'''
- return fourPics(triangles (c2,c1),patch(c1),
- patch(c2),triangles (c2,c1))
- def bandana (c1,c2) :
- '''returns a patch of fourPics with two triangles, two patches'''
- return fourPics(triangles (c1,c2), patch(c1),
- patch(c1), triangles(c1,c2))
- def corner (p1, p2) :
- '''returns a patch where p1 is in the lower left and all same pic around it'''
- return fourPics(p2, p2,
- p1, p2)
- def stripe(p1, p2, p3) :
- '''creates a patch where p2 is diagnol p1 in lower left and p3 in upper right'''
- return fourPics (p2, p3,
- p1, p2)
- def lowerLeft(p) :
- '''creates a pic where only image is in lower left'''
- return fourPics(empty(), empty(),
- p, empty())
- def lowerLeftNest (p1,p2) :
- '''creates a pic where same image is scaled .25 and in lower left over itself'''
- return overlay(lowerLeft(p2),p1)
- def lowerLeftNestSelf4 (p) :
- '''creates pic where same inage is scale to the lower left corner 4 times'''
- return lowerLeftNest(p,(lowerLeftNest(p,(lowerLeftNest(p,
- lowerLeftNest(p,empty()))))))
- #PART TWO: CREATING BLUE QUILT
- #creating the first and fourth quadrants using stripe()
- def quad1ULLR4ULLR():
- '''creates the upper left and lower right quadrants within quadrant 1 and 4'''
- p1 = triangles2x2('lightskyblue','navy')
- p2 = triangles2x2('darkslateblue','lightskyblue')
- return corner(p1,p2)
- def quad1UR4UR():
- '''creates the upper right of quadrants 1 and 4'''
- return fourSame(triangles2x2('darkslateblue','lightskyblue'))
- def quad1LL4LL():
- '''creates the lower left of quadrants of 1 and 4, as well as
- the upper right quadrant of 3'''
- p14 = bandana('lightcyan2','darkslateblue')
- p2 = bandana('darkslateblue','lightskyblue')
- p3 = patch2x2('royalblue')
- return fourPics(p14, p2,
- p3, p14)
- def quadrant14():
- '''combines all the quadrants within quadrants 1 and 4'''
- return stripe(quad1LL4LL(),quad1ULLR4ULLR(),quad1UR4UR())
- #creating quadrant two
- def quadrant2():
- '''creates quadrant 2 in totality'''
- return lowerLeftNestSelf4(triangles('darkslateblue','navy'))
- #creating quadrant three
- def quad3UL():
- '''creates upper left of quadrant 3'''
- p12 = patch2x2('darkseagreen')
- p34 = patch2x2('royalblue')
- return fourPics(p12,p12,
- p34,p34)
- def quad3UR():
- '''creates upper right of quadrant 3'''
- return quad1LL4LL()
- def quad3LL():
- '''creates lower left of quadrant 3'''
- p14 = triangles2x2('darkseagreen','royalblue')
- p2 = fourPics(patch('darkseagreen'),patch('lightcyan2'),
- patch('lightcyan2'),patch('darkseagreen'))
- p3 = stripe(triangles('darkseagreen','lightcyan2'),patch('royalblue'),
- patch('lightcyan2'))
- return fourPics(p14,p2,
- p3,p14)
- def quad3LR():
- '''creates lower right of quadrant 3'''
- p13 = patch2x2('royalblue')
- p24 = patch2x2('darkseagreen')
- return fourPics(p13,p24,
- p13,p24)
- def quadrant3():
- '''creates quadrant 3 using all quads'''
- return fourPics(quad3UL(), quad3UR(), quad3LL(),quad3LR())
- #putting all the quadrants together
- def blueQuilt():
- return stripe(quadrant3(),quadrant14(),quadrant2())
- #PART 3: MAKING AUTUMN QUILT
- #making the quadrant for the autumn quilt based on quilt()
- def aquad1ULLR4ULLR():
- '''creates the upper left and lower right quadrants within quadrant 1 and 4'''
- p1 = triangles2x2('gold','orange3')
- p2 = triangles2x2('darkred','gold')
- return corner(p1,p2)
- def aquad1UR4UR():
- '''creates the upper right of quadrants 1 and 4'''
- return fourSame(triangles2x2('darkred','gold'))
- def aquad1LL4LL():
- '''creates the lower left of quadrants of 1 and 4, as well as
- the upper right quadrant of 3'''
- p14 = bandana('sienna','darkred')
- p2 = bandana('darkred','gold')
- p3 = patch2x2('peachpuff')
- return fourPics(p14, p2,
- p3, p14)
- def aquadrant14():
- '''combines all the quadrants within quadrants 1 and 4'''
- return stripe(aquad1LL4LL(),aquad1ULLR4ULLR(),aquad1UR4UR())
- #creating quadrant two
- def aquadrant2():
- '''creates quadrant 2 in totality'''
- return lowerLeftNestSelf4(triangles('orange3','darkred'))
- #creating quadrant three
- def aquad3UL():
- '''makes upper left of quadrant 3'''
- p12 = patch2x2('firebrick')
- p34 = patch2x2('peachpuff')
- return fourPics(p12,p12,
- p34,p34)
- def aquad3UR():
- ''' makes upper right of quadrant 3'''
- return aquad1LL4LL()
- def aquad3LL():
- ''''makes lower left of quadrant 3'''
- p14 = triangles2x2('firebrick','peachpuff')
- p2 = fourPics(patch('firebrick'),patch('sienna'),
- patch('sienna'),patch('firebrick'))
- p3 = stripe(triangles('firebrick','sienna'),patch('peachpuff'),
- patch('sienna'))
- return fourPics(p14,p2,
- p3,p14)
- def aquad3LR():
- '''makes lower right of quadrant 3'''
- p13 = patch2x2('peachpuff')
- p24 = patch2x2('firebrick')
- return fourPics(p13,p24,
- p13,p24)
- def aquadrant3():
- '''combines all quads of quadrant 3'''
- return fourPics(aquad3UL(), aquad3UR(), aquad3LL(), aquad3LR())
- #putting all the quadrants together
- def autumnQuiltquadrant():
- '''creates quadrant of autumnQuilt'''
- return stripe(aquadrant3(),aquadrant14(),aquadrant2())
- #putting the total quilt together
- def autumnQuilt():
- '''rotates quadrants to form whole quilt'''
- return rotations(autumnQuiltquadrant())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement