mburton2

RPC

Sep 6th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import random
  2.    
  3. fox = random.randint(0,900)
  4.  
  5. def thrower1(fox):
  6.     fox = random.randint(0,900)
  7.     if fox <= 300:
  8.         return 'r'
  9.     elif 300 < fox <= 600:
  10.         return 's'
  11.     else:
  12.         return 'p'
  13.  
  14. rd1 = thrower1(fox)
  15.  
  16.  
  17.  
  18. choose = str(raw_input("Rock, Paper, or Scissors?"))
  19. choice = choose.lower()[0:1]
  20.  
  21. def ref(choice, rd1):
  22.     if choice == 'r' and rd1 == 'p':
  23.         return 'Computer throws paper, You Win!'
  24.     elif choice == 'p' and rd1 == 'r':
  25.         return 'Computer throws rock, You Win!'
  26.     elif choice == 's' and rd1 == 'p':
  27.         return 'Computer throws paper, You Win!'
  28.     elif choice == rd1:
  29.         return "Draw"
  30.     else:
  31.         return "I Win!"
  32.        
  33. results = ref(choice, rd1)
  34. print results
Advertisement
Add Comment
Please, Sign In to add comment