Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #setup
- import random
- health = 5
- miles = 0
- days = 0
- daysleft = 300
- food = 500
- #temp variables
- temporarymiles = 0
- temporarydays = 0
- temporaryfood = 0
- count30days = 0
- daysleftinmonth = 30
- dayslefttotravel = 360
- #event variables
- badevent1 = (random.randint(1, 30))
- badevent2 = (random.randint(badevent1 , 30 ))
- #etc/functions
- commands = [ 'travel' , 'rest' , 'hunt' , 'status' , 'help' , 'quit']
- def clear():
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- def status():
- global dayslefttotravel
- dayslefttotravel = dayslefttotravel - days
- clear()
- daysleftinmonth = 0
- daysleftinmonth = 30 - daysleftinmonth
- print("You have: " + str(food) + " of food remaining.")
- print("Your health is " + str(health) + ".")
- print("It is day " + str(days) + ".")
- print("You have " + str(dayslefttotravel) + " days left to travel the trail.")
- print("You have traveled " + str(miles) + " miles.")
- print("There are: " + str(daysleftinmonth) + " days left in the month." )
- def reset():
- clear()
- global health
- global miles
- global days
- global daysleft
- global food
- global temporarymiles
- global temporarydays
- global temporaryfood
- health = 5
- miles = 0
- days = 0
- daysleft = 300
- food = 500
- temporarymiles = 0
- temporarydays = 0
- temporaryfood = 0
- def help():
- clear()
- global help
- print(commands)
- def quit():
- clear()
- clear()
- global quit
- print("It has been fun playing, goodbye")
- def travel():
- clear()
- global temporarymiles
- global temporarydays
- global count30days
- global daysleft
- global miles
- global days
- temporarymiles = (random.randint(30, 60))
- temporarydays = (random.randint(3, 7))
- daysleft = daysleft - temporarydays
- count30days = count30days + temporarydays
- miles = miles + temporarymiles
- days = days + temporarydays
- print("You have moved an additional " + str(temporarymiles) + " miles in " + str(temporarydays) + " days. Your total miles are: "
- + str(miles) + " in a total of " + str(days) + " days.")
- def hunt():
- clear()
- global count30days
- global days
- print("You now have an adidtional 100 pounds of food.")
- temporarydays = (random.randint(3, 7))
- count30days = count30days + temporarydays
- days = days + temporarydays
- print("It took you " + str(temporarydays) + " days to find this food. You have a total of " + str(food) + " pounds of food.")
- clear()
- def rest():
- clear()
- global days
- global count30days
- global health
- temporarydays = (random.randint(3, 7))
- days = days + temporarydays
- count30days = count30days + temporarydays
- print("You have rested for: " + str(temporarydays) + " days." )
- if health == 4 :
- health = 5
- print("You have gained one point of health.")
- if health == 5 :
- print("Your health is now: " + str(health) + "." )
- if health == 3 or health < 3 :
- health = health + (random.randint(1,2))
- print("Your health is now: " + str(health) + "." )
- #background
- 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.")
- print("You must reach the destination by the date 12/30")
- print("If you are ever unsure of what command to input, input the" + ' "help" ' + " command. ")
- print("You lose 5lbs of food a day, and travel anywhere between 30-60 within 3-7 days.")
- 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. ")
- print(" ")
- username = input("What is your name?")
- #GAMELOOP
- while 360 != daysleft :
- userinput = input("Input a command, if you are unsure what qualifies as a command, type: " + 'help.')
- #commands
- if userinput == "help" :
- help()
- temporarydays = 0
- if userinput == "status" :
- status()
- temporarydays = 0
- if userinput == "quit" :
- quit()
- break
- if userinput == 'travel' :
- travel()
- if userinput == "rest" :
- rest()
- if userinput == "hunt" :
- hunt()
- #conditionals
- food = food - temporarydays * 5
- temporarydays = 0
- if health < 0 :
- reset()
- status()
- print("You have lost too much health, you cannot continue.")
- if badevent2 < count30days or badevent2 == count30days :
- print("YOu have encountered a wolf, and it killed one of your family members.")
- health = health - 1
- if badevent1 < count30days or badevent1 == count30days :
- print("One of your family's members falls ill.")
- health = health - 1
- if daysleftinmonth == 0 :
- print(" ")
- print(" ")
- print(" ")
- print("It is a new month.")
- daysleftinmonth = 30
- count30days = 0
- badevent1 = (random.randint(1, 30))
- badevent2 = (random.randint(badevent1 , 30 ))
- print("You have " + str(daysleft) + " days left to travel out of 360.")
- if days > 360 :
- print("It is too late to reach Oregon.")
- print("You will die in the winter.")
- print("Game over.")
- clear()
- status()
- reset()
- if health == 0 :
- print("You have died.")
- status()
- reset()
- if health < 2 and health > 0 :
- print("You have one health point remaining.")
- if food < 25 :
- foodwarning = 0
- foodwarning = food / 5
- print("You have under 25 pounds of food remaining, that is enough for " + str(foodwarning) + " days.")
- food = food - temporaryfood
- if food < 0 :
- reset()
- status()
- print("You have run out of food; gamerover.")
- if miles > 2000 or miles == 2000 :
- print("You made it to oregon on time!")
- print("Congratulations!")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement