-
Notifications
You must be signed in to change notification settings - Fork 0
/
adventure_game.py
29 lines (26 loc) · 1.15 KB
/
adventure_game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def adventure_game():
print("Welcome to the Text Adventure Game!")
print("You find yourself at a crossroad in a dark forest.")
while True:
choice = input("Do you want to go left, right, or straight ahead? (l/r/s): ").lower()
if choice == 'l':
print("You chose to go left.")
print("You encounter a friendly wizard who grants you a magic wand.")
print("Congratulations! You win the game!")
break
elif choice == 'r':
print("You chose to go right.")
print("You fall into a pit filled with snakes. Game Over!")
break
elif choice == 's':
print("You chose to go straight ahead.")
print("You find a treasure chest, but it's guarded by a dragon.")
fight_choice = input("Do you want to fight the dragon? (y/n): ").lower()
if fight_choice == 'y':
print("You defeat the dragon and claim the treasure. You win!")
else:
print("You run away. The game ends.")
break
else:
print("Invalid choice. Please choose l, r, or s.")
adventure_game()