نص
نص
def print_pause(text):
print(text)
time.sleep(2)
def ask_to_play_again():
print_pause("Would you like to play again? (y/n)")
choice = input("Write your choice here: ")
while choice != "y" and choice != "n":
print("Error! Please choose y or n.")
choice = input("Write your choice here: ")
if choice == "y":
print("Excellent! Restarting the game...")
start_game()
else:
print_pause("Thanks for playing! See you next time.")
print_pause("Instructions:")
print_pause("1- You will enter the game with 5 coins.")
print_pause("2- There will be an indicator showing how many stars you have.")
print_pause("3- You will face general knowledge and math questions. If you answer
correctly, you gain 2 coins and a reward.")
print_pause("4- Your goal is to fight the monster that threatens you and collect 15
coins.")
print_pause("5- Your magic wand can be upgraded 3 times to fight the monster, and
each upgrade costs 5 coins.")
print_pause("6- The difficulty of the questions increases gradually, and so does
the value of the rewards.")
print_pause("7- You lose the game if you answer even one question wrong, because
the monster becomes stronger than you.")
def start_game():
print_pause("You find yourself standing in an open field, full of grass and
yellow wildflowers.")
print_pause("Rumor has it that an evil fairy is somewhere around here, and has
been terrorizing the neighboring village.")
print_pause("In front of you is a house.")
print_pause("To your right is a mountain with a small, dark, cave-like
opening.")
print_pause("In your hand you hold your trusty (but not very effective) magic
wand.")
print_pause("You have two options:")
print_pause("1- Either knock on the door of the house")
print_pause("2- Or enter the cave")
print_pause("Please choose 1 or 2.")
if choice == "1":
print_pause("You approach the door of the house.")
print_pause("You are about to knock when the door opens and out steps a
dragon.")
print_pause("Eep! This is the dragon's house!")
print_pause("The dragon finds you!")
print_pause("You feel a bit under-prepared for this, what with only having
a tiny, rusty old magic wand.")
print_pause("Would you like to (1) cast a spell or (2) run away?!")
choice = input("Write your choice here: ")
if choice == "1":
print_pause("You do your best...")
print_pause("but your rusty old magic wand is not matching for the
dragon.")
print_pause("You have been turned into a frog!")
print_pause("Unfortunately, you lost. Try again.")
ask_to_play_again()
import time
def print_pause(text):
print(text)
time.sleep(2)
def ask_to_play_again():
print_pause("Would you like to play again? (y/n)")
choice = input("Write your choice here: ")
while choice != "y" and choice != "n":
print("Error! Please choose y or n.")
choice = input("Write your choice here: ")
if choice == "y":
print("Excellent! Restarting the game...")
start_game()
else:
print_pause("Thanks for playing! See you next time.")
print_pause("Instructions:")
print_pause("1- You will enter the game with 5 coins.")
print_pause("2- There will be an indicator showing how many stars you have.")
print_pause("3- You will face general knowledge and math questions. If you answer
correctly, you gain 2 coins and a reward.")
print_pause("4- Your goal is to fight the monster that threatens you and collect 15
coins.")
print_pause("5- Your magic wand can be upgraded 3 times to fight the monster, and
each upgrade costs 5 coins.")
print_pause("6- The difficulty of the questions increases gradually, and so does
the value of the rewards.")
print_pause("7- You lose the game if you answer even one question wrong, because
the monster becomes stronger than you.")
def start_game():
print_pause("You find yourself standing in an open field, full of grass and
yellow wildflowers.")
print_pause("Rumor has it that an evil fairy is somewhere around here, and has
been terrorizing the neighboring village.")
print_pause("In front of you is a house.")
print_pause("To your right is a mountain with a small, dark, cave-like
opening.")
print_pause("In your hand you hold your trusty (but not very effective) magic
wand.")
print_pause("You have two options:")
print_pause("1- Either knock on the door of the house")
print_pause("2- Or enter the cave")
print_pause("Please choose 1 or 2.")
if choice == "1":
print_pause("You approach the door of the house.")
print_pause("You are about to knock when the door opens and out steps a
dragon.")
print_pause("Eep! This is the dragon's house!")
print_pause("The dragon finds you!")
print_pause("You feel a bit under-prepared for this, what with only having
a tiny, rusty old magic wand.")
print_pause("Would you like to (1) cast a spell or (2) run away?!")
choice = input("Write your choice here: ")
if choice == "1":
print_pause("You do your best...")
print_pause("but your rusty old magic wand is not matching for the
dragon.")
print_pause("You have been turned into a frog!")
print_pause("Unfortunately, you lost. Try again.")
ask_to_play_again()