Guest User

horrible oregon trail game

a guest
Aug 17th, 2019
531
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #setup
  2.  
  3. import random
  4.  
  5. health = 5
  6. miles = 0
  7. days = 0
  8. daysleft = 300
  9. food = 500
  10.  
  11. #temp variables
  12.  
  13. temporarymiles = 0
  14. temporarydays = 0
  15. temporaryfood = 0
  16. count30days = 0
  17. daysleftinmonth = 30
  18. dayslefttotravel = 360
  19.  
  20.  
  21. #event variables
  22.  
  23. badevent1 = (random.randint(1, 30))
  24. badevent2 = (random.randint(badevent1 , 30 ))
  25.  
  26.  
  27. #etc/functions
  28.  
  29. commands = [ 'travel' , 'rest' , 'hunt' , 'status' , 'help' , 'quit']
  30.  
  31.  
  32. def clear():
  33. print(" ")
  34. print(" ")
  35. print(" ")
  36. print(" ")
  37. print(" ")
  38. print(" ")
  39. print(" ")
  40. print(" ")
  41. print(" ")
  42. print(" ")
  43. print(" ")
  44. print(" ")
  45.  
  46. def status():
  47. global dayslefttotravel
  48. dayslefttotravel = dayslefttotravel - days
  49. clear()
  50. daysleftinmonth = 0
  51. daysleftinmonth = 30 - daysleftinmonth
  52. print("You have: " + str(food) + " of food remaining.")
  53. print("Your health is " + str(health) + ".")
  54. print("It is day " + str(days) + ".")
  55. print("You have " + str(dayslefttotravel) + " days left to travel the trail.")
  56. print("You have traveled " + str(miles) + " miles.")
  57. print("There are: " + str(daysleftinmonth) + " days left in the month." )
  58.  
  59. def reset():
  60. clear()
  61. global health
  62. global miles
  63. global days
  64. global daysleft
  65. global food
  66. global temporarymiles
  67. global temporarydays
  68. global temporaryfood
  69. health = 5
  70. miles = 0
  71. days = 0
  72. daysleft = 300
  73. food = 500
  74. temporarymiles = 0
  75. temporarydays = 0
  76. temporaryfood = 0
  77.  
  78.  
  79. def help():
  80. clear()
  81. global help
  82. print(commands)
  83.  
  84. def quit():
  85. clear()
  86. clear()
  87. global quit
  88. print("It has been fun playing, goodbye")
  89.  
  90. def travel():
  91. clear()
  92. global temporarymiles
  93. global temporarydays
  94. global count30days
  95. global daysleft
  96. global miles
  97. global days
  98.  
  99. temporarymiles = (random.randint(30, 60))
  100. temporarydays = (random.randint(3, 7))
  101. daysleft = daysleft - temporarydays
  102. count30days = count30days + temporarydays
  103. miles = miles + temporarymiles
  104. days = days + temporarydays
  105. print("You have moved an additional " + str(temporarymiles) + " miles in " + str(temporarydays) + " days. Your total miles are: "
  106. + str(miles) + " in a total of " + str(days) + " days.")
  107.  
  108. def hunt():
  109. clear()
  110. global count30days
  111. global days
  112. print("You now have an adidtional 100 pounds of food.")
  113. temporarydays = (random.randint(3, 7))
  114. count30days = count30days + temporarydays
  115. days = days + temporarydays
  116. print("It took you " + str(temporarydays) + " days to find this food. You have a total of " + str(food) + " pounds of food.")
  117. clear()
  118.  
  119. def rest():
  120. clear()
  121. global days
  122. global count30days
  123. global health
  124.  
  125. temporarydays = (random.randint(3, 7))
  126. days = days + temporarydays
  127. count30days = count30days + temporarydays
  128. print("You have rested for: " + str(temporarydays) + " days." )
  129.  
  130. if health == 4 :
  131. health = 5
  132. print("You have gained one point of health.")
  133.  
  134. if health == 5 :
  135. print("Your health is now: " + str(health) + "." )
  136.  
  137.  
  138. if health == 3 or health < 3 :
  139. health = health + (random.randint(1,2))
  140. print("Your health is now: " + str(health) + "." )
  141.  
  142.  
  143.  
  144. #background
  145.  
  146. print("You begin at NYC, on 3/01, and you must travel 2000 miles, with only 500 lbs of food, and 5 health, to Oregon.")
  147. print("You must reach the destination by the date 12/30")
  148. print("If you are ever unsure of what command to input, input the" + ' "help" ' + " command. ")
  149. print("You lose 5lbs of food a day, and travel anywhere between 30-60 within 3-7 days.")
  150. print("You lose two health a month, but can regain the health with the rest command. If you ever feel like quitting, the 'quit' command will serve you well. ")
  151. print(" ")
  152.  
  153. username = input("What is your name?")
  154.  
  155.  
  156.  
  157.  
  158. #GAMELOOP
  159.  
  160.  
  161.  
  162.  
  163. while 360 != daysleft :
  164. userinput = input("Input a command, if you are unsure what qualifies as a command, type: " + 'help.')
  165.  
  166. #commands
  167.  
  168. if userinput == "help" :
  169. help()
  170. temporarydays = 0
  171.  
  172. if userinput == "status" :
  173. status()
  174. temporarydays = 0
  175.  
  176. if userinput == "quit" :
  177. quit()
  178. break
  179.  
  180. if userinput == 'travel' :
  181. travel()
  182.  
  183. if userinput == "rest" :
  184. rest()
  185.  
  186. if userinput == "hunt" :
  187. hunt()
  188.  
  189.  
  190. #conditionals
  191.  
  192. food = food - temporarydays * 5
  193. temporarydays = 0
  194.  
  195. if health < 0 :
  196. reset()
  197. status()
  198. print("You have lost too much health, you cannot continue.")
  199.  
  200. if badevent2 < count30days or badevent2 == count30days :
  201. print("YOu have encountered a wolf, and it killed one of your family members.")
  202. health = health - 1
  203.  
  204. if badevent1 < count30days or badevent1 == count30days :
  205. print("One of your family's members falls ill.")
  206. health = health - 1
  207.  
  208. if daysleftinmonth == 0 :
  209. print(" ")
  210. print(" ")
  211. print(" ")
  212. print("It is a new month.")
  213. daysleftinmonth = 30
  214. count30days = 0
  215. badevent1 = (random.randint(1, 30))
  216. badevent2 = (random.randint(badevent1 , 30 ))
  217. print("You have " + str(daysleft) + " days left to travel out of 360.")
  218.  
  219.  
  220. if days > 360 :
  221. print("It is too late to reach Oregon.")
  222. print("You will die in the winter.")
  223. print("Game over.")
  224. clear()
  225. status()
  226. reset()
  227.  
  228. if health == 0 :
  229. print("You have died.")
  230. status()
  231. reset()
  232.  
  233.  
  234. if health < 2 and health > 0 :
  235. print("You have one health point remaining.")
  236.  
  237. if food < 25 :
  238. foodwarning = 0
  239. foodwarning = food / 5
  240. print("You have under 25 pounds of food remaining, that is enough for " + str(foodwarning) + " days.")
  241. food = food - temporaryfood
  242.  
  243. if food < 0 :
  244. reset()
  245. status()
  246. print("You have run out of food; gamerover.")
  247.  
  248.  
  249. if miles > 2000 or miles == 2000 :
  250. print("You made it to oregon on time!")
  251. print("Congratulations!")
  252. break
RAW Paste Data