#4x: Codding in Python {Rock-Paper-Scissor}

  1.  #imcool
  2. list1 = [1,2,3]
  3. scoreP = 0
  4. scoreB = 0
  5. import random
  6. def logic(i,j):
  7.     global scoreP, current
  8.     #Rock
  9.     if i == 1 and j == 1: current = 0; 
  10.     if i == 1 and j == 2: current = -1; 
  11.     if i == 1 and j == 3: current = 1; 
  12.     #Paper
  13.     if i == 2 and j == 1: current = 1; 
  14.     if i == 2 and j == 2: current = 0; 
  15.     if i == 2 and j == 3: current = -1; 
  16.     #Scissor 
  17.     if i == 3 and j == 1: current = -1; 
  18.     if i == 3 and j == 2: current = 1; 
  19.     if i == 3 and j == 3: current = 0; 
  20.     return current
  21. def gap(n):
  22.     for i in range(n):
  23.         print()
  24. def wot(m):
  25.     if m == 1: dho = "Rock"
  26.     if m == 2: dho = "Paper"
  27.     if m == 3: dho = "Scissor"
  28.     return dho
  29. limit = int(input("Enter score limit:"))
  30. while 1==1:
  31.     gap(10)
  32.     if scoreB == limit-1 or scoreP == limit-1: print("MATCH POINT!")
  33.     print("1 = Rock")
  34.     print("2 = Paper")
  35.     print("3 = Scissor")
  36.     player = int(input("enter choice 1,2,3: " ))
  37.     if player not in (list1):
  38.         print("fucc u stupid son of a bitch, retry and put correct input")      
  39.      else:
  40.         bot = random.choice(list1)
  41.         logic(player,bot)
  42.         print()        
  43.         if current == 1:
  44.             scoreP += 1
  45.             print ('Your choice:' , wot(player),'||| Bots choice:',wot(bot))
  46.             print("ONE point to you!                                                                       ", scoreP, ":", scoreB) 
  47.         if current == -1:
  48.             scoreB += 1
  49.             print ('Your choice: ' , wot(player),'||| Bots choice: ',wot(bot))
  50.             print("ha ha noob, computer scores ONE point!                                 ", scoreP, ":", scoreB) 
  51.         if current == 0:
  52.             print ('Your choice: ' , wot(player),'||| Bots choice: ', wot(bot))
  53.             print("Damn! Draw no one scores!                                                       ",  scoreP, ":", scoreB)
  54.         print()
  55.         if scoreB == limit:
  56.             print("HA HA noob you loose, computer wins                                   ", scoreP, ":", scoreB)
  57.             break            
  58.         if scoreP == limit:
  59.             print("You win!                                                                                       ", scoreP, ":", scoreB)
  60.             break


Click here to download the same.


Comments