-
Notifications
You must be signed in to change notification settings - Fork 0
/
Team.py
39 lines (34 loc) · 1.33 KB
/
Team.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 Team(object):
"""represents a team"""
def __init__(self, name, displayName, abbreviation, conference, division):
self.name = name
self.displayName = displayName
self.abbreviation = abbreviation
self.conference = conference
self.division = division
self.wins = 0
self.losses = 0
self.ties = 0
self.divisionWins = 0
self.divisionLosses = 0
self.divisionTies = 0
self.conferenceWins = 0
self.conferenceLosses = 0
self.conferenceTies = 0
self.points_for = 0
self.points_against = 0
self.pct = 0.0
self.divisionPct = 0.0
self.conferencePct = 0.0
self.strength = 1.0
def debug(self):
print(self.__dict__)
def calculateStats(self):
if (self.wins + self.losses + self.ties) > 0:
self.pct = (self.wins + self.ties * 0.5) / (self.wins + self.losses + self.ties)
self.divisionPct = (self.divisionWins + self.divisionTies * 0.5) / \
(self.divisionWins + self.divisionLosses + self.divisionTies)
self.conferencePct = (self.conferenceWins + self.conferenceTies * 0.5) / \
(self.conferenceWins + self.conferenceLosses + self.conferenceTies)
def getDivision(self):
return self.division