Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import random
  2. import time
  3.  
  4. def displayIntro():
  5. print('You are in a land full of dragons. In front of you,')
  6. print('you see two caves. In one cave, the dragon is friendly')
  7. print('and will share his treasure with you. The other dragon')
  8. print('is greedy and hungry, and will eat you on sight.')
  9. print
  10.  
  11. def chooseCave():
  12. cave = ''
  13. while cave != '1' and cave != '2':
  14. print('Which cave will you go into? (1 or 2)')
  15. cave = raw_input()
  16.  
  17. return cave
  18.  
  19. def checkCave(chosenCave):
  20. print('You approach the cave...')
  21. time.sleep(2)
  22. print('It is dark and spooky...')
  23. time.sleep(2)
  24. print('A large dragon jumps out in front of you! He opens his jaws and...')
  25. print
  26. time.sleep(2)
  27.  
  28. friendlyCave = random.randint(1, 2)
  29.  
  30. if chosenCave == str(friendlyCave):
  31. print('Gives you his treasure!')
  32. else:
  33. print('Gobbles you down in one bite!')
  34.  
  35. playAgain = 'yes'
  36. while playAgain == 'yes' or playAgain == 'y':
  37.  
  38. displayIntro()
  39.  
  40. caveNumber = chooseCave()
  41.  
  42. checkCave(caveNumber)
  43.  
  44. print('Do you want to play again? (yes or no)')
  45. playAgain = raw_input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement