# Welcome message
name = input("Please enter your name: ")
print("Welcome, " + name + ", to the magical jungle.")
# Message about the jungle
print("You have entered a mystical jungle filled with mythical creatures.")
# Message about creatures
print("You will face various creatures such as the three-horned beetle and the purple-winged dinosaur.")
# Message about the goal of the game
print("The goal of the game is to reach the edge of the jungle and disarm the invisible force field.")
# Set health to 20
health = 20
# Description of the three-horned beetle
print("The three-horned beetle is a formidable opponent with its sharp horns and tough exoskeleton.")
# Ask to fight or run
choice = input("Would you like to fight or run? ")
# Check choice
if choice == "fight":
# Ask for weapon
weapon = input("Your options are to set a trap, use your bare hands, or use a stick. Choose your weapon: ")
if weapon == "set a trap":
print("You have defeated the beetle! ")
health += 50
elif weapon == "use bare hands":
print("You have lost to the beetle. Game over.")
exit()
elif weapon == "use a stick":
print("You have beaten the beetle! ")
health += 50
else:
print("Not a valid option.")
exit()
else:
print("You have outrun the beetle! You are safe now. ")
health += 30
# Print health
print("Your health is now: " + str(health))
# Description of the purple-winged dinosaur
print("The purple-winged dinosaur is a fierce flying beast with razor sharp claws.")
# Redeem health points
option = input("You can redeem your health points for a sword or a pair of wings. Choose your option: ")
if option == "pair of wings":
health -= 20
print("Your health is now: " + str(health))
print("You now have wings and can fly!")
elif option == "sword":
health -= 20
print("Your health is now: " + str(health))
print("You now have a sword!")
# Attack or fly away
choice = input("Would you like to attack the dinosaur with the sword or fly away? ")
if choice == "attack with sword":
# Random number of strikes
import random
strikes = random.randint(3, 7)
for i in range(strikes):
print("The dinosaur struck you! ")
health -= 10
print("Your health is now: " + str(health))
print("You struck the dinosaur! ")
if health > 0:
print("You survived the attack!")
else:
print("You have been mortally wounded. Game over.")
exit()
elif choice == "fly away":
print("The dinosaur eventually overtakes you. Game over.")
exit()
# Invisible force field
import random
secret = random.randint(10, 99)
count = 0
guess = int(input("You have reached the invisible force field surrounding the edge of the jungle. Guess the secret number between 10 and 99: "))
while count < 7 and guess != secret:
if guess > secret:
print("Too high.")
elif guess < secret:
print("Too low.")
guess = int(input("Try again: "))
count += 1
if guess == secret:
print("Congratulations! You have disarmed the force field and have won the game.")
else:
print("Sorry. The force field has not been disarmed, and you have lost the game.")