-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnake_Water_Gun.py
50 lines (43 loc) · 1.11 KB
/
Snake_Water_Gun.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
import random
def gameWin(comp,you):
if comp == you:
return None
elif comp == 's':
if you =='w':
return False
elif you =='g':
return True
elif comp == 'w':
if you =='g':
return False
elif you=='s':
return True
elif comp =='g':
if you=='w':
return True
elif you =='s':
return False
while True:
# print("Computer Turn: Snake (1) Water (2) Gun (3) ?")
randNO = random.randint(1,3)
# print(randNO)
if randNO ==1:
comp = 's'
elif randNO ==2:
comp = 'w'
else:
comp ='g'
you = input("Your Turn: Snake (s) water (w) Gun (g) Exit(e) ? ")
if you=='e':
break
elif you !='s' and you != 'w' and you !='g' and you !='e':
print("Incorrect option !!!!!! ")
continue
a = gameWin(comp ,you)
print(f"You chose {you} : computer chose {comp}")
if a== None:
print("Tie!")
elif a:
print("You Win!")
else:
print("You Lose!")