Repository navigation
Snake Water and Gun Game
Pre-release
Pre-release
This is my first project during my AI journey. It's a game called "Snake, Water, and Gun, " also known as "Stone, Paper, and Scissors," a childhood memory for me.
Full Changelog: https://github.com/AKsince2005/python/commits/virtualenv
`
'''
1 for snake
-1 for water
0 for gun
'''
def select(c):
c = input("Would you like to continue this game : ")
return c
import random
selection = "YES"
while (selection == "YES"):
print("Choose : \nS for Snake\tW for Water\tG for Gun")
choice = random.choice([-1, 0, 1])
computer = choice
youstr = input ("Enter your choice : ")
youstr=youstr.upper()
youdict = {"S":1,"W":-1,"G":0}
if youstr in youdict:
you = youdict[youstr]
reversedict = {1:"Snake", -1 : "Water" , 0 : "Gun"}
print(f"You chose {reversedict[you]} \n Computer chose {reversedict[computer]}")
if computer == -1 and you == 1:
print("You win!")
elif computer == -1 and you == 0:
print("You lose!")
elif computer == 1 and you == -1:
print("You lose!")
elif computer == 1 and you == 0:
print("You win!")
elif computer == 0 and you == -1:
print("You win!")
elif computer == 0 and you == 1:
print("You lose!")
elif computer == you:
print("It's a tie!")
else:
print("Invalid input")
selection = select(c="")
selection = selection.upper()
if selection == "YES":
continue
else:
print("Thanks! for playing come soon............... ")
break
else:
print("Invalid choice : \n Retry")
selection = select(c="")
selection = selection.upper()
if selection == "YES":
continue
else:
print("Thanks! for playing come soon............... ")
break
`