uccjshrimpton

Rock Paper Scissors (Weighted)

May 13th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.15 KB | None | 0 0
  1. def RockPrint():
  2.     print("""
  3. ______           _    
  4. | ___ \        | |  
  5. | |_/ /___   ___| | __
  6. |    // _ \ / __| |/ /
  7. | |\ \ (_) | (__|   <
  8. \_| \_\___/ \___|_|\_\
  9. """)
  10.  
  11. def PaperPrint():
  12.     print("""
  13. ______                    
  14. | ___ \                  
  15. | |_/ /_ _ _ __   ___ _ __
  16. |  __/ _` | '_ \ / _ \ '__|
  17. | | | (_| | |_) |  __/ |  
  18. \_|  \__,_| .__/ \___|_|  
  19.          | |              
  20.          |_|
  21. """)
  22.  
  23. def ScissorsPrint():
  24.     print("""
  25. _____      _                        
  26. /  ___|    (_)                      
  27. \ `--.  ___ _ ___ ___  ___  _ __ ___
  28. `--. \/ __| / __/ __|/ _ \| '__/ __|
  29. /\__/ / (__| \__ \__ \ (_) | |  \__ \
  30. \____/ \___|_|___/___/\___/|_|  |___/
  31. """)
  32.  
  33. def Introduction():
  34.     print("Welcome to Rock Paper Scissors.")
  35.     sleep(2)
  36.     print("This version of the game will try to beat you based on the answers that you have given over time.")
  37.     sleep(2)
  38.     print("To play, all you must do is type 'R', 'P' or 'S' to indicate your choice")
  39.     sleep(2)
  40.     print("Game starting in...")
  41.     sleep(2)
  42.     print("3")
  43.     sleep(1)
  44.     print("2")
  45.     sleep(1)
  46.     print("1")
  47.     sleep(1)
  48.     Main([1,5],[1,5],[1,5],0,0)
  49.  
  50. def Main(RockRange,PaperRange,ScissorRange,CPUScore,PlayerScore):
  51.  
  52.     ChoiceName = ""
  53.     while ChoiceName != "Rock" and ChoiceName != "Paper" and ChoiceName != "Scissors":    
  54.         UserInput = input("Enter your choice now, (R, P, or S)")
  55.         if UserInput.upper() == "R":
  56.             ChoiceName = "Rock"
  57.             PaperRange[0] += 2
  58.             PaperRange[1] += 2
  59.         elif UserInput.upper() == "P":
  60.             ChoiceName = "Paper"
  61.             ScissorsRange[0] += 2
  62.             ScissorsRange[1] += 2
  63.         elif UserInput.upper() == "S":
  64.             ChoiceName = "Scissors"
  65.             RockRange[0] += 2
  66.             RockRange[1] += 2
  67.         else:
  68.             print("You did not enter a valid choice, please try again")
  69.             sleep(2)
  70.  
  71.     print("Hmmm... let me think")
  72.     sleep(1)
  73.     for i in range(3):
  74.         print(".")
  75.         sleep(1)
  76.  
  77.     results = WinCalculator(RockRange,PaperRange,ScissorRange)
  78.  
  79.     CPUChoice = results[0]
  80.     RockRange = results[1]
  81.     PaperRange = results[2]
  82.     ScissorRange = results[3]
  83.    
  84.     print("I see your",ChoiceName,"and I raise you...")
  85.     sleep(2)
  86.    
  87.     if CPUChoice == "Rock":
  88.         if ChoiceName == "Paper":
  89.             print("You win this round")
  90.             PlayerScore += 1
  91.         elif ChoiceName == "Scissors":
  92.             print("I win this round")
  93.             CPUScore += 1
  94.         else:
  95.             print("Draw")
  96.         RockPrint()
  97.        
  98.     elif CPUChoice == "Paper":
  99.         if ChoiceName == "Scissors":
  100.             print("You win this round")
  101.             PlayerScore += 1
  102.         elif ChoiceName == "Rock":
  103.             print("I win this round")
  104.             CPUScore += 1
  105.         else:
  106.             print("Draw")
  107.         PaperPrint()
  108.        
  109.     elif CPUChoice == "Scissors":
  110.         if ChoiceName == "Rock":
  111.             print("You win this round")
  112.             PlayerScore += 1
  113.         elif ChoiceName == "Paper":
  114.             print("I win this round")
  115.             CPUScore += 1
  116.         else:
  117.             print("Draw")
  118.         ScissorsPrint()
  119.  
  120.     sleep(2)
  121.  
  122.     print("Current scores:")
  123.     print("Player:",PlayerScore)
  124.     print("CPU:",CPUScore)
  125.  
  126.     Main(RockRange,PaperRange,ScissorRange,CPUScore,PlayerScore)
  127.    
  128.  
  129. def WinCalculator(RockRange,PaperRange,ScissorRange):
  130.     RockChance = randint(RockRange[0],RockRange[1])
  131.     PaperChance = randint(PaperRange[0],PaperRange[1])
  132.     ScissorChance = randint(ScissorRange[0],ScissorRange[1])
  133.     CPUChoice = ""
  134.    
  135.     if RockChance > PaperChance and RockChance > ScissorChance:
  136.         CPUChoice = "Rock"
  137.     elif PaperChance > RockChance and PaperChance > ScissorChance:
  138.         CPUChoice=  "Paper"
  139.     elif ScissorChance > RockChance and ScissorChance > PaperChance:
  140.         CPUChoice = "Scissors"
  141.     else:
  142.         WinCalculator(RockRange,PaperRange,ScissorRange)
  143.  
  144.     return CPUChoice, RockRange, PaperRange, ScissorRange                    
  145.  
  146.  
  147. from time import sleep
  148. from random import randint
  149. Introduction()
Add Comment
Please, Sign In to add comment