-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnake-water-gun.py
More file actions
70 lines (55 loc) · 2.15 KB
/
Copy pathSnake-water-gun.py
File metadata and controls
70 lines (55 loc) · 2.15 KB
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
60
61
62
63
64
65
66
67
68
69
70
"""
date: 28 jan 2020
by : sanam
project: game snake water gun
"""
import random
print("\t\t\t\t\t\t\t\t-: GAME SNAKE WATER GUN :-")
print("\t\t\t\t\t\t\t\t YOU HAVE 10 CHANCES")
usr_point = 0
comp_point = 0
chance = 0
while chance<10:
user = input(f"Enter s for Snake, w for Water, g for Gun:- {10-chance} chance left: \n").lower()
if user == "s" or user == "w" or user == "g": # IF statement for to pass only s,w,g otherwise print invalid.
pass
else:
print("INVALID INPUT. \n")
continue
element = ["snake", "water", "gun"]
computer = random.choice(element)
if user == "s" and computer == "snake": # game tie block
print("draw!\n")
continue
if user == "w" and computer == "water":
print("draw!\n")
continue
if user == "g" and computer == "gun":
print("draw!\n")
continue
chance = chance + 1
if user == "s" and computer == "water":
print("user win! - snake drink all water! \n")
usr_point = usr_point+1 # incrementing points
elif user == "s" and computer == "gun":
print("computer win! - snake shooted by gun! \n")
comp_point = comp_point+1
elif user == "w" and computer == "snake":
print("computer win! - snake drink all water! \n")
comp_point = comp_point+1
elif user == "w" and computer == "gun":
print("user win! - water slow down gun's bullet! \n")
usr_point = usr_point+1
elif user == "g" and computer == "snake":
print("user win! - snake shooted by gun! \n")
usr_point = usr_point+1
elif user == "g" and computer == "water":
print("computer win! - water slow down gun's bullet! \n")
comp_point = comp_point+1
print("\t\t\t\t\----------SCOREBOARD------------") # checking winner
if usr_point<comp_point:
print(f"COMPUTER WIN THE GAME! WITH {comp_point} POINTS, YOU LOOSE WITH {usr_point} POINTS. ")
elif usr_point==comp_point:
print(f"THE GAME IS TIE BOTH HAVE SAME POINTS {usr_point}. ")
else:
print(f"CONGRATULATIONS! YOU WIN THE GAME WITH {usr_point} POINTS, COMPUTER LOOSE WITH {comp_point} POINTS. ")