-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython project.py
59 lines (57 loc) · 2.06 KB
/
python project.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
# Rock Paper Scissor
import time
from random import *
from os import system
print("\n \n Welcome To The Game Of Rock Paper And Scissor \n First to Score 3 Points wins!")
c=h=0
options=["Scissors","Paper","Rock"]
while(c!=3 and h!=3):
print("\n \n Press: \n 0 for Scissor \n 1 for Rock \n 2 for Rock \n")
g=int(input())
gc=randint(0,2)
if(g>2):
system('cls')
print("\n \n Invalid Input try again!")
print("\n \nScore Board: \n ---------------- \n| Human Score:",h,"|"," \n ---------------- \n| Comp Score:",c,"|\n ---------------- \n")
continue
system('cls')
match options[g]:
case "Scissors":
if(gc==0):
print("\n \n Draw try again!")
elif(gc==1):
print("\n \n Human : Scissor Cuts Through Paper!")
print("\n User +1 Point")
h+=1
else:
print("\n \n CPU : Rock Smashes Scissor!")
print("\n Comp +1 Point")
c+=1
case "Paper":
if(gc==0):
print("\n \n CPU : Scissor Cuts Through Paper!")
print("\n Comp +1 Point")
c+=1
elif(gc==1):
print("\n \n Draw try again!")
else:
print("\n \n Human : Paper Covers Rock!")
print("\n User +1 Point")
h+=1
case "Rock":
if(gc==0):
print("\n \n Human : Rock Smashes Scissor!")
print("\n User +1 Point")
h+=1
elif(gc==1):
print("\n \n CPU : Scissor Cuts Through Paper!")
print("\n Comp +1 Point")
c+=1
else:
print("\n \n Draw try again!")
print("\n \nScore Board: \n ---------------- \n| Human Score:",h,"|"," \n ---------------- \n| Comp Score:",c,"|\n ---------------- \n")
time.sleep(1)
if(h==3):
print("Human Wins! \n \n")
else:
print("Computer Wins! \n \n ")