-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteam.py
31 lines (26 loc) · 925 Bytes
/
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
class Time:
def __init__(self, players):
self.team = players
# self.price = self.get_price()
self.fit = self.get_fit()
self.acumulado = 0
def get_price(self):
price = 0
for player in self.team:
price += player.price
return price
def get_fit(self):
return self.get_average() + self.get_corrector_factor(self.get_average())
def get_corrector_factor(self, average):
corrector_factor = 0
for player in self.team:
if(self.checkPlayer(player, average)):
corrector_factor += player.overall - average
return corrector_factor / len(self.team)
def get_average(self):
average = 0
for player in self.team:
average += player.overall
return average / len(self.team)
def checkPlayer(self, player, average):
return player.overall > average