-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpps_rigged.py
51 lines (44 loc) · 1.35 KB
/
rpps_rigged.py
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
import time, sys
print('''Rock, Paper, Scissors
- Paper beats rocks.
- Scissors beats paper.
''')
# These variables keep track of the number of wins.
wins = 0
while True: # Main game loop.
while True: # Keep asking until player enters R, P, S, or Q.
print('{} Wins, 0 Losses, 0 Ties'.format(wins))
print('Enter your move: (R)ock (P)aper (S)cissors or (Q)uit')
playerMove = input('> ').upper()
if playerMove == 'Q':
print('Thanks for playing!')
sys.exit()
if playerMove == 'R' or playerMove == 'P' or playerMove == 'S':
break
else:
print('Type one of R, P, S, or Q.')
# Display what the player chose:
if playerMove == 'R':
print('ROCK versus...')
elif playerMove == 'P':
print('PAPER versus...')
elif playerMove == 'S':
print('SCISSORS versus...')
# Count to three with dramatic pauses:
time.sleep(0.5)
print('1...')
time.sleep(0.25)
print('2...')
time.sleep(0.25)
print('3...')
time.sleep(0.25)
# Display what the computer chose:
if playerMove == 'R':
print('SCISSORS')
elif playerMove == 'P':
print('ROCK')
elif playerMove == 'S':
print('PAPER')
time.sleep(0.5)
print('You win!')
wins = wins + 1