Untitled
unknown
plain_text
20 days ago
2.8 kB
1
Indexable
Never
import random def intro(): print("Welcome to Tsunami Escape!") print("A massive tsunami is approaching. You need to make quick decisions to escape safely.") print("Make the right choices to avoid getting caught by the tsunami.") def choose_path(): print("\nYou are at a crossroads. Do you want to go (1) Left towards the hills or (2) Right towards the city?") choice = input("Enter 1 or 2: ") if choice == "1": hill_path() elif choice == "2": city_path() else: print("Invalid choice. Please enter 1 or 2.") choose_path() def hill_path(): print("\nYou head towards the hills. The terrain is rough but you can see an evacuation point in the distance.") print("You can either (1) Climb a rocky path or (2) Take a safer but longer trail.") choice = input("Enter 1 or 2: ") if choice == "1": rocky_path() elif choice == "2": long_trail() else: print("Invalid choice. Please enter 1 or 2.") hill_path() def city_path(): print("\nYou enter the city. It’s crowded and chaotic. You must make a quick decision.") print("You can either (1) Try to get to a nearby building or (2) Seek a boat at the docks.") choice = input("Enter 1 or 2: ") if choice == "1": building() elif choice == "2": boat() else: print("Invalid choice. Please enter 1 or 2.") city_path() def rocky_path(): print("\nYou take the rocky path. It's tough but you're making progress.") if random.choice([True, False]): print("Good news! You’ve reached the evacuation point. You escaped the tsunami!") else: print("The rocky path collapsed under the force of the tsunami. You didn’t make it.") def long_trail(): print("\nYou choose the safer long trail. It takes longer but it's less dangerous.") if random.choice([True, False]): print("You arrive at the evacuation point just in time. You’re safe from the tsunami!") else: print("The tsunami caught up with you on the long trail. You didn’t make it.") def building(): print("\nYou rush to the nearest building.") if random.choice([True, False]): print("You found a safe spot in the building and avoided the tsunami!") else: print("The building collapsed under the tsunami’s force. You didn’t survive.") def boat(): print("\nYou head to the docks and find a boat.") if random.choice([True, False]): print("You set sail just in time and escape the tsunami!") else: print("The boat was damaged and you couldn’t escape. You didn’t make it.") def main(): intro() choose_path() if __name__ == "__main__": main()
Leave a Comment