Snake Water Gun - PyGame

 Snake Water Gun

def game():
n=0
round=0
userpoint=0
computerpoint=0
while n<10 and userpoint<10 and computerpoint<10:
import random
# userpoint+=1
# computerpoint+=1
round+=1
s=["snake","water","gun"]
choice=random.choice(s)
user=input("type \nsnake\nwater\ngun: ")
n+=1

if user=="snake" and choice=="snake":
print("Computer User: ",choice)
print("both are same "," Your Score: ",userpoint,"Computer Score: ",computerpoint, "Round: ",round)
elif user=="water" and choice=="water":
print("Computer User: ", choice)
print("both are same "," Your Score:",userpoint,"Computer Score: ",computerpoint, "Round: ",round)

elif user=="gun" and choice=="gun":
print("Computer User: ", choice)
print("both are same "," Your Score: ",userpoint,"Computer Score:",computerpoint, "Round: ",round)

elif user=="snake" and choice=="water":
userpoint+=1
print("Computer User: ", choice)
print("your snake dring the water"," Your Score",userpoint, "Round: ",round)

elif user=="snake" and choice=="gun":
computerpoint+=1
print("Computer User: ", choice)
print("your snake kill by gun"," Computer Score",computerpoint, "Round: ",round)

elif user=="water" and choice=="snake":
computerpoint+=1
print("Computer User: ", choice)
print("Computer snake dring your water"," Computer Score",computerpoint, "Round: ",round)

elif user=="water" and choice=="gun":
userpoint+=1
print("Computer User: ", choice)
print("you damage the gun"," Your Score",userpoint, "Round: ",round)

elif user=="gun" and choice=="snake":
userpoint+=1
print("Computer User: ", choice)
print("you kill the snake",''' your score''',userpoint, "Round: ",round)

elif user=="gun" and choice=="water":
computerpoint+=1
print("Computer User: ", choice)
print("your gun is damaged",''' computer score''',computerpoint, "Round: ",round)
# elif n==10 and round==10:
# print("Your Point: ",userpoint,"Computer Point: ",computerpoint)
#
while n==10 and round==10 and userpoint>computerpoint:
print("Your Point: ", userpoint, "Computer Point: ", computerpoint)
print("Congrats! you win the game ")
break

while n == 10 and round == 10 and userpoint == computerpoint:
print("Your Point: ", userpoint, "Computer Point: ", computerpoint)
print("This match is draw")
break

while n == 10 and round == 10 and userpoint < computerpoint:
print("Your Point: ", userpoint, "Computer Point: ", computerpoint)
print("you lost the game!\nThe winner is computer")
break

while True:
game()

ans=input("Do you want to play again\nY\nN: ")
if ans=='n':
print("Good Bye!")
break

















Comments

Popular posts from this blog

Become Healthy Goal - Python Program

Calculator in C++

Interpretation vs Compilation