Snake, Water, Gun game in python

 Snake, Water, Gun game in python

This is a two-player game where each player chooses one object. As we know, there are three objects, snake, water, and gun. So, the result will be
Snake vs. Water: Snake drinks the water hence wins.
Water vs. Gun: The gun will drown in water, hence a point for water
Gun vs. Snake: Gun will kill the snake and win.
In situations where both players choose the same object, the result will be a draw.


import random as r
print("@@@@SNAKE ~~~~WATER <<<<GUN ****")
i=0
list1=["s","w","g"]
u_count=0
pc_count=0
dr=0
while(i<5):
cinp=r.choice(list1)
uinp=input("input your choice (s/w/g) :")
if cinp=="s" and uinp=="w":
print(f" PC SCORED user_input[{cinp}] : pc_input[{uinp}]")
pc_count=pc_count+1
elif cinp=="w" and uinp=="s":
print(f" YOU SCORED user_input[{cinp}] : pc_input[{uinp}]")
u_count=u_count+1
elif cinp=="w" and uinp=="g":
print(f" PC SCORED user_input[{cinp}] : pc_input[{uinp}]")
pc_count = pc_count + 1
elif cinp=="g" and uinp=="w":
print(f" YOU SCORED user_input[{cinp}] : pc_input[{uinp}]")
u_count = u_count + 1
elif cinp=="s" and uinp=="g":
print(f" YOU SCORED user_input[{cinp}] : pc_input[{uinp}]")
u_count = u_count + 1
elif cinp=="g" and uinp=="s":
print(f" PC SCORED user_input[{cinp}] : pc_input[{uinp}]")
pc_count = pc_count + 1
elif cinp==uinp:
print(f" DRAW ROUND user_input[{cinp}] : pc_input[{uinp}]")
dr=dr+1
else:
print("wrong input from you")
i=i+1
print(f" user scorre: {u_count} ||computer score: {pc_count} || draw rounds: {dr}")
if u_count>pc_count:
print(" OK YOU WON GAME")
elif u_count<pc_count:
print(" OK COMPUTER WON GAME")
else:
print(" GAME IS DRAW")

Comments