0% found this document useful (0 votes)
13 views

Game (Python)

Uploaded by

olduliksedy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Game (Python)

Uploaded by

olduliksedy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

def start():

print("You find yourself in a dark forest with two paths in front of you.")
print("Do you want to take the left path or the right path?")
choice = input("Type 'left' or 'right': ").lower()
if choice == 'left':
left_path()
elif choice == 'right':
right_path()
else:
print("Invalid choice, please type 'left' or 'right'.")
start()

def left_path():
print("You walk down the left path and find a small, abandoned cottage.")
print("Do you want to enter the cottage or keep walking?")
choice = input("Type 'enter' or 'walk': ").lower()
if choice == 'enter':
cottage()
elif choice == 'walk':
deep_forest()
else:
print("Invalid choice, please type 'enter' or 'walk'.")
left_path()

def right_path():
print("You walk down the right path and encounter a river.")
print("Do you want to swim across or walk along the river?")
choice = input("Type 'swim' or 'walk': ").lower()
if choice == 'swim':
swim()
elif choice == 'walk':
river_walk()
else:
print("Invalid choice, please type 'swim' or 'walk'.")
right_path()

def cottage():
print("You enter the cottage and find a treasure chest.")
print("Do you want to open the chest or look around the cottage?")
choice = input("Type 'open' or 'look': ").lower()
if choice == 'open':
treasure_chest()
elif choice == 'look':
look_around_cottage()
else:
print("Invalid choice, please type 'open' or 'look'.")
cottage()

def deep_forest():
print("You keep walking and the forest gets darker and denser.")
print("You see a light in the distance. Do you want to approach the light or keep walking?")
choice = input("Type 'approach' or 'keep': ").lower()
if choice == 'approach':
mysterious_light()
elif choice == 'keep':
lost_in_forest()
else:
print("Invalid choice, please type 'approach' or 'keep'.")
deep_forest()

def swim():
print("You swim across the river but get caught in a strong current.")
print("Do you want to try to swim harder or call for help?")
choice = input("Type 'swim' or 'call': ").lower()
if choice == 'swim':
swim_harder()
elif choice == 'call':
call_for_help()
else:
print("Invalid choice, please type 'swim' or 'call'.")
swim()

def river_walk():
print("You walk along the river and find a village.")
print("The villagers welcome you and offer you food and shelter.")
print("Do you want to stay in the village or continue your journey?")
choice = input("Type 'stay' or 'continue': ").lower()
if choice == 'stay':
stay_in_village()
elif choice == 'continue':
continue_journey()
else:
print("Invalid choice, please type 'stay' or 'continue'.")
river_walk()

def treasure_chest():
print("You open the chest and find a pile of gold and jewels!")
print("Congratulations, you have found the treasure and won the game!")
play_again()

def look_around_cottage():
print("You look around the cottage and find a hidden door.")
print("Do you want to open the hidden door or leave the cottage?")
choice = input("Type 'open' or 'leave': ").lower()
if choice == 'open':
hidden_door()
elif choice == 'leave':
deep_forest()
else:
print("Invalid choice, please type 'open' or 'leave'.")
look_around_cottage()

def mysterious_light():
print("You approach the light and find a group of friendly forest elves.")
print("The elves offer to guide you out of the forest.")
print("Do you want to follow the elves or explore further on your own?")
choice = input("Type 'follow' or 'explore': ").lower()
if choice == 'follow':
follow_elves()
elif choice == 'explore':
explore_forest()
else:
print("Invalid choice, please type 'follow' or 'explore'.")
mysterious_light()

def lost_in_forest():
print("You keep walking but can't find your way out and the forest is too dense.")
print("You come across a wild animal. Do you want to try to scare it away or run?")
choice = input("Type 'scare' or 'run': ").lower()
if choice == 'scare':
scare_animal()
elif choice == 'run':
run_from_animal()
else:
print("Invalid choice, please type 'scare' or 'run'.")
lost_in_forest()

def swim_harder():
print("You swim harder and manage to reach the other side of the river.")
print("You find a hidden cave behind a waterfall.")
print("Do you want to enter the cave or rest by the river?")
choice = input("Type 'enter' or 'rest': ").lower()
if choice == 'enter':
hidden_cave()
elif choice == 'rest':
rest_by_river()
else:
print("Invalid choice, please type 'enter' or 'rest'.")
swim_harder()

def call_for_help():
print("You call for help and a nearby fisherman hears you.")
print("The fisherman helps you cross the river safely.")
print("He offers to take you to his village. Do you want to go with him or continue alone?")
choice = input("Type 'go' or 'alone': ").lower()
if choice == 'go':
fisherman_village()
elif choice == 'alone':
continue_journey()
else:
print("Invalid choice, please type 'go' or 'alone'.")
call_for_help()

def stay_in_village():
print("You stay in the village and live a happy, peaceful life.")
print("Congratulations, you have found a new home and won the game!")
play_again()

def continue_journey():
print("You continue your journey and discover a hidden valley filled with rare flowers.")
print("The beauty of the valley takes your breath away.")
print("Do you want to stay in the valley or keep exploring?")
choice = input("Type 'stay' or 'explore': ").lower()
if choice == 'stay':
stay_in_valley()
elif choice == 'explore':
explore_valley()
else:
print("Invalid choice, please type 'stay' or 'explore'.")
continue_journey()

def hidden_door():
print("You open the hidden door and find a secret tunnel leading to an underground city.")
print("The city is filled with friendly inhabitants who welcome you.")
print("Do you want to stay in the city or explore the tunnels further?")
choice = input("Type 'stay' or 'explore': ").lower()
if choice == 'stay':
stay_in_city()
elif choice == 'explore':
explore_tunnels()
else:
print("Invalid choice, please type 'stay' or 'explore'.")
hidden_door()

def hidden_cave():
print("You enter the cave and find ancient artifacts and cave paintings.")
print("You realize you have discovered a lost civilization!")
print("Do you want to stay and study the artifacts or leave and report your findings?")
choice = input("Type 'stay' or 'leave': ").lower()
if choice == 'stay':
study_artifacts()
elif choice == 'leave':
report_findings()
else:
print("Invalid choice, please type 'stay' or 'leave'.")
hidden_cave()

def rest_by_river():
print("You rest by the river and enjoy the peaceful surroundings.")
print("However, night falls and it becomes too dark to continue.")
print("You decide to camp by the river for the night.")
print("Do you want to build a fire or sleep without a fire?")
choice = input("Type 'fire' or 'sleep': ").lower()
if choice == 'fire':
build_fire()
elif choice == 'sleep':
sleep_without_fire()
else:
print("Invalid choice, please type 'fire' or 'sleep'.")
rest_by_river()

def fisherman_village():
print("The fisherman takes you to his village where you are warmly welcomed.")
print("You decide to stay and live a peaceful life by the river.")
print("Congratulations, you have found a new home and won the game!")
play_again()

def scare_animal():
print("You try to scare the animal away, but it attacks you.")
print("Unfortunately, you are injured and the game is over.")
play_again()

def run_from_animal():
print("You run away from the animal and manage to escape.")
print("You find a hidden path that leads out of the forest.")
print("Congratulations, you have escaped the forest and won the game!")
play_again()

def follow_elves():
print("You follow the elves and they guide you out of the forest.")
print("The elves show you a secret way back to your home.")
print("Congratulations, you have made new friends and won the game!")
play_again()

def explore_forest():
print("You explore the forest further and find a magical spring.")
print("The spring has healing properties and you feel rejuvenated.")
print("Do you want to stay by the spring or continue exploring?")
choice = input("Type 'stay' or 'explore': ").lower()
if choice == 'stay':
stay_by_spring()
elif choice == 'explore':
explore_further()
else:
print("Invalid choice, please type 'stay' or 'explore'.")
explore_forest()

def stay_in_valley():
print("You stay in the valley and live among the rare flowers.")
print("You find peace and happiness in the beauty of nature.")
print("Congratulations, you have found paradise and won the game!")
play_again()

def explore_valley():
print("You explore the valley further and discover a hidden cave.")
print("Inside the cave, you find ancient artifacts and cave paintings.")
print("Congratulations, you have made a historic discovery and won the game!")
play_again()

def stay_in_city():
print("You stay in the underground city and become part of the community.")
print("You find a new home and live happily with your new friends.")
print("Congratulations, you have found a new world and won the game!")
play_again()
def explore_tunnels():
print("You explore the tunnels further and find an exit to the surface.")
print("You decide to leave the underground city and return to your journey.")
print("Do you want to go back to the forest or find a new path?")
choice = input("Type 'forest' or 'new': ").lower()
if choice == 'forest':
start()
elif choice == 'new':
new_path()
else:
print("Invalid choice, please type 'forest' or 'new'.")
explore_tunnels()

def study_artifacts():
print("You stay in the cave and study the ancient artifacts.")
print("You become a renowned archaeologist and make many discoveries.")
print("Congratulations, you have made a significant contribution to history and won the
game!")
play_again()

def report_findings():
print("You leave the cave and report your findings to the world.")
print("Your discovery becomes famous and you gain great recognition.")
print("Congratulations, you have made a historic discovery and won the game!")
play_again()

def build_fire():
print("You build a fire and stay warm through the night.")
print("In the morning, you continue your journey and find a hidden path.")
print("Congratulations, you have found a new path and won the game!")
play_again()

def sleep_without_fire():
print("You sleep without a fire and the cold night takes its toll.")
print("Unfortunately, you do not survive the night and the game is over.")
play_again()

def stay_by_spring():
print("You stay by the magical spring and live a long, healthy life.")
print("Congratulations, you have found a source of eternal youth and won the game!")
play_again()

def explore_further():
print("You explore further and find a hidden valley filled with rare flowers.")
print("The beauty of the valley takes your breath away.")
print("Congratulations, you have found paradise and won the game!")
play_again()

def new_path():
print("You find a new path and embark on a new adventure.")
print("Your journey continues as you explore the unknown.")
print("Congratulations, you have started a new chapter and won the game!")
play_again()

def play_again():
choice = input("Do you want to play again? (yes/no): ").lower()
if choice == 'yes':
start()
elif choice == 'no':
print("Thanks for playing!")
else:
print("Invalid choice, please type 'yes' or 'no'.")
play_again()

# Start the game


start()

You might also like