-
Notifications
You must be signed in to change notification settings - Fork 0
/
chess_test.py
123 lines (109 loc) · 2.53 KB
/
chess_test.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
from chess import player_result, determine_output
first_test_input = """Erik
Daniel
Charlotte
Anna
Bob
Femke
Anna Femke 1 0
Bob Erik 0 1
Charlotte Daniel 0.5 0.5
Erik Anna 1 0
Femke Charlotte 0.5 0.5
Daniel Bob 1 0
Daniel Erik 0.5 0.5
Charlotte Anna 1 0
Bob Femke 1 0"""
first_test_output = [
player_result('Erik', 2.5, 4.0, 3.0, 2),
player_result('Daniel', 2.0, 5.5, 3.25, 1),
player_result('Charlotte', 2.0, 3.5, 2.25, 1),
player_result('Anna', 1.0, 5.0, 0.5, 2),
player_result('Bob', 1.0, 5.0, 0.5, 1),
player_result('Femke', 0.5, 4.0, 1.0, 2)
]
if determine_output(first_test_input) == first_test_output:
print('you passed the first test')
else:
print("you didn't pass the first test")
second_test_input = """Trees
Erik
Udo
Ronald
Truus
Omar
Cornelis
Ria
Otto
Emma
Henk
Ulrich
Cor
Piet
Theo
Thea
Trees Erik 0.5 0.5
Udo Ronald 0.5 0.5
Truus Omar 1 0
Cornelis Ria 0 1
Otto Emma 0.5 0.5
Henk Ulrich 1 0
Cor Piet 1 0
Theo Thea 1 0
Ria Cor 0.5 0.5
Theo Truus 1 0
Ronald Henk 0.5 0.5
Emma Udo 0.5 0.5
Erik Otto 0.5 0.5
Ulrich Trees 1 0
Piet Thea 1 0
Omar Cornelis 0 1
Cor Theo 0 1
Ria Henk 0.5 0.5
Ronald Emma 0.5 0.5
Otto Udo 0.5 0.5
Ulrich Truus 0 1
Erik Cornelis 1 0
Piet Trees 0.5 0.5
Thea Omar 0 1
Henk Theo 1 0
Truus Ria 0.5 0.5
Udo Erik 0 1
Otto Ronald 0.5 0.5
Emma Cor 0.5 0.5
Cornelis Piet 1 0
Omar Ulrich 1 0
Trees Thea 1 0
Henk Erik 0.5 0.5
Theo Ria 1 0
Truus Cor 0 1
Cornelis Ronald 0.5 0.5
Trees Otto 0 1
Omar Emma 0.5 0.5
Udo Piet 0.5 0.5
Thea Ulrich 1 0"""
second_test_output = [
player_result('Theo', 4.0, 12.5, 9.0, 2),
player_result('Henk', 3.5, 13.5, 9.25, 2),
player_result('Erik', 3.5, 13.0, 8.75, 3),
player_result('Cor', 3.0, 13.5, 7.0, 3),
player_result('Otto', 3.0, 12.5, 7.25, 2),
player_result('Ria', 2.5, 15.5, 7.0, 3),
player_result('Ronald', 2.5, 13.5, 6.75, 3),
player_result('Emma', 2.5, 13.0, 6.5, 3),
player_result('Cornelis', 2.5, 13.0, 5.75, 2),
player_result('Truus', 2.5, 13.0, 4.75, 2),
player_result('Omar', 2.5, 9.5, 3.25, 2),
player_result('Udo', 2.0, 13.5, 5.0, 2),
player_result('Trees', 2.0, 10.5, 3.75, 2),
player_result('Piet', 2.0, 10.5, 3.0, 3),
player_result('Ulrich', 1.0, 11.5, 2.0, 3),
player_result('Thea', 1.0, 11.5, 1.0, 3)
]
if determine_output(second_test_input) == second_test_output:
print('you passed the second test')
else:
print("you didn't pass the second test")
from pprint import pprint
pprint([e for e in second_test_output][7:10])
pprint([e for e in determine_output(second_test_input)][7:10])