Advertisement
Guest User

[Noob/Basic] Rock/Stone/Paper [guide]

a guest
May 27th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. # Copyright 2015 (sayan)
  2. # www.fb.com/snbk97
  3.  
  4. import time #OPTIONAL
  5. import random #COMPULSARY
  6. """
  7. CHOICE <=> SELECTION
  8. #1 rock
  9. #2 paper                         #EVERY THING IS COMMENTS HERE
  10. #3 Scissor
  11. """
  12. # Score System
  13. CPU=0
  14. YOU=0
  15. #game start
  16. re = raw_input("Start Game (Yes/No)")
  17.  
  18. #Program begins here
  19. while (re=='y') or (re=='Y') or (re=='yes') or (re=='Yes'):
  20.     a = random.randint(1,3)
  21.     print "\n"
  22.     #print (str(a)+" COMPUTER OUTPUT FOR TESTING RANDOM NUMBERS") #TESTING
  23.     b = int(raw_input("Enter Rock(1) Paper (2) Scissor (3): \n"))
  24.  
  25. #CONDITIONAL STATEMENTS
  26.     if (a==1 and b==1) or(a==2 and b==2) or(a==3 and b==3):
  27.         print ("\n TIE! \n")
  28.     elif (a==1 and b==2):
  29.         print ("CPU: Rock \n You:Paper \n YOU WIN!!")
  30.         YOU=YOU+1 #score
  31.     elif (a==1 and b==3):
  32.         print ("CPU: Rock \n You:Scissor \n CPU WIN!!")
  33.         CPU=CPU+1#score              
  34.     elif (a==2 and b==1):
  35.         print ("CPU: Paper \n You:Rock \n CPU WIN!!")
  36.         CPU=CPU+1#score
  37.     elif (a==2 and b==3):
  38.         print ("CPU:Paper \n You:Scissor \n YOU WIN!!")
  39.         YOU=YOU+1#score          
  40.     elif (a==3 and b==1):
  41.         print ("CPU:Scissor \n You:Rock \n YOU WIN!!")
  42.         YOU=YOU+1#score
  43.     elif (a==3 and b==2):
  44.         print ("CPU: Scissor \n You:Paper \n CPU WIN!!")
  45.         CPU=CPU+1#score
  46.     print "Player -",YOU, "CPU -",CPU
  47.     print "\n"
  48.     re = raw_input('Again? (Y/N)')
  49. #WHILE ends here
  50.  
  51.    
  52. #after while ends
  53. print "\n"
  54. print "Thanks for playing!"
  55. time.sleep(1) #OPTIONAL
  56. exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement