-
Notifications
You must be signed in to change notification settings - Fork 590
/
Copy pathwater_snake_gun.py
50 lines (45 loc) · 1.32 KB
/
water_snake_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
# A game of Snake V/s Water V/s Gun
import random
def GameWin(Computer, Player):
# Tie if Both Player & Computer choose same
if Computer == Player:
return None
# Check for all possiblites when computer choose 's'
elif Computer == 's':
if Player == 2:
return False
elif Player == 3:
return True
# Check for all possiblites when computer choose 'w'
elif Computer == 'w':
if Player == 3:
return False
elif Player == 1:
return True
# Check for all possiblites when computer choose 'g'
elif Computer == 'g':
if Player == 1:
return False
elif Player == 2:
return True
print("Computer's Turn: Snake(s) / Water(r) / Gun(g)?\n")
randNo = random.randint(1,3)
if randNo == 1:
Computer = 's'
elif randNo == 2:
Computer = 'w'
elif randNo == 3:
Computer = 'g'
Player = int(input("Your Turn:Press 1->(Snake),2->(Water),3->(Gun)\n"))
if (Player==1 or Player==2 or Player==3):
a = GameWin(Computer, Player)
print(f"Computer Choose {Computer}")
print(f"Player Choose {Player}")
if a == None:
print("The Game Is Tie !!!")
elif a == True:
print("Wow ! You Win ")
else:
print("Ohoo ! You Loose")
else:
print("Wrong Option Choosen")