Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.94 KB | None | 0 0
  1. import textwrap
  2. import random
  3.  
  4. # This function makes up the main body of the game and controls a players general flow through each of the options.
  5. def health_inspector_kenny(visited):
  6. if visited == 0:
  7. print(textwrap.fill(lb +"Welcome Health Inspector Kenny.\nToday you have to inspect three restaraunts and give them ratings.", width=60) +"\nWhere would you like to go first?\n"+lb)
  8. choice = location_selector(locations)
  9. if locations[choice] == "Billy's Big Burgers":
  10. locations.remove("Billy's Big Burgers")
  11. visited += 1
  12. billys_grade = billys_burgers()
  13. print(textwrap.fill("You've finished inspecting \"Billy's Big Burgers\" and have given it a grade of {0}.".format(grades[billys_grade]), width=60))
  14. health_inspector_kenny(visited)
  15. elif locations[choice] == "Lucy's Lemonade and Licorice":
  16. locations.remove("Lucy's Lemonade and Licorice")
  17. visited += 1
  18. lucys_grade = lucys_lemonade()
  19. print(textwrap.fill("You've finished inspecting \"Lucy's Lemonade and Licorice\" and have given it a grade of {0}.".format(grades[lucys_grade]), width=60))
  20. health_inspector_kenny(visited)
  21. elif locations[choice] == "Laura's Luncheonette":
  22. locations.remove("Laura's Luncheonette")
  23. visited += 1
  24. lauras_grade = lauras_luncheonette()
  25. print(textwrap.fill("You've finished inspecting \"Laura's Luncheonette\" and have given it a grade of {0}.".format(grades[lauras_grade]), width=60))
  26. health_inspector_kenny(visited)
  27. elif visited < 3:
  28. print("Where do you want to go next?"+lbb)
  29. choice = location_selector(locations)
  30. if locations[choice] == "Billy's Big Burgers":
  31. locations.remove("Billy's Big Burgers")
  32. visited += 1
  33. billys_grade = billys_burgers()
  34. print(textwrap.fill("You've finished inspecting \"Billy's Big Burgers\" and have given it a grade of {0}.".format(grades[billys_grade]), width=60))
  35. health_inspector_kenny(visited)
  36. elif locations[choice] == "Lucy's Lemonade and Licorice":
  37. locations.remove("Lucy's Lemonade and Licorice")
  38. visited += 1
  39. lucys_grade = lucys_lemonade()
  40. print(textwrap.fill("You've finished inspecting \"Lucy's Lemonade and Licorice\" and have given it a grade of {0}.".format(grades[lucys_grade]), width=60))
  41. health_inspector_kenny(visited)
  42. elif locations[choice] == "Laura's Luncheonette":
  43. locations.remove("Laura's Luncheonette")
  44. visited += 1
  45. lauras_grade = lauras_luncheonette()
  46. print(textwrap.fill("You've finished inspecting \"Laura's Luncheonette\" and have given it a grade of {0}.".format(grades[lauras_grade]), width=60))
  47. health_inspector_kenny(visited)
  48. else:
  49. print(textwrap.fill(lb + "Congratulations! You've finished a day of fullfilling health inspecting. Head home, pop open your favorite beverage, turn on old reruns of America's Next Top Model, and enjoy your evening." + lbb, width=60))
  50.  
  51. # Helper functions
  52. def location_selector(locations):
  53. for i in range(0,len(locations)):
  54. print("("+str(i+1)+") " + locations[i]+"\n")
  55. selection = chooser(locations)
  56. return selection
  57.  
  58. def chooser(locations):
  59. try:
  60. selection = int(input("Enter the number of your choice: ")) - 1
  61. if selection >= len(locations):
  62. print("Sorry, invalid selection. Please try again.")
  63. selection = chooser(locations)
  64. return selection
  65. except (NameError, SyntaxError):
  66. print("Sorry, invalid selection. Please try again.")
  67. selection = chooser(location)
  68. return selection
  69.  
  70. def responder():
  71. response = int(input("Enter the number of your choice: "))
  72. if response not in [1, 2]:
  73. print("Please enter a valid choice.")
  74. responder()
  75. return response
  76.  
  77. def format_text(text):
  78. print(textwrap.fill(lb + text, width=60, replace_whitespace=False) + lbb)
  79.  
  80. # Locations
  81. def billys_burgers():
  82. # 3 = A, 2 = B, 1 = C, 0 = F
  83. billys_grade = 3
  84. areas = ["Dining Room", "Bar", "Kitchen"]
  85. print(textwrap.fill(lb + "You enter the rustic yet charming all-American diner \"Billy's Big Burgers\". Billy himself, a large swarthy man in a striped apron, comes up to you and gruffly shakes your hand.\n\"Welcome Mr. Health Inspector, please take a look around, let me know if you need anything.\" Billy retreats back to the kitchen, keeping an eye on you as he backs away. Seems like a pretty weird guy.", width=60, replace_whitespace=False))
  86. for i in range(len(areas)):
  87. print("What area of the restaraunt would you like to check?\n"+ lb)
  88. choice = location_selector(areas)
  89. if areas[choice] == "Dining Room":
  90. format_text("You enter the dining room and are immediately hit with the smell of unwashed laundry. \"Hmm, that's not a good sign\" you think to yourself. Upon inspecting several tables, you find stains all over most of the tablecloths. You peer under the top of one of the booths only to find more dried gum than an elementary school's cafeteria.")
  91. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  92. response = responder()
  93. if response == 2:
  94. billys_grade -= 1
  95. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Billy's Big Burgers is currently {1}".format(areas[choice], grades[billys_grade]) + lbb, width=60))
  96. areas.remove("Dining Room")
  97. elif areas[choice] == "Bar":
  98. format_text("Walking behind the bar, you see everything appears fairly organized and clean. You notice a small picture of a little girl next to the glasses. Billy notices you looking at the picture and comes over. \"That's my girl Sasha\", he taps the picture and looks directly in your eyes, \"she'd be really crushed if the restaraunt didn't pass the health inspection. You wouldn't disappoint Sasha would you?\"")
  99. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  100. response = responder()
  101. if response == 2:
  102. billys_grade -= 1
  103. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Billy's Big Burgers is currently {1}".format(areas[choice], grades[billys_grade]) + lbb, width=60))
  104. areas.remove("Bar")
  105. elif areas[choice] == "Kitchen":
  106. format_text("The first thing you see in the kitchen is a massive pile of dishes sitting in the sink. \"I haven't had a chance to clean those yet\", states Billy, standing in your way. Pushing past him you see more concerning things. Open packs of american cheese sitting on counters in the heat. A mysterious mound of grey meat sits on top of a cold grill. A strange orange fluid seems to be leaking from the bottom of the fridge. To top it off you see an empty container of plastic gloves sitting above a workstation, stuffed with what appears to be used tissues.")
  107. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  108. response = responder()
  109. if response == 2:
  110. billys_grade -= 1
  111. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Billy's Big Burgers is currently {1}".format(areas[choice], grades[billys_grade]) + lbb, width=60))
  112. areas.remove("Kitchen")
  113. return billys_grade
  114.  
  115. def lauras_luncheonette():
  116. # 3 = A, 2 = B, 1 = C, 0 = F
  117. lauras_grade = 3
  118. areas = ["Dining Room", "Bar", "Kitchen"]
  119. print(textwrap.fill(lb + "You pull up to \"Laura's Luncheonette\", a plain white building with fading blue paint on the window trim. Laura meets you outside, bouncing from one foot to the other, appearing quite nervous. She leads you inside and gestures wildy. \"Please, please, inspect away, inspect it all it's perfect I promise!\" She nods enthusastically at you to begin.", width=60))
  120. for i in range(len(areas)):
  121. print("What area of the restaraunt would you like to check?"+ lb)
  122. choice = location_selector(areas)
  123. if areas[choice] == "Dining Room":
  124. format_text("As you start to inspect the dining room you are interrupted as a family of mice dart across the room, running across your shoes. Clearly these mice are not afraid of people. Laura doesn't seem to notice the mice as she has begun frantically weaving between tables emptying ashtrays into a pocket on her apron.")
  125. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  126. response = responder()
  127. if response == 2:
  128. lauras_grade -= 1
  129. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Laura's Luncheonette is currently {1}".format(areas[choice], grades[lauras_grade]) + lbb, width=60))
  130. areas.remove("Dining Room")
  131. elif areas[choice] == "Bar":
  132. format_text("The bar is crowded with half finished drinks, some appear to have formed some sort of weird film on them. You want inspect behind the bar but your foot gets stuck in something extremely sticky that is coating the floor. Oh boy, it's that kind of day.")
  133. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  134. response = responder()
  135. if response == 2:
  136. lauras_grade -= 1
  137. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Laura's Luncheonette is currently {1}".format(areas[choice], grades[lauras_grade]) + lbb, width=60))
  138. areas.remove("Bar")
  139. elif areas[choice] == "Kitchen":
  140. format_text("The 'kitchen' is actually a series of cafeteria tables filled with rusty hot plates surrounded by cupboards. This place looks more like a high school chemistry lab than it does an eating establishment. Upon opening one of the cuboard you several waterbugs quickly scamper out of the light. You've seen enough here, this is bad.")
  141. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  142. response = responder()
  143. if response == 2:
  144. lauras_grade -= 1
  145. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Laura's Luncheonette is currently {1}".format(areas[choice], grades[lauras_grade]) + lbb, width=60))
  146. areas.remove("Kitchen")
  147. return lauras_grade
  148.  
  149. def lucys_lemonade():
  150. # 3 = A, 2 = B, 1 = C, 0 = F
  151. lucys_grade = 3
  152. areas = ["Dining Room", "Bar", "Kitchen"]
  153. print(textwrap.fill(lb + "Lucy's Lemonade in Licorice, a small hole in the wall restaraunt, is teeming with people waiting outside when you arrive. You push your way to front of the line and ask to speak to Lucy. A woman comes out, pauses to wash her hands, and then turns to you. \n\n \"Oh, I didn't expect an inspection today. Sorry for the crowd, we launched a brand new flavor of licorice today, Matcha! But everything should be in order, come in and look.\"", width=60, replace_whitespace=False))
  154. for i in range(len(areas)):
  155. print("What area of the restaraunt would you like to check?"+ lbb)
  156. choice = location_selector(areas)
  157. if areas[choice] == "Dining Room":
  158. format_text("You squeeze into the small dining room. All six of the tables are filled with customers, munching on pale green strands of licorice and drinking glasses of lemonade. 'Interesting color of licorice' you think to yourself 'must be the new flavor.' \n\n Despite being crowded, the waiters are moving through smoothly and the floors and tables seem quite clean. A group of patrons gets up to leave and the table is promptly wiped down and cleaned.")
  159. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  160. response = responder()
  161. if response == 2:
  162. lucys_grade -= 1
  163. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Lucy's Lemonade and Licorice is currently {1}".format(areas[choice], grades[lucys_grade]) + lbb, width=60))
  164. areas.remove("Dining Room")
  165. elif areas[choice] == "Bar":
  166. format_text("Dominating the wall behind the bar are rows and rows of jars of different flavors of licorice. Upon inspection, each jar is sparklingly clean and closed with an airtight seal. \n\nOn the bar itself lies three large glass barrels of lemonade. Next to the barrels are lines of cleaned glasses. You see the various lemonade garnishes properly refrigerated underneath the bartop.")
  167. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  168. response = responder()
  169. if response == 2:
  170. lucys_grade -= 1
  171. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Lucy's Lemonade and Licorice is currently {1}".format(areas[choice], grades[lucys_grade]) + lbb, width=60))
  172. areas.remove("Bar")
  173. elif areas[choice] == "Kitchen":
  174. format_text("In the kitchen you a large strange machine. As you go to investigate it Lucy comes over to explain it's function. \"See here,\" she points at a row of nozzels, \"this is where the strands of licorice come out and this here twirls them.\" Cool, you think to yourself as you note that this machine is also very clean. In fact, everything in the kitchen seems spotless. You've never seen such a well run lemonade and licorice establishment.")
  175. print("How clean is the {0}?\n\n(1) {1} (pass this area).\n\n(2) {2} (fail this area).\n".format(areas[choice], clean_responses[random.randint(0,6)], dirty_responses[random.randint(0,6)]))
  176. response = responder()
  177. if response == 2:
  178. lucys_grade -= 1
  179. print(textwrap.fill(lb + "You mark your grade for the {0} on your clipboard. The grade for Lucy's Lemonade and Licorice is currently {1}".format(areas[choice], grades[lucys_grade]) + lbb, width=60))
  180. areas.remove("Kitchen")
  181. return lucys_grade
  182.  
  183. # Global Objects
  184. lbb = "\n------------------------------------------------------------\n"
  185. lb = "------------------------------------------------------------\n"
  186. grades = ["F", "C", "B", "A"]
  187. locations = ["Billy's Big Burgers", "Lucy's Lemonade and Licorice", "Laura's Luncheonette"]
  188. # use clean_responses[randint(0,6)] to generate a random response
  189. clean_responses = ["It looks pretty clean", "Clean enough", "Very clean", "I'd eat food prepared here", "Cleaner than my house", "Squeaky clean", "The cleanest I've ever seen"]
  190. dirty_responses = ["Oh god, it's so gross", "I can't breathe in here", "Quite dirty", "Very dirty", "Really disgusting", "Dirtier than a dumpster", "I wouldn't eat here"]
  191. visited = 0
  192.  
  193. health_inspector_kenny(visited)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement