@qoderman/

alphanumeric

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from random import choice

choices = ["rock", "paper", "scissors",]

gameStates = {
  "win": [(choices[0], choices[2]), (choices[2], choices[1]), (choices[1], choices[0])],
  "tie": [(choices[0], choices[0]), (choices[2], choices[2]), (choices[1], choices[1])],
  "lost":[(choices[2], choices[0]), (choices[1], choices[2]), (choices[0], choices[1])]
}

print ("Let's play Rock, Paper, Scissors!")

continueGame = True
while(continueGame):
  pick = ""
  while pick.lower() not in choices:
    pick = input("Do you choose rock, paper, or scissors?")
  otherPick = choice(choices)
  print("You picked " + pick)
  print("Your opponent picked " + otherPick)
  for outcome in gameStates:
    if (pick.lower(), otherPick) in gameStates[outcome]:
      print("You " + outcome + " against your opponent!")
  quitGame = input("Would you like to continue? [y/n]")
  if (quitGame == "n"):
    continueGame = False