Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random #importing variables
- import time
- i = 0
- Player1Points = 0
- Player2Points = 0 #setting the values of the variables
- Player1Tiebreaker = 0
- Player2Tiebreaker = 0
- WinPoints = 0
- user1 = False
- user2 = False
- while user1 == False:
- username = input("What is your Username: ") #asking for username (can be anything) and password (Pre-set password)
- password = input("Please Enter Password: ")
- if len(username) < 20: #making sure the length of the username is lower than 20
- if password == '1029': #making sure the password == '1029'
- print("Welcome, ",username," You have successfully signed in!")
- user1 == True
- user1 = username
- else:
- print("Incorrect Username, Please Try Again: ")
- while user2 == False:
- username = input("What is your Username: ")
- password = input("What is your Password: ")
- if len(username) <20:
- if password == '5678': #repeating the proccess for the second player
- print("Welcome,",username," You have successfully signed in!")
- user2 == True
- user2 = username
- else:
- print("Incorrect Username, Please Try Again: ")
- print("To roll the dice press 'ENTER'")
- def roll(): #defining what roll is
- points = 0
- dice1 = random.randint(1,6)
- dice2 = random.randint(1,6)
- dicetotal = dice1 + dice2 #the dice roll itself
- points = points + dicetotal #adding th dice score to the total score
- return(points)
- for i in range(1,5):
- start = input()
- Player1Points += roll()
- print("After this round, ",user1,"You now Have: ",Player1Points,"Points ")
- time.sleep(1)
- Player2Points += roll()
- print("After this round, ",user2,"You now Have: ",Player2Points,"Points ")
- time.sleep(2)
- if Player1Points == Player2Points:
- while Player1Tiebreaker == Player2TieBreaker:
- Player1Tiebreaker = random.randint(1,6)
- Player2Tiebreaker = random.randint(1,6)
- if Player1Tiebreaker > Player2Tiebreaker:
- Player2Points = 0
- elif Player2Tiebreaker > Player1Tiebreaker:
- Player1Points = 0
- if Player1Points>Player2Points:
- WinPoints = Player1Points
- WinUser = user1
- Winner = (WinPoints, user1)
- elif Player2Points > Player1Points:
- WinPoints = Player2Points
- Winner = (WinPoints, user2)
- WinUser = user2
- print("Well done! ", WinUser,"you Won with: ", WinPoints,"Points")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement