• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest May 22nd, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import time
2. import random
3.
4.
5.
7.
8. loggedin1 = 0
9. loggedin2 = 0
10. while loggedin1 != 1:
13.
15.         loggedin1 = loggedin1 + 1
16.         time.sleep(1)
18.     else:
19.         time.sleep(1)
21.
22.
23. while loggedin2 != 1:
26.
28.         loggedin2 = loggedin2 + 1
29.         time.sleep(1)
31.     else:
32.         time.sleep(1)
34.
35.
36.
37. #dice game
38. round1 = 0
39. score1 = 0
40. score2 = 0
41. total1 = 0
42. total2 = 0
43. player1 = 0
44. player2 = 0
45.
46.
47. for x in range(0,5):    #loops game 5 times
48. #player 1
49.     die1 = random.randint(1,6)
50.     die2 = random.randint(1,6)
51.     total1 = die1 + die2
52.     round1 = round1 + 1
53.
54.     time.sleep(1.2)
55.
56.     if total1 % 2 == 0:     #check if odd or even
57.         total1 = total1+10
58.         score1 = score1+total1
59.         print('Round' +str(round1) + ': ' + username1+'s' + ' total is ' + str(total1))
60.     else:
61.         total1 = total1 - 5
62.         print('Round' +str(round1) + ': ' + username1+'s' + ' total is ' + str(total1))
63.         score1 = score1+total1
64.     if die1 == die2:
65.         total1= total1 + random.randint(1,6)      #3rd dice is roll a double
66.         print(total1)
67.         score1 = score1+total1
68.     elif total1 < 0:       #makes total 0 instead of negative -- not working
69.         total1 == 0
70.         score1 = score1 + total1
71. print('Your total score is ' + str(score1))
72.
73.
74.
75.
76.
77. round1 = 0
78.
79. #player2
80. for x in range(0,5):
81.     die1 = random.randint(1,6)
82.     die2 = random.randint(1,6)
83.     total2 = die1 + die2
84.     round1 = round1 + 1
85.
86.     time.sleep(1.2)
87.
88.     if total2 % 2 == 0:     #check if odd or even
89.         total2 = total2+10
90.         print('Round' +str(round1) + ': Your total is ' + str(total2))
91.         score2 = score2+total2
92.     else:
93.         total2 = total2 - 5
94.         print('Round' +str(round1) + ': Your total is ' + str(total2))
95.         score2 = score2+total2
96.     if die1 == die2:
97.         total2= total2 + random.randint(1,6)      #3rd dice is roll a double
98.         print(total2)
99.         score2 = score2+total2
100.     elif total2 < 0:       #makes total 0 instead of negative
101.         total2 == 0
102.         score2 = score2 + total2
103. print('Your total score is ' + str(score2)) #problem here
104.
105. '''
106. #works out and declares the winner
107. if score1 > score2:
108. print(username1 + ' has won!')
109. elif score1 < score2:
110. print(username2 + ' has won!')
111.
112. #tiebreak
113.
114. '''
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.

Top