@DragoniteDL/

Rock, Paper, Sicssors!

Python

Lots of 'If's and 'While's, ansd variables.

fork
loading
Files
  • main.py
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import replit, time, random
replit.clear()

print('1 or 2 players?')
print('1 - 1 player')
print('2 - 2 players')
players = int(input())

loop1 = 1

while (loop1 != 2):
  
  if players == 1:
    replit.clear()
    print('Okay! 1 player!')
    loop1 = 2
  if players == 2:
    replit.clear()
    print('Okay! 2 players!')
    loop1 = 2
  else:
    replit.clear()
    print('1 or 2 players?')
    print('1 - 1 player')
    print('2 - 2 players')
    players = int(input())

replit.clear()

chosen = 0
while (chosen != 1):
  replit.clear()
  print('Player 1. Rock, Paper, or Scissors.')
  print('1 - Rock')
  print('2 - Paper')
  print('3 - Scissors')
  rps = int(input())
  if rps == 1:
    user_rps1 = 1
    user_rps2 = 'Rock'
    chosen = 1
  if rps == 2:
    user_rps1 = 2
    user_rps2 = 'Paper'
    chosen = 1
  if rps == 3:
    user_rps1 = 3
    user_rps2 = 'Scissors'
    chosen = 1
  else:
    print('Rock, Paper, or Scissors.')
    print()
    print('1 - Rock')
    print('2 - Paper')
    print('3 - Scissors')

replit.clear()
if players == 1:
  user2_rps1 = random.randint(1,3)
  if user2_rps1 == 1:
    user2_rps2 = 'Rock'
  if user2_rps1 == 2:
    user2_rps2 = 'Paper'
  if user2_rps1 == 3:
    user2_rps2 = 'Scissors'
else:
  chosen2 = 0
  while (chosen2 != 1):
    replit.clear()
    print('Player 2. Rock, Paper, or Scissors.')
    print('1 - Rock')
    print('2 - Paper')
    print('3 - Scissors')
    rps = int(input())
    if rps == 1:
      user2_rps1 = 1
      user2_rps2 = 'Rock'
      chosen2 = 1
    if rps == 2:
      user2_rps1 = 2
      user2_rps2 = 'Paper'
      chosen2 = 1
    if rps == 3:
      user2_rps1 = 3
      user2_rps2 = 'Scissors'
      chosen2 = 1
    else:
      print('Player2. Rock, Paper, or Scissors.')
      print()
      print('1 - Rock')
      print('2 - Paper')
      print('3 - Scissors')

replit.clear()
if players == 1:
  print('Player 1:',user_rps2,' V.S. ','Bot:',user2_rps2)
if players == 2:
  print('Player 1:',user_rps2,' V.S. ','Player 2:',user2_rps2)

if user_rps1 == user2_rps1:
  outcome = 'Tie!'
if user_rps1 == 1 and user2_rps1 == 2:
  if players == 2:
    outcome = 'Player 2 Wins!'
  else:
    outcome = 'Bot Wins!'
if user2_rps1 == 1 and user_rps1 == 2:
    outcome = 'Player 1 Wins!'
if user_rps1 == 2 and user2_rps1 == 3:
  if players == 2:
    outcome = 'Player 2 Wins!'
  if players == 1:
    outcome = 'Bot Wins!'
if user2_rps1 == 2 and user_rps1 == 3:
  outcome = 'Player 1 Wins!'
if user_rps1 == 3 and user2_rps1 == 1:
  if players == 2:
    outcome = 'Player 2 Wins!'
  if players == 1:
    outcome = 'Bot Wins!'
if user2_rps1 == 3 and user_rps1 == 1:
  outcome = 'Player 1 Wins!'
  
print()
print('    ',outcome)