SHARE
TWEET

Untitled

a guest Oct 4th, 2019 179 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random               #importing variables
  2. import time
  3.  
  4. i = 0
  5. Player1Points = 0
  6. Player2Points = 0                #setting the values of the variables
  7. Player1Tiebreaker = 0    
  8. Player2Tiebreaker = 0    
  9. WinPoints = 0                  
  10.                          
  11. user1 = False
  12. user2 = False
  13. while user1 == False:
  14.     username = input("What is your Username: ")            #asking for username (can be anything) and password (Pre-set password)
  15.     password = input("Please Enter Password: ")
  16.     if len(username) < 20:                           #making sure the length of the username is lower than 20
  17.         if password == '1029':                           #making sure the password == '1029'
  18.             print("Welcome, ",username," You have successfully signed in!")
  19.             user1 == True
  20.             user1 = username
  21.         else:
  22.             print("Incorrect Username, Please Try Again: ")
  23.      
  24. while user2 == False:
  25.     username = input("What is your Username: ")
  26.     password = input("What is your Password: ")
  27.     if len(username) <20:
  28.         if password == '5678':                                                     #repeating the proccess for the second player
  29.             print("Welcome,",username," You have successfully signed in!")
  30.             user2 == True
  31.             user2 = username
  32.         else:
  33.             print("Incorrect Username, Please Try Again: ")
  34.  
  35. print("To roll the dice press 'ENTER'")
  36.  
  37. def roll():                      #defining what roll is
  38.     points = 0
  39.     dice1 = random.randint(1,6)
  40.     dice2 = random.randint(1,6)
  41.     dicetotal = dice1 + dice2           #the dice roll itself
  42.     points = points + dicetotal      #adding th dice score to the total score
  43.  
  44.  
  45.     return(points)
  46.  
  47. for i in range(1,5):
  48.     start = input()
  49.     Player1Points += roll()
  50.     print("After this round, ",user1,"You now Have: ",Player1Points,"Points ")
  51.     time.sleep(1)
  52.     Player2Points += roll()
  53.     print("After this round, ",user2,"You now Have: ",Player2Points,"Points ")
  54.     time.sleep(2)
  55.  
  56. if Player1Points == Player2Points:
  57.     while Player1Tiebreaker == Player2TieBreaker:
  58.  
  59.         Player1Tiebreaker = random.randint(1,6)
  60.         Player2Tiebreaker = random.randint(1,6)
  61.  
  62.     if Player1Tiebreaker > Player2Tiebreaker:
  63.         Player2Points = 0
  64.     elif Player2Tiebreaker > Player1Tiebreaker:
  65.         Player1Points = 0
  66.  
  67. if Player1Points>Player2Points:
  68.     WinPoints = Player1Points
  69.     WinUser = user1
  70.     Winner = (WinPoints, user1)
  71. elif Player2Points > Player1Points:
  72.     WinPoints = Player2Points
  73.     Winner = (WinPoints, user2)
  74.     WinUser = user2
  75.  
  76. print("Well done! ", WinUser,"you Won with: ", WinPoints,"Points")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top