Make snake water gun game on phython
import random
def gamewin(comp,player):
if comp == player:
return None
elif comp == 's':
if player == 'w':
return False
elif player == 'g':
return True
elif comp == 'w':
if player == 'g':
return False
elif player == 's':
return True
elif comp == 'g':
if player == 's':
return False
elif player == 'w':
return True
print("Comp Turn:Snake(s) Water(w) Gun(g)?")
randNo = random.randint(1,3)
#print (randNo)
if randNo == 1:
comp = 's'
elif randNo == 2:
comp = 'w'
elif randNo == 3:
comp = 'g'
player = input("Your's Turn:Snake(s) Water(w) Gun(g)?")
gamewin(comp,player)
print(f"comp chose {comp}")
print(f"player chose {player}")
a = gamewin(comp,player)
if a == None:
print("The game is tie!")
elif a:
print("You win!")
else:
print("You Lose!")
Comments
Post a Comment