• API
• FAQ
• Tools
• Archive
daily pastebin goal
22%
SHARE
TWEET

# Untitled

a guest Mar 20th, 2019 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from colorama import Fore
2. from random import randint
3.
4. def main():
5.   welcomeScreen()
6.   scoreBoard = multiRoundGame()
7.   gameOverScreen(scoreBoard)
8.
9. def welcomeScreen():
10.   clear()
11.   print("ROCK, PAPER, SCISSORS")
12.   print("\n\n...The games rock, paper, scissor, you should know the rules...")
13.   wait = input("\n\nPress ENTER to play")
14.
15. def gameOverScreen(scoreboard):
16.   clear()
17.   print("ROCK, PAPER, SCISSORS")
18.   print("\nFINAL SCORE: ")
20.   print("\nComputer score: ", scoreboard[1])
21.   print("\nTies: ", scoreboard[2])
22.   wait = input("\n\nPress ENTER to play again or Q to quit..")
23.
24. def multiRoundGame():
25.   clear()
26.   print("ROCK, PAPER, SCISSORS")
27.   winningScore = int(input("\n\nEnter the number of rounds needed to win the game: "))
28.
29.
30.   scoreboard = [0,0,0]
31.   keepPlaying = True
32.   roundNumber = 0
33.
34.   while keepPlaying:
35.     clear()
36.     roundNumber += 1
37.     print("ROCK, PAPER, SCISSORS")
38.     print("\n\nFirst player to win", winningScore, "rounds is the winner!")
39.     print("\nRound #", roundNumber)
40.     print("\n\nThe current score:")
42.     print("Computer score:" , scoreboard[1])
43.     print("Tie games:" , scoreboard[1])
44.
45.     gameResult = rockPaperScissors(scoreboard)
46.
47.     scoreboard[gameResult] += 1
48.
49.     wait = input(Fore.WHITE + "\nPress ENTER to continue")
50.
51.     if scoreboard[0] == winningScore or scoreboard[1] == winningScore:
52.       keepPlaying = False
53.       return scoreboard
54.
55.
56. def rockPaperScissors(scoreboard):
57.   rpsDictionary  = {'r':'ROCK', 'p': 'PAPER', 's': 'Scissors'}
58.   computerDictionary = {0: 'r', 1 : 'p', 2 : 's'}
59.
60.   clear()
61.   print("ROCK, PAPER, SCISSORS")
63.   print("The computers score ->", scoreboard[1])
64.   print("Ties->", scoreboard[2])
65.
67.   userChoice = rpsInputCheck()
68.   userWord = rpsDictionary[userChoice]
69.
70.   computerKey = randint(0, 2)
71.   computerChoice = computerDictionary[computerKey]
72.
73.   rockWin = "ROCK busts a fat whallop on the SZAs!"
74.   scissorWin = "SCISSORS slice up the PAPER real good!"
75.   paperWin = "PAPER bags ROCK!"
76.
77.   userWinner = "Hip-hip hooray! You win this round!"
78.   computerWinner = "Holy shift! The computer wins this round!"
79.   tieRound = "What the function?! That round's a tie!"
80.
81.
82.   if userChoice == 'r' and computerChoice == 'p':
83.     print(paperWin)
84.     print(computerWinner)
85.     gameResult = 1
86.
87.   elif userChoice == 'p' and computerChoice == 'r':
88.     print(paperWin)
89.     print(userWinner)
90.     gameResult = 0
91.
92.   elif userChoice == 's' and computerChoice == 'p':
93.     print(scissorWin)
94.     print(userWinner)
95.     gameResult = 0
96.
97.   elif userChoice == 'p' and computerChoice == 's':
98.     print(scissorWin)
99.     print(computerWinner)
100.     gameResult = 1
101.
102.   elif userChoice == 'r' and computerChoice == 'p':
103.     print(paperWin)
104.     print(computerWinner)
105.     gameResult = 1
106.
107.   elif userChoice == 'r' and computerChoice == 's':
108.     print(rockWin)
109.     print(userWinner)
110.     gameResult = 0
111.
112.   elif userChoice == 's' and computerChoice == 'r':
113.     print(rockWin)
114.     print(computerWinner)
115.     gameResult = 1
116.
117.   elif userChoice == 'r' and computerChoice == 'r':
118.     print(tieRound)
119.     gameResult = 2
120.
121.   elif userChoice == 's' and computerChoice == 's':
122.     print(tieRound)
123.     gameResult = 2
124.
125.   elif userChoice == 'p' and computerChoice == 'p':
126.     print(tieRound)
127.     gameResult = 2
128.
129.   return gameResult
130.
131. def rpsInputCheck():
132.   goodChoice = ['r' , 'p', 's']
134.
136.     userChoice = input(Fore.WHITE + '\nChoose R for ROCK, P for PAPER, or S for SCISSORS: ' + Fore.LIGHTYELLOW_EX)
137.     userChoice = userChoice.lower()
138.
139.
140.     if userChoice in goodChoice: