python_introduction/examples/ex_text_based_adventure_gam...

46 lines
1.6 KiB
Python
Raw Normal View History

2021-10-29 09:24:46 +02:00
answer = input("You're at a cross section. Do you go left or right?")
if answer.startswith("l"):
answer = input("Down this hall you encounter a bear. Do you fight it?")
if answer.startswith("y"):
print("The bear counter attack! He kills you")
print("game over!")
exit(0)
elif answer.startswith("n"):
print("It's a friendly bear! He transforms into a wizard!")
answer = input("The wizard asks you if you know the meaning of life?")
if answer == "42":
print("He knods approuvingly and upgrades you to wizard status!")
print("You win!")
exit(0)
else:
print("He shakes his head in disbelief. You fool!")
print("game over!")
else:
print("that's not a valid choice...")
print("game over!")
exit(0)
elif answer.startswith("r"):
answer = input("Down this hall you find some mushrooms. Do you eat them?")
if answer.startswith("n"):
print("You starve to dead...")
print("game over!")
exit(0)
elif answer.startswith("y"):
print("A wizard apprears out of thin air!")
answer = input("The wizard asks you if you know the meaning of life?")
if answer == "42":
print("He knods approuvingly and upgrades you to wizard status!")
print("You win!")
exit(0)
else:
print("He shakes his head in disbelief. You fool!")
print("game over!")
else:
print("that's not a valid choice...")
print("game over!")
exit(0)
pass
else:
print("game over!")
exit(0)