File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ #ROCK PAPER SCISSOR GAME
2+ #PLAYER VS CPU
3+ import random
4+ a = 0
5+ b = 0
6+ print ("WELCOME TO THE ROCK-PAPER-SCISSOR.........\n THIS IS YOU VS PC THE 1ST ONE TO GET SCORE OF 5 WINS\n LETS START..." )
7+ while True :
8+ print ("ENTER r-ROCK p-PAPER s-SCISSOR" )
9+ a1 = input ()
10+ n = random .randrange (- 10000 ,10000 ,1 )
11+ if n % 2 == 0 and n <= 0 :
12+ b1 = 'r'
13+ if n % 2 != 0 and n <= 0 :
14+ b1 = 'p'
15+ if n >= 0 :
16+ b1 = 's'
17+ if a1 == 'r' and b1 == 'r' or a1 == 'p' and b1 == 'p' or a1 == 's' and b1 == 's' :
18+ print ("CURRENTLY A: " ,a ,"B: " ,b )
19+ continue
20+ if a1 == 'r' and b1 == 'p' :
21+ b = b + 1
22+ if a1 == 'r' and b1 == 's' :
23+ a = a + 1
24+ if a1 == 'p' and b1 == 'r' :
25+ a = a + 1
26+ if a1 == 'p' and b1 == 's' :
27+ b = b + 1
28+ if a1 == 's' and b1 == 'r' :
29+ b = b + 1
30+ if a1 == 's' and b1 == 'p' :
31+ a = a + 1
32+ print ("CURRENTLY \n A: " ,a ,"\n B: " ,b )
33+ if a == 5 :
34+ print ("A won" )
35+ break
36+ if b == 5 :
37+ print ("PC won" )
You can’t perform that action at this time.
0 commit comments