-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpc.py
More file actions
63 lines (53 loc) · 1.61 KB
/
rpc.py
File metadata and controls
63 lines (53 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import random
import main
cpuChoices = ['Rock', 'Paper', 'Scissors']
def playAgain():
again = input("Play Again? (Y/N) ")
if again.lower() == "y":
main.clear()
game(False)
wins = 0
losses = 0
else:
main.clear()
game(True)
wins = 0
losses = 0
main.menu()
def game(gameOver=False):
wins = 0
losses = 0
while (gameOver == False):
print(f"Wins: {wins} \nLosses: {losses}")
userInput = input("[Type: Rock, Paper, Scissors] ")
computerInput = random.choice(cpuChoices)
print(f"Your Play: {userInput.lower()}\nCPU Play: {computerInput.lower()}")
# LOSSES
if (userInput.lower() == "rock") and (computerInput.lower() == "paper"):
losses += 1
elif (userInput.lower() == "paper") and (computerInput.lower()
== "scissors"):
losses += 1
elif (userInput.lower() == "scissors") and (computerInput.lower()
== "rock"):
losses += 1
# WINS
if (userInput.lower() == "paper") and (computerInput.lower() == "rock"):
wins += 1
elif (userInput.lower() == "scissors") and (computerInput.lower()
== "paper"):
wins += 1
elif (userInput.lower() == "rock") and (computerInput.lower()
== "scissors"):
wins += 1
elif (userInput.lower() == "q"):
main.clear()
main.menu()
if wins == 2:
print("You Win!")
playAgain()
elif losses == 2:
print("You Lose!")
playAgain()
if __name__ == '__main__':
game(False)