-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathelo_classes.py
43 lines (30 loc) · 1.01 KB
/
elo_classes.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
# Copyright (c) 2016 by Matt Sewall.
# All rights reserved.
class Competitor:
def __init__(self, name, school, place, elo):
self.name = name
self.school = school
self.place = place
self.elo = elo
def __eq__(self, other):
return self.name == other.name and \
self.school == other.school
def __hash__(self):
return hash((self.name, self.school))
# Used as a class for example.py, and is not relevant to the core algorithm
class Athlete:
def __init__(self, name, school):
self.name = name
self.school = school
def __eq__(self, other):
return self.name == other.name and \
self.school == other.school
def __hash__(self):
return hash((self.name, self.school))
def __repr__(self):
return self.name
class Meet:
competitors = []
def addCompetitor(self, name, place, elo, school):
player = Competitor(name, school, place, elo)
self.competitors.append(player)