Advertisement
rkisken

Untitled

Sep 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1. # Your name: Rachel Kisken and Drew Chasse
  2. # Your username: rkisken and dchasse
  3. # ps03quilt.py
  4. # Submission date: 25 September 2017
  5.  
  6. from picture import *
  7.  
  8. # PART ONE: DEFINING HELPER FUNCTIONS
  9. def patch2x2 (c) :
  10. '''creates a patch of all the same color split in four sections'''
  11. return fourPics(patch (c), patch (c),
  12. patch (c), patch (c))
  13.  
  14. def triangles2x2 (c1, c2):
  15. '''creates a patch of two tone triangles'''
  16. return fourPics(triangles (c2,c1),patch(c1),
  17. patch(c2),triangles (c2,c1))
  18.  
  19. def bandana (c1,c2) :
  20. '''returns a patch of fourPics with two triangles, two patches'''
  21. return fourPics(triangles (c1,c2), patch(c1),
  22. patch(c1), triangles(c1,c2))
  23.  
  24. def corner (p1, p2) :
  25. '''returns a patch where p1 is in the lower left and all same pic around it'''
  26. return fourPics(p2, p2,
  27. p1, p2)
  28.  
  29. def stripe(p1, p2, p3) :
  30. '''creates a patch where p2 is diagnol p1 in lower left and p3 in upper right'''
  31. return fourPics (p2, p3,
  32. p1, p2)
  33.  
  34. def lowerLeft(p) :
  35. '''creates a pic where only image is in lower left'''
  36. return fourPics(empty(), empty(),
  37. p, empty())
  38.  
  39. def lowerLeftNest (p1,p2) :
  40. '''creates a pic where same image is scaled .25 and in lower left over itself'''
  41. return overlay(lowerLeft(p2),p1)
  42.  
  43. def lowerLeftNestSelf4 (p) :
  44. '''creates pic where same inage is scale to the lower left corner 4 times'''
  45. return lowerLeftNest(p,(lowerLeftNest(p,(lowerLeftNest(p,
  46. lowerLeftNest(p,empty()))))))
  47.  
  48. #PART TWO: CREATING BLUE QUILT
  49. #creating the first and fourth quadrants using stripe()
  50.  
  51. def quad1ULLR4ULLR():
  52. '''creates the upper left and lower right quadrants within quadrant 1 and 4'''
  53. p1 = triangles2x2('lightskyblue','navy')
  54. p2 = triangles2x2('darkslateblue','lightskyblue')
  55. return corner(p1,p2)
  56.  
  57. def quad1UR4UR():
  58. '''creates the upper right of quadrants 1 and 4'''
  59. return fourSame(triangles2x2('darkslateblue','lightskyblue'))
  60.  
  61. def quad1LL4LL():
  62. '''creates the lower left of quadrants of 1 and 4, as well as
  63. the upper right quadrant of 3'''
  64. p14 = bandana('lightcyan2','darkslateblue')
  65. p2 = bandana('darkslateblue','lightskyblue')
  66. p3 = patch2x2('royalblue')
  67. return fourPics(p14, p2,
  68. p3, p14)
  69.  
  70. def quadrant14():
  71. '''combines all the quadrants within quadrants 1 and 4'''
  72. return stripe(quad1LL4LL(),quad1ULLR4ULLR(),quad1UR4UR())
  73.  
  74. #creating quadrant two
  75. def quadrant2():
  76. '''creates quadrant 2 in totality'''
  77. return lowerLeftNestSelf4(triangles('darkslateblue','navy'))
  78.  
  79. #creating quadrant three
  80. def quad3UL():
  81. '''creates upper left of quadrant 3'''
  82. p12 = patch2x2('darkseagreen')
  83. p34 = patch2x2('royalblue')
  84. return fourPics(p12,p12,
  85. p34,p34)
  86.  
  87. def quad3UR():
  88. '''creates upper right of quadrant 3'''
  89. return quad1LL4LL()
  90.  
  91. def quad3LL():
  92. '''creates lower left of quadrant 3'''
  93. p14 = triangles2x2('darkseagreen','royalblue')
  94. p2 = fourPics(patch('darkseagreen'),patch('lightcyan2'),
  95. patch('lightcyan2'),patch('darkseagreen'))
  96. p3 = stripe(triangles('darkseagreen','lightcyan2'),patch('royalblue'),
  97. patch('lightcyan2'))
  98. return fourPics(p14,p2,
  99. p3,p14)
  100.  
  101. def quad3LR():
  102. '''creates lower right of quadrant 3'''
  103. p13 = patch2x2('royalblue')
  104. p24 = patch2x2('darkseagreen')
  105. return fourPics(p13,p24,
  106. p13,p24)
  107.  
  108. def quadrant3():
  109. '''creates quadrant 3 using all quads'''
  110. return fourPics(quad3UL(), quad3UR(), quad3LL(),quad3LR())
  111.  
  112. #putting all the quadrants together
  113. def blueQuilt():
  114. return stripe(quadrant3(),quadrant14(),quadrant2())
  115.  
  116. #PART 3: MAKING AUTUMN QUILT
  117. #making the quadrant for the autumn quilt based on quilt()
  118.  
  119. def aquad1ULLR4ULLR():
  120. '''creates the upper left and lower right quadrants within quadrant 1 and 4'''
  121. p1 = triangles2x2('gold','orange3')
  122. p2 = triangles2x2('darkred','gold')
  123. return corner(p1,p2)
  124.  
  125. def aquad1UR4UR():
  126. '''creates the upper right of quadrants 1 and 4'''
  127. return fourSame(triangles2x2('darkred','gold'))
  128.  
  129. def aquad1LL4LL():
  130. '''creates the lower left of quadrants of 1 and 4, as well as
  131. the upper right quadrant of 3'''
  132. p14 = bandana('sienna','darkred')
  133. p2 = bandana('darkred','gold')
  134. p3 = patch2x2('peachpuff')
  135. return fourPics(p14, p2,
  136. p3, p14)
  137.  
  138. def aquadrant14():
  139. '''combines all the quadrants within quadrants 1 and 4'''
  140. return stripe(aquad1LL4LL(),aquad1ULLR4ULLR(),aquad1UR4UR())
  141.  
  142. #creating quadrant two
  143. def aquadrant2():
  144. '''creates quadrant 2 in totality'''
  145. return lowerLeftNestSelf4(triangles('orange3','darkred'))
  146.  
  147. #creating quadrant three
  148. def aquad3UL():
  149. '''makes upper left of quadrant 3'''
  150. p12 = patch2x2('firebrick')
  151. p34 = patch2x2('peachpuff')
  152. return fourPics(p12,p12,
  153. p34,p34)
  154.  
  155. def aquad3UR():
  156. ''' makes upper right of quadrant 3'''
  157. return aquad1LL4LL()
  158.  
  159. def aquad3LL():
  160. ''''makes lower left of quadrant 3'''
  161. p14 = triangles2x2('firebrick','peachpuff')
  162. p2 = fourPics(patch('firebrick'),patch('sienna'),
  163. patch('sienna'),patch('firebrick'))
  164. p3 = stripe(triangles('firebrick','sienna'),patch('peachpuff'),
  165. patch('sienna'))
  166. return fourPics(p14,p2,
  167. p3,p14)
  168.  
  169. def aquad3LR():
  170. '''makes lower right of quadrant 3'''
  171. p13 = patch2x2('peachpuff')
  172. p24 = patch2x2('firebrick')
  173. return fourPics(p13,p24,
  174. p13,p24)
  175.  
  176. def aquadrant3():
  177. '''combines all quads of quadrant 3'''
  178. return fourPics(aquad3UL(), aquad3UR(), aquad3LL(), aquad3LR())
  179.  
  180. #putting all the quadrants together
  181. def autumnQuiltquadrant():
  182. '''creates quadrant of autumnQuilt'''
  183. return stripe(aquadrant3(),aquadrant14(),aquadrant2())
  184.  
  185. #putting the total quilt together
  186. def autumnQuilt():
  187. '''rotates quadrants to form whole quilt'''
  188. return rotations(autumnQuiltquadrant())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement