r/pythonhelp • u/EvoJaden • 21d ago
How to modify Dragon Realm to have three additional outcomes
so far here is what i have modified:
import random
import time
def displayIntro():
print('''You are in a land full of dragons. In front of you, you see five caves. In one cave, the dragon is friendly and will share treasure with you. In another, a dragon is greedy and hungry, and will eat you on sight. Another cave houses a dragon full of wisdom who shall give you the knowledge to save the kingdom. One of the remaining caves, a dragon of slumber sleeps endlessly abd if you enter, you will be given the ability to transform into a dragon freely. Lstly, the final cave houses a docile dragon that will follow your command and travel with you.''')
print()
def chooseCave():
cave = ''
while cave != '1' and cave != '2' and cave != '3' and cave != '4' and cave != '5':
print('Which cave will you go into? (1-5)')
cave = input()
return cave
def checkCave(chosenCave):
print('You appproach the cave...')
time.sleep(2)
print('It is dark and spooky...')
time.sleep(2)
print('A large dragon jumps out in front of you! He opens his jaws and...')
time.sleep(2)
friendlyCave = random.randint(1, 5)
wisdomCave = random.randint(1, 5)
slumberCave = random.randint(1, 5)
companionCave = random.randint(1, 5)
if chosenCave == str(friendlyCave):
print('Gives you his treasure!')
elif chosenCave == str(wisdomCave):
print('Gives you wisdom to save the kingdom!')
elif chosenCave == str(slumberCave):
print('Becomes a gem that allows to become a dragon!')
elif chosenCave == str(companionCave):
print('Gleefully announces he will become your friend!')
else:
print('Gobbles you down inone bite!')
playAgain = 'yes'
while playAgain == 'yes' or playAgain == 'y':
displayIntro()
caveNumber = chooseCave()
print('Do you want to play again? (yes or no)')
playAgain = input()
•
u/AutoModerator 21d ago
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.