mburton2

Final RPC game

Sep 8th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.55 KB | None | 0 0
  1. import random
  2.  
  3. fox = random.randint(1, 3)
  4.  
  5.  
  6. print '*' * 50
  7. print ' ' * 10, 'Welcome To Rock Paper Scissors!'
  8. print '*' * 50
  9. opener = raw_input('\nDO YOU THINK YOU HAVE WHAT IT TAKES!!!')
  10. guts = opener.lower()[0:1]
  11.  
  12. def greeter():
  13.     if guts == 'n':
  14.         print 'pussy'
  15.     elif guts == 'y':
  16.         print "Alright then, it's on baby!"
  17.     else:
  18.         print 'okay then'
  19.  
  20. welcome = greeter()
  21.    
  22. def computer(fox):
  23.     if fox == 1:
  24.         return str('r')
  25.     elif fox == 2:
  26.         return str('s')
  27.     elif fox == 3:
  28.         return str('p')
  29.     else:
  30.         print "PROBLEM!"
  31.  
  32. thrower = computer(fox)
  33. num_round = raw_input('\nHow many rounds?')
  34. num_rounds = range(1, int(num_round) + 1)
  35. list1 = [0,0,0]
  36. score1 = list1[0]
  37. score2 = list1[1]
  38.  
  39. def player():
  40.     choose = raw_input("\nRock, Paper, or Scissors? ")
  41.     choice = choose.lower()
  42.     return choice[0:1]
  43.  
  44. #print player1 #test
  45. #print num_rounds #test
  46. #print score1, score2, thrower #test
  47. junk = [0,0,0]
  48. junkloop = range(1,5000000)
  49.  
  50. for number in num_rounds:
  51.     player1 = player()
  52.     thrower = computer(fox)
  53.     fox = random.randint(1, 3)
  54.     if thrower == 'p':
  55.         for number in junkloop: junk[0] += 2
  56.         print 'I choose: Paper!'
  57.     elif thrower == 's':
  58.         for number in junkloop:
  59.             junk[1] += 2
  60.         print 'I choose: Scissors!'
  61.     elif thrower == 'r':
  62.         for number in junkloop:
  63.             junk[2] += 2
  64.         print 'I choose: Rock!'
  65.     else:
  66.         print "PROBLEM!!"
  67.    
  68.     if player1 == 'r' and thrower == 's':
  69.         list1[0] += 1; print 'You Win!\n'
  70.     elif player1 == 'p' and thrower == 'r':
  71.         list1[0] += 1; print 'You Win!\n'
  72.     elif player1 == 's' and thrower == 'p':
  73.         list1[0] += 1; print 'You Win\n'
  74.     elif player1 == thrower:
  75.         list1[2] += 1; print 'Draw!\n'
  76.         num_rounds = range(1, int(num_round)) + [1]
  77.     elif thrower == 'r' and player1 == 's':
  78.         list1[1] += 1; print 'I Win!\n'
  79.     elif thrower == 'p' and player1 == 'r':
  80.         list1[1] += 1; print 'I Win\n'
  81.     elif thrower == 's' and player1 == 'p':
  82.         list1[1] += 1; print 'I Win!\n'
  83.     else:
  84.         print 'Problem!!!'
  85.        
  86.     score1 = int(list1[0])
  87.     score2 = int(list1[1])
  88.     draws = list1[2]
  89.  
  90.  
  91. print 'Player: %r:   CPU: %r    Draws: %r\n' % (score1, score2, draws)
  92.  
  93. def judge(list1):
  94.     if list1[0] > list1[1]:
  95.         print 'And Player1 Wins!!!!'
  96.     elif list1[1] > list1[0]:
  97.         print 'Computer crushes man!'
  98.     elif list1[0] == list1[1]:
  99.         print 'A draw'
  100.  
  101.        
  102. jury = judge(list1)
Advertisement
Add Comment
Please, Sign In to add comment