Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print(" WELCOME TO BIG BREAK")
- print("Input the colour of the ball you will attempt to pocket.")
- 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.")
- print("\n")
- import random
- class BigBreak:
- def __init__(self):
- self.questions=[
- [
- ["What's the biggest ocean","pacific"],
- ],
- [
- ["Where was the first iPhone unveiled?","san francisco"],
- ],
- [
- ["What sport is played in the NBA?","basketball"],
- ],
- [
- ["When did WWII start","1939"],
- ],
- [
- ["9+10","21"],
- ],
- [
- ["Film about a ship sinking","titanic"],
- ],
- ]
- self.questionsAnswered=0
- self.tries=0
- def ready(self,section):
- self.questionsAnswered += 1
- print("Question time!")
- q=0
- print(" %s ?" % self.questions[section][q][0])
- if str(input("ANSWER: ")).lower() == self.questions[section][q][1]:
- print("Correct Answer!!!")
- else:
- if self.tries < 2:
- self.tries += 1
- self.ready(section)
- else:
- self.tries=0
- class Player:
- def __init__(self):
- self.countdown=30
- self.cash=0
- self.section=1000
- self.outcome=True
- def shoot(self):
- print("Money: %s\nCountdown: %s" % (self.cash, self.countdown))
- print("\n")
- print("-------------------------------------")
- print("COLOUR KEY:")
- print("R= red, Bl= blue")
- print("G= green, B= black")
- print("Y= yellow, P= pink")
- print("-------------------------------------")
- print("\nGeography:\tRed\nScience:\tBlue\nSports:\t\tGreen\nHistory:\tBlack\nMaths\t\tYellow\nMovies\t\tPink")
- color = input("\n SELECT ").upper()
- if color == "R":
- self.section=0
- elif color == "B":
- self.section=1
- elif color =="G":
- self.section=2
- elif color =="Bl":
- self.section=3
- elif color =="Y":
- self.section=4
- elif color =="P":
- self.section=5
- else:
- self.section=1
- if random.randint(0,1) == 0:
- print("GOOD SHOT, BALL IN")
- if color == "R":
- self.cash += 10
- print("Red ball in +10$ ")
- elif color == "C":
- self.cash += 100
- print("Blue ball in +100$ ")
- elif color == "G":
- self.cash += 60
- print("Green ball in +60$ ")
- if color == "B":
- self.cash += 70
- print("Black ball in +70$")
- elif color == "Y":
- self.cash += 40
- print("Yellow ball in +100$")
- elif color == "P":
- self.cash += 120
- print("Pink ball in +120$")
- self.outcome=True
- else:
- print("Ball missed!")
- self.outcome=False
- game = BigBreak()
- player = Player()
- while player.countdown > 0:
- player.shoot()
- if player.outcome == False:
- game.ready(player.section)
- print("You won %s $" % player.cash)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement