Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import secrets
- import datetime
- from functions import login, highesths, finalshowdown
- #setup
- date = datetime.date.today()
- date = date.strftime("%d/%m/%Y")
- n = 0
- even = [2, 4, 6, 8, 10, 12]
- odd = [1, 3, 5, 7, 9, 11]
- dice = [0, 0, 0]
- dice2 = [1, 2, 3, 4, 5, 6]
- totaldice = 0
- totalscore = [0, 0]
- roundscore = 0
- decidingscore = 0
- loginfile = ""
- i = 1
- player1 = input("What is player 1's username? \n")
- login(player1)
- #Player 2
- player2 = input("What is player 2's username? \n")
- login(player2)
- #Dice Rolling
- for i in range(5):
- print("Round " + str(i + 1) + "\n\n\n")
- #Player 1
- print('Player 1 is Rolling the Dice!\n')
- for n in range(2):
- dice[n] = secrets.choice(dice2)
- print('Player 1 Rolled a ' + str(dice[n]) + "\n")
- totaldice = totaldice + dice[n]
- n+1
- n = 0
- roundscore = 0 + totaldice
- if totaldice in even:
- roundscore = (roundscore + 10)
- print("Congrats!! You rolled an even total!! You got 10 points added to your score!")
- elif totaldice in odd:
- roundscore = (roundscore - 5)
- print("Oh No!! You rolled an odd total!! You got 5 points removed from your score!")
- if dice[0] == dice[1]:
- print('You Rolled a double!\nYou get to roll another Die!\n')
- input('Press Enter to roll again:\n')
- dice[2] = secrets.choice(dice2)
- roundscore = roundscore + dice[2]
- print('Player 1 Rolled a ' + str(dice[2]) + "\n")
- totaldice = 0
- totalscore[0] = totalscore[0] + roundscore
- if roundscore < 0:
- roundscore = 0
- print("Player 1's round score is " + str(roundscore) + "\n\n")
- #Player 2
- print('Player 2 is rolling the Dice! \n')
- for n in range(2):
- dice[n] = secrets.choice(dice2)
- print('Player 2 Rolled a ' + str(dice[n]) + "\n")
- totaldice = totaldice + dice[n]
- n+1
- n = 0
- roundscore = 0 + totaldice
- if totaldice in even:
- roundscore = (roundscore + 10)
- print("Congrats!! You rolled an even total!! You got 10 points added to your score!")
- elif totaldice in odd:
- roundscore = (roundscore - 5)
- print("Oh No!! You rolled an odd total!! You got 5 points removed from your score!")
- if dice[0] == dice[1]:
- print('You Rolled a double!\nYou get to roll another Die!\n')
- input('Press Enter to roll again:\n')
- dice[2] = secrets.choice(dice2)
- roundscore = roundscore + dice[2]
- print('Player 2 Rolled a ' + str(dice[2]) + "\n")
- totaldice = 0
- totalscore[1] = totalscore[1] + roundscore
- if roundscore < 0:
- roundscore = 0
- print("Player 2's round score is " + str(roundscore) + "\n\n")
- if totalscore[0] < 0:
- totalscore[0] = 1
- elif totalscore[1] < 0:
- totalscore[1] = 1
- print("Player 1's total score is " + str(totalscore[0]) + "\n")
- print("Player 2's total score is " + str(totalscore[1]) + "\n")
- if i == 4:
- if totalscore[0] == totalscore[1]:
- finalshowdown(totalscore, dice, dice2, n)
- elif totalscore[0] > totalscore[1]:
- print("Player 1 Won!!\n\n")
- file = open('Scores.txt', 'a')
- file.write(player1 + ', ' + str(date) + ', ' + str(totalscore[0]) + ',\n')
- file.close()
- elif totalscore[1] > totalscore[0]:
- print("Player 2 Won!!\n\n")
- file = open('Scores.txt', 'a')
- file.write(player2 + ', ' + str(date) + ', ' + str(totalscore[1]) + ',\n')
- file.close()
- else:
- input("Press 'Enter' to begin the next round\n")
- highesths()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement