Advertisement
Guest User

micode

a guest
Jan 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. print(" WELCOME TO BIG BREAK")
  2. print("Input the colour of the ball you will attempt to pocket.")
  3. print("If you manage to pocket the ball, you will get a certain amount of money and go on to the next one. However, if you miss, a question will be asked.")
  4. print("\n")
  5. import random
  6. class BigBreak:
  7. def __init__(self):
  8. self.questions=[
  9. [
  10. ["What's the biggest ocean","pacific"],
  11. ],
  12. [
  13. ["Where was the first iPhone unveiled?","san francisco"],
  14. ],
  15. [
  16. ["What sport is played in the NBA?","basketball"],
  17. ],
  18. [
  19. ["When did WWII start","1939"],
  20. ],
  21. [
  22. ["9+10","21"],
  23. ],
  24. [
  25. ["Film about a ship sinking","titanic"],
  26. ],
  27. ]
  28. self.questionsAnswered=0
  29. self.tries=0
  30. def ready(self,section):
  31. self.questionsAnswered += 1
  32. print("Question time!")
  33. q=0
  34. print(" %s ?" % self.questions[section][q][0])
  35. if str(input("ANSWER: ")).lower() == self.questions[section][q][1]:
  36. print("Correct Answer!!!")
  37. else:
  38. if self.tries < 2:
  39. self.tries += 1
  40. self.ready(section)
  41. else:
  42. self.tries=0
  43. class Player:
  44. def __init__(self):
  45. self.countdown=30
  46. self.cash=0
  47. self.section=1000
  48. self.outcome=True
  49. def shoot(self):
  50.  
  51. print("Money: %s\nCountdown: %s" % (self.cash, self.countdown))
  52. print("\n")
  53. print("-------------------------------------")
  54. print("COLOUR KEY:")
  55. print("R= red, Bl= blue")
  56. print("G= green, B= black")
  57. print("Y= yellow, P= pink")
  58. print("-------------------------------------")
  59. print("\nGeography:\tRed\nScience:\tBlue\nSports:\t\tGreen\nHistory:\tBlack\nMaths\t\tYellow\nMovies\t\tPink")
  60. color = input("\n SELECT ").upper()
  61. if color == "R":
  62. self.section=0
  63. elif color == "B":
  64. self.section=1
  65. elif color =="G":
  66. self.section=2
  67. elif color =="Bl":
  68. self.section=3
  69. elif color =="Y":
  70. self.section=4
  71. elif color =="P":
  72. self.section=5
  73. else:
  74. self.section=1
  75. if random.randint(0,1) == 0:
  76. print("GOOD SHOT, BALL IN")
  77. if color == "R":
  78. self.cash += 10
  79. print("Red ball in +10$ ")
  80. elif color == "C":
  81. self.cash += 100
  82. print("Blue ball in +100$ ")
  83. elif color == "G":
  84. self.cash += 60
  85. print("Green ball in +60$ ")
  86. if color == "B":
  87. self.cash += 70
  88. print("Black ball in +70$")
  89. elif color == "Y":
  90. self.cash += 40
  91. print("Yellow ball in +100$")
  92. elif color == "P":
  93. self.cash += 120
  94. print("Pink ball in +120$")
  95. self.outcome=True
  96. else:
  97. print("Ball missed!")
  98. self.outcome=False
  99. game = BigBreak()
  100. player = Player()
  101. while player.countdown > 0:
  102. player.shoot()
  103. if player.outcome == False:
  104. game.ready(player.section)
  105. print("You won %s $" % player.cash)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement