Advertisement
Guest User

roshambo

a guest
Jul 25th, 2014
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. def main():
  2. import random
  3. throws = ['rock', 'paper', 'scissors'] #list of choices for human and comp
  4. score = {'computer': 0, 'human': 0}
  5.  
  6. def yesno(what): #goes to roshambo but potentially something else I guess
  7. x = input('Are you ready to RO SHAM BO? enter y/n\n') #give them an option to play
  8. if(x == "y"):
  9. print ('Okay! \nThis is going to be SO MUCH FUN')
  10. what()
  11. elif x == "n":
  12. print ('Why did you even load this in the first place?')
  13. quit
  14. else:
  15. print ("seriously, I'm not good at this yet. Follow my instructions exactly.")
  16. yesno(roshambo)
  17.  
  18. def roshambo(): #game start
  19. print (score)
  20. compchoice = random.choice(throws)
  21. choice = input('Pick a choice! (rock, paper, or scissors), or press q to quit.\n\n\n\n') #explodes if you replace with 'choice = random.choice(throws)'
  22. if choice == 'q':
  23. quit
  24. elif compchoice != choice:
  25. winlose(choice, compchoice)
  26. else:
  27. print ('computer chose ' + compchoice + "! " + "you also chose " + choice + "!")
  28. print ("It's a tie! duuuuuuuuuuude!")
  29. roshambo()
  30.  
  31.  
  32. def winlose(choice, compchoice): #actual what beats what
  33.  
  34. print ('The computer played ' + compchoice + '!')
  35.  
  36. if choice == 'rock' and compchoice == 'paper':
  37. print ('paper beats rock! For some reason. You lose!')
  38. score['computer'] += 1
  39. roshambo()
  40. elif choice == 'rock' and compchoice == 'scissors':
  41. print ('rock beats scissors! You win!')
  42. score['human'] += 1
  43. roshambo()
  44. elif choice == 'paper' and compchoice == 'rock':
  45. print ('paper beats rock! For some reason. You win!')
  46. score['human'] += 1
  47. roshambo()
  48. elif choice == 'paper' and compchoice == 'scissors':
  49. print ('scissors beats paper! You lose!')
  50. score['computer'] += 1
  51. roshambo()
  52. elif choice == 'scissors' and compchoice == 'paper':
  53. print ('scissors beats paper! You win!')
  54. score['human'] += 1
  55. roshambo()
  56. elif choice == 'scissors' and compchoice == 'rock':
  57. print ('rock beats scissors! You lose!')
  58. score['computer'] += 1
  59. roshambo()
  60. else:
  61. print ('Please comply or you will be terminated')
  62. yesno(roshambo)
  63.  
  64. yesno(roshambo) # explodes if you replace with "while True: roshambo()" and previous choice statement
  65.  
  66. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement