05 Basic Text-Based Adventure Game
05 Basic Text-Based Adventure Game
if choice == '1':
left_path()
elif choice == '2':
right_path()
else:
print("Invalid choice! Please try again.")
start_game()
def left_path():
print("\nYou chose the left path.")
print("You encounter a river. There is a boat nearby.")
print("1. Take the boat")
print("2. Swim across the river")
if choice == '1':
print("You take the boat and safely cross the river. You win!")
elif choice == '2':
print("You try to swim but get caught in the current. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
1
def right_path():
print("\nYou chose the right path.")
print("You find a cave. There is a treasure chest inside.")
print("1. Open the chest")
print("2. Ignore the chest and continue")
if choice == '1':
print("You open the chest and find gold! You win!")
elif choice == '2':
print("You continue walking but get lost in the cave. Game over!")
else:
print("Invalid choice! Please try again.")
right_path()
2
start_game()
else:
print("Thanks for playing! Goodbye!")
def left_path():
print("\nYou chose the left path.")
print("You encounter a river. There is a boat nearby.")
print("1. Take the boat")
print("2. Swim across the river")
if choice == '1':
print("You take the boat and safely cross the river. You win!")
elif choice == '2':
print("You try to swim but get caught in the current. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
play_again()
def right_path():
print("\nYou chose the right path.")
print("You find a cave. There is a treasure chest inside.")
print("1. Open the chest")
print("2. Ignore the chest and continue")
if choice == '1':
print("You open the chest and find gold! You win!")
elif choice == '2':
print("You continue walking but get lost in the cave. Game over!")
else:
print("Invalid choice! Please try again.")
right_path()
play_again()
3
choice = input("Enter your choice (1 or 2): ")
if choice == '1':
print("You take the boat and safely cross the river.")
print("You find a village. The villagers offer you food and shelter.")
print("1. Accept their offer")
print("2. Continue your journey")
if choice == '1':
print("You live happily in the village. You win!")
elif choice == '2':
print("You continue your journey but get lost in the wilderness. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
elif choice == '2':
print("You try to swim but get caught in the current. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
play_again()
ဒီ project က beginner တတေအတေက် Python programming ကို ေက်တတေ့တေ့ကျင့်ြို့ တကာင်းတဲ့ project တစ်ေု
ြြစ်ြါတယ်။