-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswiss.py
40 lines (30 loc) · 875 Bytes
/
swiss.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
class player:
def __init__(self, name):
self.name = name
score = 0
def __repr__(self):
return f"<Player: {self.name}>"
class edge:
def __init__(self, fromP, toP, weight):
class swiss:
score = []
matched = []
umatched = []
def new_selection(arr):
for player in range(len(arr)):
epsilon = max(self.score)
for opponent in range(len(arr)):
if player == opponent: continue
if opponent in self.matched[player]:
distance = abs(score[player] - score[opponent])
if distance < epsilon:
epsilon = distance
def fillPlayers():
players = []
for i in range(16):
p = player(i)
players.append(p)
return players
if __name__ == "__main__":
box = fillPlayers()
print(box)