repl.it
@AidanMundle/

yahtzee.py

Python

No description

fork
loading
Files
  • main.py
  • yahtzee.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
from yahtzee import *

score = 0

# Test 1
if yahtzee(4,4):
    score += 1
else:
    print( 'Test #1 Failed')

# Test 2
if four_of_a_kind(1,1,1,5):
    score += 1
else:
    print( 'Test #2 Failed')

# Test 3
if four_of_a_kind(2,4,4,4):
    score += 1
else:
    print( 'Test #3 Failed')

# Test 4
if three_of_a_kind(1,2,2,2,6):
    score += 1
else:
    print( 'Test #4 Failed')

# Test 5
if three_of_a_kind(1,1,1,4,5):
    score += 1
else:
    print( 'Test #5 Failed')

# Test 6
if three_of_a_kind(1,2,3,3,3):
    score += 1
else:
    print( 'Test #6 Failed')

# Test 7
if full_house(3,3,6,6,6):
    score += 1
else:
    print( 'Test #7 Failed')

# Test 8
if full_house(2,2,2,5,5):
    score += 1
else:
    print( 'Test #8 Failed')

# Test 9
if large_straight(2,3,4,5,6):
    score += 1
else:
    print( 'Test #9 Failed')

# Test 10
if large_straight(1,2,3,4,5):
    score += 1
else:
    print( 'Test #10 Failed')

# Test 11
if small_straight(2,3,4,5,5):
    score += 1
else:
    print( 'Test #11 Failed')

# Test 12
if small_straight(1,3,4,5,6):
    score += 1
else:
    print( 'Test #12 Failed')

# Negative Tests
# Test 13
if small_straight(1,2,4,4,4):
    print( 'Test #13 Failed')
else:
    score += 1

# Test 14
if small_straight(1,2,3,4,5):
    print( 'Test #14 Failed')
else:
    score += 1

# Test 15
if full_house(1,2,2,2,2):
    print( 'Test #15 Failed')
else:
    score += 1

# Test 16
if full_house(2,2,2,2,2):
    print( 'Test #16 Failed')
else:
    score += 1

# Test 17
if large_straight(1,2,3,4,6):
    print( 'Test #17 Failed')
else:
    score += 1

# Test 18
if large_straight(1,2,3,5,6):
    print( 'Test #18 Failed')
else:
    score += 1

# Test 19
if yahtzee(4,6):
    print( 'Test #19 Failed')
else:
    score += 1

# Test 20
if four_of_a_kind(1,2,4,4):
    print( 'Test #20 Failed')
else:
    score += 1

# Test 21
if four_of_a_kind(2,2,5,6):
    print( 'Test #21 Failed')
else:
    score += 1

# Test 22
if three_of_a_kind(1,2,3,5,5):
    print( 'Test #22 Failed')
else:
    score += 1

# Test 23
if three_of_a_kind(2,2,2,2,2):
    print( 'Test #23 Failed')
else:
    score += 1

# Test 24
if three_of_a_kind(2,2,2,2,5):
    print( 'Test #24 Failed')
else:
    score += 1

mark = score / 24 * 100
print( "Total Score: {:04.1f} %".format(mark) )
Fetching token
?