Snake-Water-Gun Game project in Python
# AUTHOR : JAINISH LIMBACHIYA
# PURPOSE : Fun game in Python
# DATE : 18 SEPTEMBER 2020
import random
Computer=["s","w","g"]
Round=1
pc_points=0
your_points=0
def Game():
if comp == Choice:
print("DRAW GAME")
elif comp == "s" and Choice == "w":
return 0
elif comp == "s" and Choice == "g":
return 1
elif comp == "w" and Choice == "g":
return 0
elif comp == "w" and Choice == "s":
return 1
elif comp == "g" and Choice == "s":
return 0
elif comp == "g" and Choice == "w":
return 1
while Round!=6:
print(f"\t\t\tRound {Round}")
comp=random.choice(Computer)
print("Enter \ns for Snake\nw for Water\ng for Gun")
Choice=(input("Your choice "))
swg=Game()
if swg==1:
print(f"computer choice= {comp}")
print("YOU WON")
your_points=your_points+1
elif swg==0:
print("YOU LOSE")
pc_points=pc_points+1
print(f"\t\tPOINTS\nComputer={pc_points}\t\tPlayer={your_points}\n")
Round=Round+1
__OUTPUT__
Round 1
Enter
s for Snake
w for Water
g for Gun
Your choice =w
computer choice= g
YOU WON
POINTS
Computer=0 Player=1
Round 2
Enter
s for Snake
w for Water
g for Gun
Your choice =g
YOU LOSE
POINTS
Computer=1 Player=1
No comments: