-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunit.py
More file actions
31 lines (28 loc) · 844 Bytes
/
Copy pathunit.py
File metadata and controls
31 lines (28 loc) · 844 Bytes
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 Unit:
def __init__(self):
self.id = 0
self.adaptation_degree = 0.00
self.kp_coverage = 0.00
self.problem_list = []
self.__difficulty = 0.00
self.__problem_count = 0
self.__sum_score = 0
@property
def difficulty(self):
diff = 0.00
if self.sum_score == 0:
return diff
for p in self.problem_list:
diff += (p.difficulty * p.score)
self.__difficulty = diff / self.sum_score
return self.__difficulty
@property
def problem_count(self):
self.__problem_count = len(self.problem_list)
return self.__problem_count
@property
def sum_score(self):
self.__sum_score = 0
for p in self.problem_list:
self.__sum_score += p.score
return self.__sum_score