Guest User

Untitled

a guest
Jan 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #will import random and set variables
  2. import random
  3. numrock = 0
  4. numpaper = 0
  5. numscissors = 0
  6. fingers = 0
  7. weapon = 0
  8. win = 0
  9. lost = 0
  10. tie = 0
  11. values = []
  12. comvalues = []
  13. respond == False
  14. #will return rock, paper, or scissors randomly and save the computer's weapon in a list
  15. def hand():
  16. global fingers, comvalues, respond
  17. while respond == False:
  18. fingers = random.randint(1,3)
  19. if fingers == 1:
  20. print('I placed down rock!')
  21. comvalues.append('r')
  22. return 'r'
  23. elif fingers == 2:
  24. print('I placed down paper!')
  25. comvalues.append('p')
  26. return 'p'
  27. else:
  28. print('I place down scissors!')
  29. comvalues.append('s')
  30. return 's'
  31. #will set the program to respond to previous entries
  32. def respond(numrock, numpaper,numscissors):
  33. global fingers
  34. if int(numrock) > int(numpaper):
  35. if int(numrock) > int(numscissors):
  36. fingers == 2
  37. hand()
  38. respond == True
  39. return respond
  40. return fingers
  41. else:
  42. fingers == 1
  43. hand()
  44. respond == True
  45. return respond
  46. return fingers
  47. else:
  48. if int(numpaper) > int(numscissors):
  49. fingers == 3
  50. hand()
  51. respond == True
  52. return respond
  53. return fingers
  54. else:
  55. fingers == 1
  56. hand()
  57. respond == True
  58. return respond
  59. return fingers
  60. #Main Program
  61. print('Welcome to Rock, Paper, and Scissors. You know the rules already. But, we will play for as long as you want. If you win more rounds, then you survive. If I win though, well... you already know.')
  62. while True:
  63. weapon = input('Choose a weapon(r for rock, p for paper, s for scissors, q for quit)!: ').lower()
  64. if weapon == 'q':
  65. record()
  66. break
  67. elif weapon == 'r' or weapon == 'p' or weapon == 's':
  68. if game(weapon):
  69. respond(numrock, numpaper, numscissors)
  70. else:
  71. print("Incorrect option! Please try again.")
  72. continue
  73.  
  74. respond == True
  75.  
  76. respond = True
Add Comment
Please, Sign In to add comment