-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.py
45 lines (41 loc) · 1.06 KB
/
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
import random
def gameWin(comp,you):
#if two values are equal, declare a tie!
if comp==you:
return None
#check for all posibility when computer chose s
if comp=='s':
if you=='w':
return False
elif you=='g':
return True
#check for all posibility when computer chose w
if comp=='w':
if you=='g':
return False
elif you=='s':
return True
#check for all posibility when computer chose g
if comp=='g':
if you=='s':
return False
elif you=='w':
return True
print("Comp turn : Snake(s) water(w) or gun(g)?")
randNo=random.randint(1,3)
if randNo==1:
comp='s'
elif randNo==2:
comp='w'
else:
comp='g'
you=input("your turn : Snake(s) water(w) or gun(g)?")
a=gameWin(comp,you)
print(f"Computer chose {comp}")
print(f"You chose {you}")
if a==None:
print("The game is tie! ")
elif a :
print("You win ")
else:
print("You loose")