Advertisement
matthewdeanmartin

gpt_oregon_trail.py

Dec 5th, 2022
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. def play_oregon_trail(): distance_traveled = 0; supplies = 100; health = 100; weather = "sunny"; print("Welcome to the Oregon Trail! You are a pioneer traveling west in search of a new life.\n"); while distance_traveled < 2000: print("Distance traveled: {} miles".format(distance_traveled)); print("Supplies: {}".format(supplies)); print("Health: {}".format(health)); print("Weather: {}\n".format(weather)); action = input("What would you like to do? (Travel, Rest, Hunt)\n"); if action.lower() == "travel": distance_traveled += 10; if weather == "sunny": supplies -= 5; health -= 5; elif weather == "rainy": supplies -= 10; health -= 10; elif weather == "snowy": supplies -= 15; health -= 15; elif action.lower() == "rest": health += 20; supplies -= 10; elif action.lower() == "hunt": food = 30; supplies += food; health -= 10; if health <= 0 or supplies <= 0: print("You have died on the trail. Better luck next time!"); return; weather_options = ["sunny", "rainy", "snowy"]; weather = random.choice(weather_options); print("Congratulations!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement