Skip to main content
#4x: Codding in Python {Rock-Paper-Scissor}
- #imcool
- list1 = [1,2,3]
- scoreP = 0
- scoreB = 0
- import random
- def logic(i,j):
- global scoreP, current
- #Rock
- if i == 1 and j == 1: current = 0;
- if i == 1 and j == 2: current = -1;
- if i == 1 and j == 3: current = 1;
- #Paper
- if i == 2 and j == 1: current = 1;
- if i == 2 and j == 2: current = 0;
- if i == 2 and j == 3: current = -1;
- #Scissor
- if i == 3 and j == 1: current = -1;
- if i == 3 and j == 2: current = 1;
- if i == 3 and j == 3: current = 0;
- return current
- def gap(n):
- for i in range(n):
- print()
- def wot(m):
- if m == 1: dho = "Rock"
- if m == 2: dho = "Paper"
- if m == 3: dho = "Scissor"
- return dho
- limit = int(input("Enter score limit:"))
- while 1==1:
- gap(10)
- if scoreB == limit-1 or scoreP == limit-1: print("MATCH POINT!")
- print("1 = Rock")
- print("2 = Paper")
- print("3 = Scissor")
- player = int(input("enter choice 1,2,3: " ))
- if player not in (list1):
- print("fucc u stupid son of a bitch, retry and put correct input")
- else:
- bot = random.choice(list1)
- logic(player,bot)
- print()
- if current == 1:
- scoreP += 1
- print ('Your choice:' , wot(player),'||| Bots choice:',wot(bot))
- print("ONE point to you! ", scoreP, ":", scoreB)
- if current == -1:
- scoreB += 1
- print ('Your choice: ' , wot(player),'||| Bots choice: ',wot(bot))
- print("ha ha noob, computer scores ONE point! ", scoreP, ":", scoreB)
- if current == 0:
- print ('Your choice: ' , wot(player),'||| Bots choice: ', wot(bot))
- print("Damn! Draw no one scores! ", scoreP, ":", scoreB)
- print()
- if scoreB == limit:
- print("HA HA noob you loose, computer wins ", scoreP, ":", scoreB)
- break
- if scoreP == limit:
- print("You win! ", scoreP, ":", scoreB)
- break
Click here to download the same.
Comments