Limited_Ice

This is what I turned in.

Jul 21st, 2019
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.21 KB | None | 0 0
  1. from random import randint
  2. from typing import Any
  3.  
  4. #these are variables that control story branching that isn't caused by user input. This program can be different every time you run it.
  5. catone = int (randint (0,101)) #Amara running to the road as well as whether or not she gets hit when she does run.
  6. cattwo = int (randint (0,101)) #Jaelin opening the car door and it smashing into another car
  7. catthree = int (randint (0,101)) #Desmond eating a penny and choking as well as living or dying from it.
  8. catfour = int (randint (0,101)) #unused at this time
  9. instadeath = int (randint (0,101)) #This variable determines if a doom beyond your control strikes as well as what that doom is.
  10.  
  11. #I sorted each portion of the story into it's own function so that programming the story itself would be easier. It was a mess when I tried it without it.
  12.  
  13. #test is what it sounds like. It lets me see what all the random variables are that control the story branching. I used it to make sure my contitional logic functioned correctly
  14. def test ():
  15. print (catone)
  16. print (cattwo)
  17. print (catthree)
  18. print (catfour)
  19. print (instadeath)
  20.  
  21. #intro is an introduction to the story.
  22. def intro ():
  23. print ('Hello, you brave fool.\nYou have decided to role play a Dad trying to do normal errands with his 3 kids. Jaelin (5), Amara (3), and Desmond (6m onths).')
  24.  
  25.  
  26. #voting_day includes the voting age test with a 1% chance of doom.
  27. def voting_day ():
  28. print ("You are browsing on your phone when a pop up... pops up. It is playing music loud enough to drown out the sounds of chaos around you\nYou try everythign to avoid answering its question but it just won't go away.")
  29. print ()
  30. print ('How Old Are You?')
  31. age = int (input ())
  32. def nuke ():
  33. if instadeath == 13:
  34. print ()
  35. print ('You notice a blinding flash of light in the window.\nOutside you see a mushroom cloud\nWhite Light everywhere... You have all died.')
  36.  
  37. elif catthree > 75:
  38. print ()
  39. print ('You hear a gagging sound beside you on the ground.\nYou have a sense of dread as you peer over the couch and see desmond choking on a penny!')
  40. if catthree == 99:
  41. print ('Desmond is already blue in the face, he stops struggling as you watch in horror\n You have failed')
  42. else:
  43. print ('You manage to pull the penny out of his throat with your finger before any permanent damage as done\n\nYou begin the adventure of loading everybody into the car')
  44.  
  45. def endvote ():
  46. print ()
  47. print ('You begin the adventure of loading everyone into the car.')
  48.  
  49. if age >= 18:
  50. print ('YOU NEED TO GO VOTE NOW!!!\nTime is almost up.')
  51. print ('People aged ' + str (age) + ' are especially important this election')
  52. endvote()
  53. nuke()
  54.  
  55. elif age == int (17):
  56. print ('Will you be 18 before the election?')
  57.  
  58. while True:
  59. print ('y or n')
  60. a = input ()
  61.  
  62. if a == 'y':
  63. print ('YOU NEED TO GO VOTE NOW!!!\nTime is almost up.')
  64. print ('People aged ' + str (age + 1) + ' are especially important this election')
  65. endvote()
  66. nuke()
  67. return
  68.  
  69. elif a == 'n':
  70. print ('You are to young to vote')
  71. print ()
  72. print ('You decide to go to the polling place to learn about the process anyway')
  73. print ('You missed that education when you dropped out of school at age ' + str (int (age) - 5) + ' to start raising your kids.')
  74. endvote()
  75. nuke()
  76. return
  77.  
  78. else:
  79. print ('You need to answer correctly.')
  80. continue
  81.  
  82. else:
  83. print ('You are too young to vote but decide to go to the polling place anyway to learn the process anyway.')
  84. print ('You missed that education when you dropped out of school at age ' + str (age - 5) + ' to start raising your kids.')
  85. endvote()
  86. nuke()
  87.  
  88.  
  89. #the_trip contains the guessing game... and a 1% of doom
  90. def the_trip ():
  91. print ()
  92. print ('You dread this.\nYou really, really dread this... Every time\nGetting the kids into the car is always super stressful.\nYou try telling the kids that they are going to stay here with Mom but Jaelin asks')
  93. print ()
  94. number = int (randint (0,10))
  95. print ("Jaelin: I really want to go. If you can't guess my number then I get to go. It is between 1 and 10.")
  96.  
  97. while True:
  98. print ("Enter your guess.")
  99. guess = int (input ())
  100. if guess < 0:
  101. print ("That guess doesn't count")
  102. continue
  103. elif guess > 10:
  104. print ("That guess doesn't count")
  105. elif guess == number:
  106. print ('Aww, you got it. I really wanted to go\n From the other room: YOU ARE TAKING THE KIDS WITH YOU!!!!')
  107. break
  108. elif guess != number:
  109. print ('YAY! I get to go!!')
  110. break
  111. print ()
  112. print ('You begin taking the kids to the car in one big group')
  113. print ()
  114.  
  115. if instadeath == 69:
  116. print ('A semi-truck crashes into the house killin geverybody\n You are dead.')
  117.  
  118. elif catone > int (70):
  119. print ('Amara suddenly bolts towards the road')
  120.  
  121. if catone == 99:
  122. print ('She is crushed underneath a semi-truck dying instantly\nYou have failed')
  123.  
  124. else:
  125. print ('but your quick reflexes allow you to catch her before she makes it to the road.\nYou have succeeded in loading the car with only a mild heart attack')
  126.  
  127.  
  128. else:
  129. print ('You did it! You got the kids into the car with minimal fuss.')
  130.  
  131.  
  132. #The_ride contains the addition program... again with a 1% of doom
  133. def the_ride ():
  134. print ()
  135. print ('As you search your memory you realize that this was, by far, the smoothest it has ever gone loading the car.\nIt is a little disconcerting.')
  136. print ()
  137. print ('Jaelin asks: Can you teach me to add numbers?\nYou: Of course Jae.')
  138. print ()
  139. print ('When you add two number together it is just like pushing two piles of blocks together.\nFor example a pile of 4 blocks plus another pile of 4 blocks make a new pile with 8 blocks.')
  140. print ()
  141. print ('I am going to ask you to add some numbers together for me.\nType "done" when you are finished')
  142.  
  143. while True:
  144. print ('What is your first number?')
  145. x = input ()
  146.  
  147. if x == 'done':
  148. print ()
  149. print ('You did very well Jaelin.')
  150. break
  151. else:
  152. print ('What is your second number?')
  153. y = input ()
  154. if y == 'done':
  155. print ()
  156. print ('You did very well Jaelin')
  157. break
  158.  
  159. else:
  160. z = int (x) + int (y)
  161. if z > 100:
  162. print ('They add up to a big number Dad')
  163. continue
  164.  
  165. else:
  166. print ('They add up to ' + str (z) + ' Dad.')
  167. print ()
  168. print ('What are your next numbers?\n type "done" when finished')
  169. print ()
  170. continue
  171.  
  172. print ()
  173.  
  174. if instadeath == 72:
  175. print ('A plane attempts an emergency landing on the road\nThe pilot of the plane has crushed your entire family in his bid to save the plane.\nYou are dead.')
  176.  
  177. else:
  178. if cattwo > 70:
  179. print ('Jaelin accidentally opens the car door while driving down the road\nThe door smashes into an oncoming car totalling both cars.\nYou do not make it to the polls today.')
  180. else:
  181. print ('After a long car ride filled with exciting talk about ponies and princesses you arrive at the polling place.')
  182.  
  183.  
  184. def grade ():
  185. print ()
  186. print ('Professor Cullen,\nWhat did you think of my program?\nIf you enter the numeric grade I will tell your the letter grade')
  187.  
  188. while True:
  189. score = input ()
  190.  
  191. if int (score) >89:
  192. print ('That is an "A"')
  193. continue
  194.  
  195. elif int (score) < 90 and int (score) > 79:
  196. print ('That is a "B"')
  197. continue
  198.  
  199. elif int (score) < 80 and int (score) > 69:
  200. print ('That is a "C"')
  201. continue
  202.  
  203. elif int (score) < 70 and int (score) >59:
  204. print ('That is a "D"')
  205. continue
  206.  
  207. elif int (score) <60:
  208. print ('That is a "F"')
  209. continue
  210.  
  211.  
  212. def ending ():
  213. print ()
  214. print ('The End')
  215.  
  216.  
  217. #These are hashed out and are used for debugging.
  218. #test()
  219. #into()
  220. #voting_day()
  221. #the_trip()
  222. #the_ride()
  223. #grade()
  224.  
  225. #this is the actual script that ties all the components together
  226. intro()
  227. voting_day() #killer number is 13 and catthree 99 is choking death >75 is choking but lives
  228. if instadeath != 13 and catthree != 99:
  229. the_trip() #killer number is 69 and cattone 99
  230.  
  231. if instadeath != 69 and catone != 99:
  232. the_ride() #killer number is 72 / if cattwo >70 story ends with door smashing
  233. ending()
  234.  
  235. else:
  236. ending()
  237.  
  238. else:
  239. ending()
  240.  
  241. grade()
Advertisement
Add Comment
Please, Sign In to add comment